Make hg debugancestor accept -R by making it an optionalrepo command.
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 29 Feb 2008 01:25:31 +0100
changeset 6189 81cbb5dfdec0
parent 6188 3b0c2b71e0d7
child 6190 a79d9408806f
Make hg debugancestor accept -R by making it an optionalrepo command.
mercurial/commands.py
--- a/mercurial/commands.py	Fri Feb 29 01:14:37 2008 +0100
+++ b/mercurial/commands.py	Fri Feb 29 01:25:31 2008 +0100
@@ -568,14 +568,16 @@
     finally:
         del wlock
 
-def debugancestor(ui, *args):
+def debugancestor(ui, repo, *args):
     """find the ancestor revision of two revisions in a given index"""
     if len(args) == 3:
         index, rev1, rev2 = args
         r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
     elif len(args) == 2:
+        if not repo:
+            raise util.Abort(_("There is no Mercurial repository here "
+                               "(.hg not found)"))
         rev1, rev2 = args
-        repo = hg.repository(ui)
         r = repo.changelog
     else:
         raise util.Abort(_('either two or three arguments required'))
@@ -3162,6 +3164,6 @@
     "version": (version_, [], _('hg version')),
 }
 
-norepo = ("clone init version help debugancestor debugcomplete debugdata"
+norepo = ("clone init version help debugcomplete debugdata"
           " debugindex debugindexdot debugdate debuginstall debugfsinfo")
-optionalrepo = ("identify paths serve showconfig")
+optionalrepo = ("identify paths serve showconfig debugancestor")