diff mercurial/commands.py @ 10505:b3311e26f94f stable

merge: fix --preview to show all nodes that will be merged (issue2043). Formerly, it omitted nodes that were not descendants of the least common ancestor of the two merge parents, even though those nodes contribute to the merge. The new algorithm uses revlog.findmissing() instead of ancestor() + nodesbetween().
author Greg Ward <greg-hg@gerg.ca>
date Mon, 15 Feb 2010 15:25:29 -0500
parents bb508b312359
children 98bc3e195720
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Feb 15 15:07:21 2010 -0500
+++ b/mercurial/commands.py	Mon Feb 15 15:25:29 2010 -0500
@@ -2233,14 +2233,14 @@
         node = parent == bheads[0] and bheads[-1] or bheads[0]
 
     if opts.get('preview'):
-        p1 = repo['.']
-        p2 = repo[node]
-        common = p1.ancestor(p2)
-        roots, heads = [common.node()], [p2.node()]
+        # find nodes that are ancestors of p2 but not of p1
+        p1 = repo.lookup('.')
+        p2 = repo.lookup(node)
+        nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
+
         displayer = cmdutil.show_changeset(ui, repo, opts)
-        for node in repo.changelog.nodesbetween(roots=roots, heads=heads)[0]:
-            if node not in roots:
-                displayer.show(repo[node])
+        for node in nodes:
+            displayer.show(repo[node])
         displayer.close()
         return 0