mercurial/debugcommands.py
changeset 35401 cd3392cb5818
parent 35400 8a0cac20a1ad
child 35417 2105bdd9462a
equal deleted inserted replaced
35400:8a0cac20a1ad 35401:cd3392cb5818
   366 @command('debugcapabilities',
   366 @command('debugcapabilities',
   367         [], _('PATH'),
   367         [], _('PATH'),
   368         norepo=True)
   368         norepo=True)
   369 def debugcapabilities(ui, path, **opts):
   369 def debugcapabilities(ui, path, **opts):
   370     """lists the capabilities of a remote peer"""
   370     """lists the capabilities of a remote peer"""
       
   371     opts = pycompat.byteskwargs(opts)
   371     peer = hg.peer(ui, opts, path)
   372     peer = hg.peer(ui, opts, path)
   372     caps = peer.capabilities()
   373     caps = peer.capabilities()
   373     ui.write(('Main capabilities:\n'))
   374     ui.write(('Main capabilities:\n'))
   374     for c in sorted(caps):
   375     for c in sorted(caps):
   375         ui.write(('  %s\n') % c)
   376         ui.write(('  %s\n') % c)
   868 def debugformat(ui, repo, **opts):
   869 def debugformat(ui, repo, **opts):
   869     """display format information about the current repository
   870     """display format information about the current repository
   870 
   871 
   871     Use --verbose to get extra information about current config value and
   872     Use --verbose to get extra information about current config value and
   872     Mercurial default."""
   873     Mercurial default."""
       
   874     opts = pycompat.byteskwargs(opts)
   873     maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
   875     maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
   874     maxvariantlength = max(len('format-variant'), maxvariantlength)
   876     maxvariantlength = max(len('format-variant'), maxvariantlength)
   875 
   877 
   876     def makeformatname(name):
   878     def makeformatname(name):
   877         return '%s:' + (' ' * (maxvariantlength - len(name)))
   879         return '%s:' + (' ' * (maxvariantlength - len(name)))
  2322         node2str = hex
  2324         node2str = hex
  2323     for rev in scmutil.revrange(repo, revs):
  2325     for rev in scmutil.revrange(repo, revs):
  2324         ctx = repo[rev]
  2326         ctx = repo[rev]
  2325         ui.write('%s\n'% ctx2str(ctx))
  2327         ui.write('%s\n'% ctx2str(ctx))
  2326         for succsset in obsutil.successorssets(repo, ctx.node(),
  2328         for succsset in obsutil.successorssets(repo, ctx.node(),
  2327                                                 closest=opts['closest'],
  2329                                                 closest=opts[r'closest'],
  2328                                                 cache=cache):
  2330                                                 cache=cache):
  2329             if succsset:
  2331             if succsset:
  2330                 ui.write('    ')
  2332                 ui.write('    ')
  2331                 ui.write(node2str(succsset[0]))
  2333                 ui.write(node2str(succsset[0]))
  2332                 for node in succsset[1:]:
  2334                 for node in succsset[1:]:
  2448         del opts[opt[1]]
  2450         del opts[opt[1]]
  2449     args = {}
  2451     args = {}
  2450     for k, v in opts.iteritems():
  2452     for k, v in opts.iteritems():
  2451         if v:
  2453         if v:
  2452             args[k] = v
  2454             args[k] = v
       
  2455     args = pycompat.strkwargs(args)
  2453     # run twice to check that we don't mess up the stream for the next command
  2456     # run twice to check that we don't mess up the stream for the next command
  2454     res1 = repo.debugwireargs(*vals, **args)
  2457     res1 = repo.debugwireargs(*vals, **args)
  2455     res2 = repo.debugwireargs(*vals, **args)
  2458     res2 = repo.debugwireargs(*vals, **args)
  2456     ui.write("%s\n" % res1)
  2459     ui.write("%s\n" % res1)
  2457     if res1 != res2:
  2460     if res1 != res2: