--- a/mercurial/merge.py Tue Sep 26 14:40:21 2006 -0500
+++ b/mercurial/merge.py Wed Sep 27 09:35:53 2006 +0200
@@ -133,6 +133,10 @@
Find moves and copies between m1 and m2 back to limit linkrev
"""
+ # avoid silly behavior for update from empty dir
+ if not m1:
+ return {}
+
dcopies = repo.dirstate.copies()
copy = {}
match = {}
@@ -167,7 +171,12 @@
return copy
-def manifestmerge(ui, m1, m2, ma, overwrite, backwards, partial):
+def filtermanifest(man, partial):
+ if partial:
+ for k in man.keys():
+ if not partial(k): del man[k]
+
+def manifestmerge(ui, m1, m2, ma, overwrite, backwards):
"""
Merge manifest m1 with m2 using ancestor ma and generate merge action list
"""
@@ -183,13 +192,6 @@
ui.debug(" %s: %s -> %s\n" % (f, msg, m))
action.append((f, m) + args)
- # Filter manifests
- if partial:
- for f in m1.keys():
- if not partial(f): del m1[f]
- for f in m2.keys():
- if not partial(f): del m2[f]
-
# Compare manifests
for f, n in m1.iteritems():
if f in m2:
@@ -356,19 +358,20 @@
(short(p1), short(p2), short(pa)))
action = []
-
copy = {}
- if not (backwards or overwrite):
- copy = findcopies(repo, m1, m2, repo.changelog.rev(pa))
m1 = workingmanifest(repo, m1, status)
+ filtermanifest(m1, partial)
+ filtermanifest(m2, partial)
if not force:
checkunknown(repo, m2, status)
if not branchmerge:
action += forgetremoved(m2, status)
+ if not (backwards or overwrite):
+ copy = findcopies(repo, m1, m2, repo.changelog.rev(pa))
- action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards, partial)
+ action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards)
del m1, m2, ma
### apply phase