localrepo: fix bad manifest delta generation (issue1433)
The issue came from the 720ae5085ee3 fix for issue586 working only for
manifest.add() fast path, where the incorrect removed file set was
ignored. This path was no longer taken after 716a1296e182 refactoring.
--- a/mercurial/localrepo.py Sat Jan 03 20:50:06 2009 +0100
+++ b/mercurial/localrepo.py Sat Jan 03 20:16:10 2009 +0100
@@ -882,16 +882,15 @@
# update manifest
m1.update(new)
- removed = []
+ removed = [f for f in util.sort(remove) if f in m1 or f in m2]
+ removed1 = []
- for f in util.sort(remove):
+ for f in removed:
if f in m1:
del m1[f]
- removed.append(f)
- elif f in m2:
- removed.append(f)
+ removed1.append(f)
mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0],
- (new, removed))
+ (new, removed1))
# add changeset
if (not empty_ok and not text) or force_editor:
--- a/tests/test-586 Sat Jan 03 20:50:06 2009 +0100
+++ b/tests/test-586 Sat Jan 03 20:16:10 2009 +0100
@@ -17,3 +17,33 @@
hg ci -Amc
hg st -A
+cd ..
+
+# a test for issue 1433, related to issue586
+echo % create test repos
+hg init repoa
+touch repoa/a
+hg -R repoa ci -Am adda
+
+hg init repob
+touch repob/b
+hg -R repob ci -Am addb
+
+hg init repoc
+cd repoc
+hg pull ../repoa
+hg update
+mkdir tst
+hg mv * tst
+hg ci -m "import a in tst"
+hg pull -f ../repob
+echo % merge both repos
+hg merge
+mkdir src
+echo % move b content
+hg mv b src
+hg ci -m "import b in src"
+hg manifest
+
+
+
--- a/tests/test-586.out Sat Jan 03 20:50:06 2009 +0100
+++ b/tests/test-586.out Sat Jan 03 20:16:10 2009 +0100
@@ -11,3 +11,28 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
C b
+% create test repos
+adding a
+adding b
+pulling from ../repoa
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+(run 'hg update' to get a working copy)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+pulling from ../repob
+searching for changes
+warning: repository is unrelated
+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)
+% merge both repos
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% move b content
+src/b
+tst/a