changeset 5323:46455285c6b5

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Sun, 23 Sep 2007 15:29:58 +0200
parents 121816063b9a (current diff) c6682cdada2f (diff)
children 8409a2e3a78d
files mercurial/localrepo.py
diffstat 3 files changed, 56 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Sep 22 19:05:36 2007 +0200
+++ b/mercurial/localrepo.py	Sun Sep 23 15:29:58 2007 +0200
@@ -1045,14 +1045,14 @@
     def undelete(self, list):
         wlock = None
         try:
-            p = self.dirstate.parents()[0]
-            mn = self.changelog.read(p)[0]
-            m = self.manifest.read(mn)
+            manifests = [self.manifest.read(self.changelog.read(p)[0])
+                         for p in self.dirstate.parents() if p != nullid]
             wlock = self.wlock()
             for f in list:
                 if self.dirstate[f] != 'r':
                     self.ui.warn("%s not removed!\n" % f)
                 else:
+                    m = f in manifests[0] and manifests[0] or manifests[1]
                     t = self.file(f).read(m[f])
                     self.wwrite(f, t, m.flags(f))
                     self.dirstate.normal(f)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-rename-after-merge	Sun Sep 23 15:29:58 2007 +0200
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Test issue 746: renaming files brought by the
+# second parent of a merge was broken.
+
+echo % create source repository
+hg init t
+cd t
+echo a > a
+hg ci -Am a
+cd ..
+
+echo % fork source repository
+hg clone t t2
+cd t2
+echo b > b
+hg ci -Am b
+
+echo % update source repository
+cd ../t
+echo a >> a
+hg ci -m a2
+
+echo % merge repositories
+hg pull ../t2
+hg merge
+
+echo % rename b as c
+hg mv b c
+hg st
+echo % rename back c as b
+hg mv c b
+hg st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-rename-after-merge.out	Sun Sep 23 15:29:58 2007 +0200
@@ -0,0 +1,20 @@
+% create source repository
+adding a
+% fork source repository
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding b
+% update source repository
+% merge repositories
+pulling from ../t2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% rename b as c
+A c
+R b
+% rename back c as b