Re: [chirp_devel] [PATCH] Allow specification of the hexdump address format
On Jul 18, 2014, at 10:32 AM, Dan Smith - dsmith@danplanet.com wrote
This is saying nothing applied, which generally means that line endings aren't right. I think you're using a mac, which uses \r line endings (sometimes, not always, and I can never remember when/why). My guess would be that you copy-and-paste'd the patch out to a file? In that case, you've got \r endings and the code has \n. Thus, patch (or hg import in this case) can't find any lines that match.
Mac OS X is unix. Specifically, Darwin, which is derived from BSD unix and Next OS. https://en.wikipedia.org/wiki/Darwin_%28operating_system%29
See also https://en.wikipedia.org/wiki/Newline#Representations "LF: Multics, Unix and Unix-like systems (GNU/Linux, OS X, ...."
As Dave Nathanson, said, "Classic MacOS" used \r, but that hasn't been the Mac OS since about 2002. All the text files native to modern Macs use \n as the line terminator. Because unix.
Here's the first couple of lines of your patch, as I "saved as plain text" (not copy/paste) from Mail.app, then trimmed off the mail header in vi. (Actually vim). I don't use TextEdit for code. I've been a vi and unix user for 34 years. One of the reasons I use a Mac. This file is what I used for hg import: dan[Desktop]$ hexdump -C dsmith.patch.txt 00000000 23 20 48 47 20 63 68 61 6e 67 65 73 65 74 20 70 |# HG changeset p| 00000010 61 74 63 68 0a 23 20 55 73 65 72 20 44 61 6e 20 |atch.# User Dan | 00000020 53 6d 69 74 68 20 3c 64 73 6d 69 74 68 40 64 61 |Smith <dsmith@da| ... Note that the lines are terminated with 0a = \n. Just for grins I saved that in a file and searched for 0d = \r. No hits except embedded in the offset addresses.
For comparison, here's the first few lines of the last patch I generated with hg and sent to the alias: dan[dev_work1]$ hexdump -C 1767.patch 00000000 23 20 48 47 20 63 68 61 6e 67 65 73 65 74 20 70 |# HG changeset p| 00000010 61 74 63 68 0a 23 20 55 73 65 72 20 44 61 6e 20 |atch.# User Dan | 00000020 44 72 6f 67 69 63 68 65 6e 20 3c 63 68 69 72 70 |Drogichen <chirp|
Same \n termination, and you seem to have no issues (other than filename) with this. And if that's what hg generates on my Mac, you'd think it would want the same for reading.
So I think the line termination issue is a red herring, unless I'm missing something. Any other ideas?
Was this the correct command line, or do I need other flags/arguments?
dan[chirp.hg]$ hg import ~/Desktop/dsmith.patch.txt
-dan
Mac OS X is unix. Specifically, Darwin, which is derived from BSD unix and Next OS. https://en.wikipedia.org/wiki/Darwin_%28operating_system%29
See also https://en.wikipedia.org/wiki/Newline#Representations "LF: Multics, Unix and Unix-like systems (GNU/Linux, OS X, ...."
Gosh, thanks for the history lesson!
As Dave Nathanson, said, "Classic MacOS" used \r, but that hasn't been the Mac OS since about 2002. All the text files native to modern Macs use \n as the line terminator. Because unix.
Except that several of the applications still save files ending in \r. See: the current Microsoft product suite for OSX. Having no experience with Apple Mail, you can probably imagine why seeing your result might make me think it was keeping with some old behavior.
I just saved the raw email out of thunderbird on a mac and it had standard rfc822 CRLF endings:
theine:chirp.hg dan$ file test.patch test.patch: ASCII English text, with CRLF line terminators
Trying to hg import it failed exactly as it did for you:
theine:chirp.hg dan$ hg import test.patch applying test.patch patching file README.developers Hunk #1 FAILED at 18 Hunk #2 FAILED at 39 2 out of 2 hunks FAILED -- saving rejects to file README.developers.rej patching file chirp/util.py Hunk #1 FAILED at 14 1 out of 1 hunks FAILED -- saving rejects to file chirp/util.py.rej patching file chirpui/config.py Hunk #1 FAILED at 35 Hunk #2 FAILED at 64 2 out of 2 hunks FAILED -- saving rejects to file chirpui/config.py.rej patching file chirpui/mainapp.py Hunk #1 FAILED at 223 1 out of 1 hunks FAILED -- saving rejects to file chirpui/mainapp.py.rej abort: patch failed to apply
I converted it to LF-only and it applied just fine:
theine:chirp.hg dan$ file test.patch test.patch: ASCII English text theine:chirp.hg dan$ hg import test.patch applying test.patch
Good luck!
--Dan
participants (2)
-
chirp.cordless@xoxy.net
-
Dan Smith