correctly record file-level history when the local side renames a directory
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Mon, 27 Aug 2007 14:21:04 -0300
changeset 5229 dee573ba79f1
parent 5228 8050f13772f6
child 5230 bfd73b567b3d
child 5249 0d28d4e5fe1f
correctly record file-level history when the local side renames a directory
mercurial/localrepo.py
tests/test-rename-dir-merge
tests/test-rename-dir-merge.out
--- a/mercurial/localrepo.py	Mon Aug 27 14:21:04 2007 -0300
+++ b/mercurial/localrepo.py	Mon Aug 27 14:21:04 2007 -0300
@@ -612,7 +612,9 @@
             elif fp1 != nullid: # copied on local side, reversed
                 meta["copyrev"] = hex(manifest2.get(cp))
                 fp2 = fp1
-            else: # directory rename
+            elif cp in manifest2: # directory rename on local side
+                meta["copyrev"] = hex(manifest2[cp])
+            else: # directory rename on remote side
                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
             self.ui.debug(_(" %s: copy %s:%s\n") %
                           (fn, cp, meta["copyrev"]))
--- a/tests/test-rename-dir-merge	Mon Aug 27 14:21:04 2007 -0300
+++ b/tests/test-rename-dir-merge	Mon Aug 27 14:21:04 2007 -0300
@@ -24,9 +24,11 @@
 echo a/* b/*
 hg st -C
 hg ci -m "3 merge 2+1" -d "0 0"
+hg debugrename b/c
 
 hg co -C 1
 hg merge --debug 2
 echo a/* b/*
 hg st -C
 hg ci -m "4 merge 1+2" -d "0 0"
+hg debugrename b/c
--- a/tests/test-rename-dir-merge.out	Mon Aug 27 14:21:04 2007 -0300
+++ b/tests/test-rename-dir-merge.out	Mon Aug 27 14:21:04 2007 -0300
@@ -29,6 +29,7 @@
 R a/a
 R a/b
 R a/c
+b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 resolving manifests
  overwrite None partial False
@@ -40,3 +41,4 @@
 a/* b/a b/b b/c
 A b/c
   a/c
+b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88