mercurial/debugcommands.py
changeset 31239 9cdba6072b97
parent 31216 21fa3d3688f3
child 31402 ea0395eec67b
equal deleted inserted replaced
31238:35284f933518 31239:9cdba6072b97
    61     sslutil,
    61     sslutil,
    62     streamclone,
    62     streamclone,
    63     templater,
    63     templater,
    64     treediscovery,
    64     treediscovery,
    65     util,
    65     util,
       
    66     vfs as vfsmod,
    66 )
    67 )
    67 
    68 
    68 release = lockmod.release
    69 release = lockmod.release
    69 
    70 
    70 # We reuse the command table from commands because it is easier than
    71 # We reuse the command table from commands because it is easier than
    74 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
    75 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
    75 def debugancestor(ui, repo, *args):
    76 def debugancestor(ui, repo, *args):
    76     """find the ancestor revision of two revisions in a given index"""
    77     """find the ancestor revision of two revisions in a given index"""
    77     if len(args) == 3:
    78     if len(args) == 3:
    78         index, rev1, rev2 = args
    79         index, rev1, rev2 = args
    79         r = revlog.revlog(scmutil.vfs(pycompat.getcwd(), audit=False), index)
    80         r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), index)
    80         lookup = r.lookup
    81         lookup = r.lookup
    81     elif len(args) == 2:
    82     elif len(args) == 2:
    82         if not repo:
    83         if not repo:
    83             raise error.Abort(_('there is no Mercurial repository here '
    84             raise error.Abort(_('there is no Mercurial repository here '
    84                                 '(.hg not found)'))
    85                                 '(.hg not found)'))
   450     Otherwise, the changelog DAG of the current repo is emitted.
   451     Otherwise, the changelog DAG of the current repo is emitted.
   451     """
   452     """
   452     spaces = opts.get('spaces')
   453     spaces = opts.get('spaces')
   453     dots = opts.get('dots')
   454     dots = opts.get('dots')
   454     if file_:
   455     if file_:
   455         rlog = revlog.revlog(scmutil.vfs(pycompat.getcwd(), audit=False),
   456         rlog = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False),
   456                              file_)
   457                              file_)
   457         revs = set((int(r) for r in revs))
   458         revs = set((int(r) for r in revs))
   458         def events():
   459         def events():
   459             for r in rlog:
   460             for r in rlog:
   460                 yield 'n', (r, list(p for p in rlog.parentrevs(r)
   461                 yield 'n', (r, list(p for p in rlog.parentrevs(r)