test-commit-amend: exhibit an --amend weirdness stable
authorPatrick Mezard <patrick@mezard.eu>
Mon, 30 Apr 2012 20:36:29 +0200
branchstable
changeset 16552 90ca344a7c55
parent 16551 ebf6d38c9063
child 16553 9224cc2e99cc
test-commit-amend: exhibit an --amend weirdness The weirdness is --amend let you replace one file with another with same data and flags if the new file copy record differ from the one in the parent revision. In theory, there is no problem with this kind of thing, subversion supports it, but here we see log and status disagree. The reason is log reads the copy record from the filelog, while status calls copies.pathcopies() which eventually invokes some expensiveness argument to discard this case (copies.py, _forwardcopies(), line 132). Since the next patch will side with pathcopies(), I prefer to call this behaviour a bug.
tests/test-commit-amend.t
--- a/tests/test-commit-amend.t	Sun Apr 29 22:25:55 2012 +0200
+++ b/tests/test-commit-amend.t	Mon Apr 30 20:36:29 2012 +0200
@@ -287,6 +287,18 @@
   A f
     d
 
+  $ mv f f.orig
+  $ hg rm -A f
+  $ hg ci -m removef
+  $ hg cp a f
+  $ mv f.orig f
+  $ hg ci --amend -m replacef
+  saved backup bundle to $TESTTMP/.hg/strip-backup/0ce2c92dc50d-amend-backup.hg
+  $ hg st --change . --copies
+  M f
+  $ hg log -r . --template "{file_copies}\n"
+  f (a)
+
 Can't rollback an amend:
 
   $ hg rollback