# HG changeset patch # User Thomas Arendsen Hein # Date 1204244731 -3600 # Node ID 81cbb5dfdec0b455ef82c6e3b18df5094f795809 # Parent 3b0c2b71e0d77dda6bc666333abd17d6ccc37786 Make hg debugancestor accept -R by making it an optionalrepo command. diff -r 3b0c2b71e0d7 -r 81cbb5dfdec0 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")