Possible problem with -f option to rename

Eric M. Hopper hopper at omnifarious.org
Fri Mar 30 22:54:52 CDT 2007


On Sat, 2007-03-31 at 10:52 +1000, Peter Williams wrote:
> That looks good to me.
> 
> What about the case where the move causes no change to the contents of 
> b?  It will not be marked as modified (which is correct) but will a be 
> shown as the original after b?  Is this asking too much of hg? 
> Especially, since b won't be listed unless the -c (or -A) option is 
> used.  I.e. is this special (and probably very rare) case worth worrying 
> about?

Oooh, that's a good one.  Hmmm....  And it still doesn't work the
'right' way in the most recent Mercurial.

It isn't asking too much I don't think.  Mercurial already has to be
going through it's own database of files to compare against the files on
the drive.  Somewhere in that database also lies the copy information.
It shouldn't be too hard to do the compare to realize that a file that's
identical is actually a copy of a different file.

Now, how it should show this is a different question.  In some sense,
this is still a modification of the file since the original has a
different parent revision than the copy will have, as well as the copy
having the super secret 'copy' tag at the front of the file.  So I think
making it show up as 'M' even though the file cnotents are technically
the same is the right thing to do.

You're right that it is a rare case.  But it should be handled properly
regardless.  You don't make good software by saying to yourself "Aww,
that'll never happen.".

I've been away from the Mercurial guts for awhile now, and I've never
really understood the tree walking code anyway.  But if someone who
knows it better than I would like to step up and say something more
definitive than I just did, that would be good.  :-)

Have fun (if at all possible),
-- 
The best we can hope for concerning the people at large is that they
be properly armed.  -- Alexander Hamilton
-- Eric Hopper (hopper at omnifarious.org  http://www.omnifarious.org/~hopper) --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: This is a digitally signed message part
Url : http://www.selenic.com/pipermail/mercurial-devel/attachments/20070330/e1ae1644/attachment.pgp


More information about the Mercurial-devel mailing list