Add debugancestor command
authormpm@selenic.com
Fri, 16 Sep 2005 10:42:20 -0700
changeset 1262 325c07fd2ebd
parent 1261 fccc90f1994e
child 1263 bc1815cf89a7
Add debugancestor command
mercurial/commands.py
--- a/mercurial/commands.py	Thu Sep 15 14:06:58 2005 -0500
+++ b/mercurial/commands.py	Fri Sep 16 10:42:20 2005 -0700
@@ -789,6 +789,12 @@
     errs, copied = docopy(ui, repo, pats, opts)
     return errs
 
+def debugancestor(ui, index, rev1, rev2):
+    """find the ancestor revision of two revisions in a given index"""
+    r = revlog.revlog(file, index, "")
+    a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
+    ui.write("%d:%s\n" % (r.rev(a), hex(a)))
+
 def debugcheckstate(ui, repo):
     """validate the correctness of the current dirstate"""
     parent1, parent2 = repo.dirstate.parents()
@@ -1801,6 +1807,7 @@
               ('f', 'force', None, 'replace destination if it exists'),
               ('p', 'parents', None, 'append source path to dest')],
              'hg copy [OPTION]... [SOURCE]... DEST'),
+    "debugancestor": (debugancestor, [], 'debugancestor INDEX REV1 REV2'),
     "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'),
     "debugconfig": (debugconfig, [], 'debugconfig'),
     "debugstate": (debugstate, [], 'debugstate'),
@@ -1983,7 +1990,7 @@
     ('h', 'help', None, 'display help and exit'),
 ]
 
-norepo = ("clone init version help debugconfig debugdata"
+norepo = ("clone init version help debugancestor debugconfig debugdata"
           " debugindex debugindexdot paths")
 
 def find(cmd):