[PATCH evolve-ext] uncommit: don't lose copy information of remaining files (issue5403)

Martin von Zweigbergk martinvonz at google.com
Tue Jan 31 20:33:05 UTC 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1485894765 28800
#      Tue Jan 31 12:32:45 2017 -0800
# Node ID bec8f8f2c0792eacb997652eb6f74b47ad8baf66
# Parent  f22120b12715d7398b14c491ef89a0fa26e51533
uncommit: don't lose copy information of remaining files (issue5403)

As reported in the issue, "hg uncommit" would lose copy information of
the files that remained in the commit. The problem was simply that the
a dict of copies was iterated as "src, dst in copies.items()" where it
should have been "dst, src ...".

diff -r f22120b12715 -r bec8f8f2c079 hgext/evolve.py
--- a/hgext/evolve.py	Wed Jan 25 16:50:19 2017 +0100
+++ b/hgext/evolve.py	Tue Jan 31 12:32:45 2017 -0800
@@ -2688,7 +2688,7 @@
 
     # Filter copies
     copied = copies.pathcopies(target, ctx)
-    copied = dict((src, dst) for src, dst in copied.iteritems()
+    copied = dict((dst, src) for dst, src in copied.iteritems()
                   if dst in files)
     def filectxfn(repo, memctx, path, contentctx=ctx, redirect=newcontent):
         if path in redirect:
diff -r f22120b12715 -r bec8f8f2c079 tests/test-uncommit.t
--- a/tests/test-uncommit.t	Wed Jan 25 16:50:19 2017 +0100
+++ b/tests/test-uncommit.t	Tue Jan 31 12:32:45 2017 -0800
@@ -252,6 +252,7 @@
   M j
   M o
   A aa
+    a
   A ff
     f
   A h
@@ -264,7 +265,7 @@
   R m
   R n
   $ glog --hidden
-  @  5:c706fe2c12f8 at bar(draft) touncommit
+  @  5:a1d4c1ad76cc at bar(draft) touncommit
   |
   | o  4:e8db4aa611f6 at bar(draft) touncommit
   |/
@@ -278,12 +279,12 @@
   
   $ hg debugobsolete
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 e8db4aa611f6d5706374288e6898e498f5c44098 0 (*) {'user': 'test'} (glob)
-  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c706fe2c12f83ba5010cb60ea6af3bd1f0c2d6d3 0 (*) {'user': 'test'} (glob)
+  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 a1d4c1ad76cc7eb5e8a36ef52396da334b6d59c5 0 (*) {'user': 'test'} (glob)
 
 Test --all
 
   $ hg up -C 3 --hidden
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete!
   (use 'hg evolve' to update to its successor)
   $ hg --config extensions.purge= purge
@@ -312,7 +313,7 @@
 
   $ hg debugobsolete
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 e8db4aa611f6d5706374288e6898e498f5c44098 0 (*) {'user': 'test'} (glob)
-  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c706fe2c12f83ba5010cb60ea6af3bd1f0c2d6d3 0 (*) {'user': 'test'} (glob)
+  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 a1d4c1ad76cc7eb5e8a36ef52396da334b6d59c5 0 (*) {'user': 'test'} (glob)
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c4cbebac3751269bdf12d1466deabcc78521d272 0 (*) {'user': 'test'} (glob)
 
 Display a warning if nothing left
@@ -322,7 +323,7 @@
   (use 'hg prune .' to remove it)
   $ hg debugobsolete
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 e8db4aa611f6d5706374288e6898e498f5c44098 0 (*) {'user': 'test'} (glob)
-  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c706fe2c12f83ba5010cb60ea6af3bd1f0c2d6d3 0 (*) {'user': 'test'} (glob)
+  5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 a1d4c1ad76cc7eb5e8a36ef52396da334b6d59c5 0 (*) {'user': 'test'} (glob)
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 c4cbebac3751269bdf12d1466deabcc78521d272 0 (*) {'user': 'test'} (glob)
   c4cbebac3751269bdf12d1466deabcc78521d272 4f1c269eab68720f54e88ce3c1dc02b2858b6b89 0 (*) {'user': 'test'} (glob)
 


More information about the Mercurial-devel mailing list