Bug in "hg import" (Re: "hg qpush" fails when REMOVED symlink in patch)

Ted Pavlic ted at tedpavlic.com
Sun Dec 14 20:48:16 CST 2008


As described in the updates to the bug report:

http://www.selenic.com/mercurial/bts/issue1438

the problem is in "hg import". That is, "hg diff --git" creates a 
strange chunk when symlinks are deleted; however, git's diff also 
produces that chunk. HOWEVER, "git apply" skips over it entirely whereas 
"hg import" bombs with a .rej file.

--Ted


On 12/14/08 12:48 PM, Ted Pavlic wrote:
> By the way, I didn't mention it (but it's implied by the rej file
> included), but I'm using git diff.
>
> I've created a formal bug report at:
>
> http://www.selenic.com/mercurial/bts/issue1438
>
> --Ted
>
> On 12/13/08 4:42 PM, Ted Pavlic wrote:
>> I think I found a bug in qpush, and I am almost positive that this bug
>> did not exist before Mercurial 1.1.
>>
>> If I have an MQ patch that *removes* a symlink, when I push the patch
>> with "mq push", "mq push" fails and produces the reject file:
>>
>> --- sym_link
>> +++ sym_link
>> @@ -1,1 +0,0 @@
>> -a_file
>> \ No newline at end of file
>>
>> Consider the following script:
>>
>> =====
>> #!/bin/sh -x
>>
>> hg version
>> mkdir mq_test_one
>> cd mq_test_one
>> hg init
>> touch a_file
>> ln -s a_file sym_link
>> hg add a_file sym_link
>> hg commit -m "Added file and link"
>> hg remove sym_link
>> hg commit -m "Removed link"
>> hg qinit
>> hg qimport -r tip
>> hg qpop
>> hg qpush -v
>> cat *.rej
>> =====
>>
>> I get the output from it:
>>
>> =====
>> + hg version
>> Mercurial Distributed SCM (version 1.1)
>>
>> Copyright (C) 2005-2008 Matt Mackall<mpm at selenic.com>   and others
>> This is free software; see the source for copying conditions. There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>> + mkdir mq_test_one
>> + cd mq_test_one
>> + hg init
>> + touch a_file
>> + ln -s a_file sym_link
>> + hg add a_file sym_link
>> + hg commit -m 'Added file and link'
>> + hg remove sym_link
>> + hg commit -m 'Removed link'
>> + hg qinit
>> + hg qimport -r tip
>> + hg qpop
>> Patch queue now empty
>> + hg qpush -v
>> applying 1.diff
>> patching file sym_link
>> Hunk #1 FAILED at 0
>> 1 out of 1 hunks FAILED -- saving rejects to file sym_link.rej
>> patch failed to apply
>> patch failed, rejects left in working dir
>> Errors during apply, please fix and refresh 1.diff
>> + cat sym_link.rej
>> --- sym_link
>> +++ sym_link
>> @@ -1,1 +0,0 @@
>> -a_file
>> \ No newline at end of file
>> =====
>>
>> 	For now, it appears like if I ever want to remove a symlink, I cannot
>> use MQ.
>>
>> 	Thanks --
>> 	Ted
>>
>>
>

-- 
Ted Pavlic <ted at tedpavlic.com>


More information about the Mercurial mailing list