Commits

Matt Mackall committed f76e219 Merge

merge with stable

  • Participants
  • Parent commits c621f84, 32b2e6d

Comments (0)

Files changed (2)

hgext/convert/filemap.py

         # original filename in the rev part of the return value.
         changes, copies = self.base.getchanges(rev)
         newnames = {}
-        files = []
+        files = {}
         for f, r in changes:
             newf = self.filemapper(f)
-            if newf:
-                files.append((newf, (f, r)))
+            if newf and (newf != f or newf not in files):
+                files[newf] = (f, r)
                 newnames[f] = newf
+        files = sorted(files.items())
 
         ncopies = {}
         for c in copies:

tests/test-convert-filemap.t

   o  0 "addb" files: b
   
 
+filemap rename undoing revision rename
+
+  $ hg init renameundo
+  $ cd renameundo
+  $ echo 1 > a
+  $ echo 1 > c
+  $ hg ci -qAm add
+  $ hg mv -q a b/a
+  $ hg mv -q c b/c
+  $ hg ci -qm rename
+  $ echo 2 > b/a
+  $ echo 2 > b/c
+  $ hg ci -qm modify
+  $ cd ..
+
+  $ echo "rename b ." > renameundo.fmap
+  $ hg convert --filemap renameundo.fmap renameundo renameundo2
+  initializing destination renameundo2 repository
+  scanning source...
+  sorting...
+  converting...
+  2 add
+  1 rename
+  filtering out empty revision
+  repository tip rolled back to revision 0 (undo commit)
+  0 modify
+  $ glog -R renameundo2
+  o  1 "modify" files: a c
+  |
+  o  0 "add" files: a c
+  
+
+
 test merge parents/empty merges pruning
 
   $ glog()