mercurial/commands.py
changeset 6178 81afdd016867
parent 6171 73b1de288801
child 6180 d98ef03893e6
equal deleted inserted replaced
6177:673d8a6bc709 6178:81afdd016867
   566     try:
   566     try:
   567         return cmdutil.copy(ui, repo, pats, opts)
   567         return cmdutil.copy(ui, repo, pats, opts)
   568     finally:
   568     finally:
   569         del wlock
   569         del wlock
   570 
   570 
   571 def debugancestor(ui, index, rev1, rev2):
   571 def debugancestor(ui, *opts):
   572     """find the ancestor revision of two revisions in a given index"""
   572     """find the ancestor revision of two revisions in a given index"""
   573     r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
   573     if len(opts) == 3:
       
   574         index, rev1, rev2 = opts
       
   575         r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
       
   576     elif len(opts) == 2:
       
   577         rev1, rev2 = opts
       
   578         repo = hg.repository(ui)
       
   579         r = repo.changelog
       
   580     else:
       
   581         raise util.Abort(_('either two or three arguments required'))
   574     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
   582     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
   575     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
   583     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
   576 
   584 
   577 def debugcomplete(ui, cmd='', **opts):
   585 def debugcomplete(ui, cmd='', **opts):
   578     """returns the completion list associated with the given command"""
   586     """returns the completion list associated with the given command"""
  2848          [('A', 'after', None, _('record a copy that has already occurred')),
  2856          [('A', 'after', None, _('record a copy that has already occurred')),
  2849           ('f', 'force', None,
  2857           ('f', 'force', None,
  2850            _('forcibly copy over an existing managed file')),
  2858            _('forcibly copy over an existing managed file')),
  2851          ] + walkopts + dryrunopts,
  2859          ] + walkopts + dryrunopts,
  2852          _('hg copy [OPTION]... [SOURCE]... DEST')),
  2860          _('hg copy [OPTION]... [SOURCE]... DEST')),
  2853     "debugancestor": (debugancestor, [], _('hg debugancestor INDEX REV1 REV2')),
  2861     "debugancestor": (debugancestor, [],
       
  2862                       _('hg debugancestor [INDEX] REV1 REV2')),
  2854     "debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')),
  2863     "debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')),
  2855     "debugcomplete":
  2864     "debugcomplete":
  2856         (debugcomplete,
  2865         (debugcomplete,
  2857          [('o', 'options', None, _('show the command options'))],
  2866          [('o', 'options', None, _('show the command options'))],
  2858          _('hg debugcomplete [-o] CMD')),
  2867          _('hg debugcomplete [-o] CMD')),