Possible problem with -f option to rename

Eric M. Hopper hopper at omnifarious.org
Fri Mar 30 09:41:42 CDT 2007


On Thu, 2007-03-29 at 11:05 +1000, Peter Williams wrote:
> During testing of my revision control GUI wrapper using hg as a back end 
> I've noticed an anomaly when the -f option is used with rename to force 
> the overwriting of an existing file.
> 
> For a normal invocation of rename, the moved file (in its new location) 
> is marked as added ("A") by the status command and the -C option to the 
> status command indicates the identity of the moved file but neither of 
> these happen for a file that was overwritten with -f.  This anomaly 
> occurs both when the actual contents of the overwritten file is the same 
> after the overwrite and when it has changed after overwrite although in 
> this latter case it is marked as modified ("M").
> 
> In all cases, the original file is marked as removed ("R").
> 
> I can see a case for the added ("A") mark not being used (i.e. the file 
> already existed) but think some information is lost (from the user's 
> point of view) by the failure of the -C option to indicate the origin 
> (especially in the case where the contents of the target have changed as 
> a result of the overwrite).
> 
> Is this the intended behaviour?

On a fairly recent build of Mercurial based on
http://www.selenic.com/hg/rev/0ce23256e454 this doesn't happen this way.
For a file that was moved over the top of another using mv -f the
original shows as R, the file being stomped on shows as M, and the -C
option properly shows the original after the file that shows as M.

Example:

$ hg mv -f a b
$ hg status -C
M b
  a
R a

I think this is correct behavior.

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/04ca5511/attachment.pgp


More information about the Mercurial-devel mailing list