mercurial/commands.py
changeset 30401 869d660b8669
parent 30332 318a24b52eeb
child 30402 945f8229b30d
equal deleted inserted replaced
30400:d1a0a64f6e16 30401:869d660b8669
  1865     Returns 0 on success, 1 if errors are encountered.
  1865     Returns 0 on success, 1 if errors are encountered.
  1866     """
  1866     """
  1867     with repo.wlock(False):
  1867     with repo.wlock(False):
  1868         return cmdutil.copy(ui, repo, pats, opts)
  1868         return cmdutil.copy(ui, repo, pats, opts)
  1869 
  1869 
  1870 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
       
  1871 def debugancestor(ui, repo, *args):
       
  1872     """find the ancestor revision of two revisions in a given index"""
       
  1873     if len(args) == 3:
       
  1874         index, rev1, rev2 = args
       
  1875         r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index)
       
  1876         lookup = r.lookup
       
  1877     elif len(args) == 2:
       
  1878         if not repo:
       
  1879             raise error.Abort(_("there is no Mercurial repository here "
       
  1880                                "(.hg not found)"))
       
  1881         rev1, rev2 = args
       
  1882         r = repo.changelog
       
  1883         lookup = repo.lookup
       
  1884     else:
       
  1885         raise error.Abort(_('either two or three arguments required'))
       
  1886     a = r.ancestor(lookup(rev1), lookup(rev2))
       
  1887     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
       
  1888 
       
  1889 @command('debugbuilddag',
  1870 @command('debugbuilddag',
  1890     [('m', 'mergeable-file', None, _('add single file mergeable changes')),
  1871     [('m', 'mergeable-file', None, _('add single file mergeable changes')),
  1891     ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
  1872     ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
  1892     ('n', 'new-file', None, _('add new file at each rev'))],
  1873     ('n', 'new-file', None, _('add new file at each rev'))],
  1893     _('[OPTION]... [TEXT]'))
  1874     _('[OPTION]... [TEXT]'))