mercurial/debugcommands.py
changeset 43106 d783f945a701
parent 43094 e8cf9ad52a78
child 43116 defabf63e969
equal deleted inserted replaced
43105:649d3ac37a12 43106:d783f945a701
   446     for c in sorted(caps):
   446     for c in sorted(caps):
   447         ui.write(b'  %s\n' % c)
   447         ui.write(b'  %s\n' % c)
   448     b2caps = bundle2.bundle2caps(peer)
   448     b2caps = bundle2.bundle2caps(peer)
   449     if b2caps:
   449     if b2caps:
   450         ui.writenoi18n(b'Bundle2 capabilities:\n')
   450         ui.writenoi18n(b'Bundle2 capabilities:\n')
   451         for key, values in sorted(b2caps.iteritems()):
   451         for key, values in sorted(pycompat.iteritems(b2caps)):
   452             ui.write(b'  %s\n' % key)
   452             ui.write(b'  %s\n' % key)
   453             for v in values:
   453             for v in values:
   454                 ui.write(b'    %s\n' % v)
   454                 ui.write(b'    %s\n' % v)
   455 
   455 
   456 
   456 
   868 
   868 
   869     if datesort:
   869     if datesort:
   870         keyfunc = lambda x: (x[1][3], x[0])  # sort by mtime, then by filename
   870         keyfunc = lambda x: (x[1][3], x[0])  # sort by mtime, then by filename
   871     else:
   871     else:
   872         keyfunc = None  # sort by filename
   872         keyfunc = None  # sort by filename
   873     for file_, ent in sorted(repo.dirstate.iteritems(), key=keyfunc):
   873     for file_, ent in sorted(pycompat.iteritems(repo.dirstate), key=keyfunc):
   874         if ent[3] == -1:
   874         if ent[3] == -1:
   875             timestr = b'unset               '
   875             timestr = b'unset               '
   876         elif nodates:
   876         elif nodates:
   877             timestr = b'set                 '
   877             timestr = b'set                 '
   878         else:
   878         else:
  2037     '''complete "names" - tags, open branch names, bookmark names'''
  2037     '''complete "names" - tags, open branch names, bookmark names'''
  2038 
  2038 
  2039     names = set()
  2039     names = set()
  2040     # since we previously only listed open branches, we will handle that
  2040     # since we previously only listed open branches, we will handle that
  2041     # specially (after this for loop)
  2041     # specially (after this for loop)
  2042     for name, ns in repo.names.iteritems():
  2042     for name, ns in pycompat.iteritems(repo.names):
  2043         if name != b'branches':
  2043         if name != b'branches':
  2044             names.update(ns.listnames(repo))
  2044             names.update(ns.listnames(repo))
  2045     names.update(
  2045     names.update(
  2046         tag
  2046         tag
  2047         for (tag, heads, tip, closed) in repo.branchmap().iterbranches()
  2047         for (tag, heads, tip, closed) in repo.branchmap().iterbranches()
  2266             spec = spec.replace(pycompat.ossep, b'/')
  2266             spec = spec.replace(pycompat.ossep, b'/')
  2267         speclen = len(spec)
  2267         speclen = len(spec)
  2268         fullpaths = opts[r'full']
  2268         fullpaths = opts[r'full']
  2269         files, dirs = set(), set()
  2269         files, dirs = set(), set()
  2270         adddir, addfile = dirs.add, files.add
  2270         adddir, addfile = dirs.add, files.add
  2271         for f, st in dirstate.iteritems():
  2271         for f, st in pycompat.iteritems(dirstate):
  2272             if f.startswith(spec) and st[0] in acceptable:
  2272             if f.startswith(spec) and st[0] in acceptable:
  2273                 if fixpaths:
  2273                 if fixpaths:
  2274                     f = f.replace(b'/', pycompat.ossep)
  2274                     f = f.replace(b'/', pycompat.ossep)
  2275                 if fullpaths:
  2275                 if fullpaths:
  2276                     addfile(f)
  2276                     addfile(f)
  2452             ).result()
  2452             ).result()
  2453 
  2453 
  2454         ui.status(pycompat.bytestr(r) + b'\n')
  2454         ui.status(pycompat.bytestr(r) + b'\n')
  2455         return not r
  2455         return not r
  2456     else:
  2456     else:
  2457         for k, v in sorted(target.listkeys(namespace).iteritems()):
  2457         for k, v in sorted(pycompat.iteritems(target.listkeys(namespace))):
  2458             ui.write(
  2458             ui.write(
  2459                 b"%s\t%s\n" % (stringutil.escapestr(k), stringutil.escapestr(v))
  2459                 b"%s\t%s\n" % (stringutil.escapestr(k), stringutil.escapestr(v))
  2460             )
  2460             )
  2461 
  2461 
  2462 
  2462 
  3606     opts = pycompat.byteskwargs(opts)
  3606     opts = pycompat.byteskwargs(opts)
  3607     repo = hg.peer(ui, opts, repopath)
  3607     repo = hg.peer(ui, opts, repopath)
  3608     for opt in cmdutil.remoteopts:
  3608     for opt in cmdutil.remoteopts:
  3609         del opts[opt[1]]
  3609         del opts[opt[1]]
  3610     args = {}
  3610     args = {}
  3611     for k, v in opts.iteritems():
  3611     for k, v in pycompat.iteritems(opts):
  3612         if v:
  3612         if v:
  3613             args[k] = v
  3613             args[k] = v
  3614     args = pycompat.strkwargs(args)
  3614     args = pycompat.strkwargs(args)
  3615     # run twice to check that we don't mess up the stream for the next command
  3615     # run twice to check that we don't mess up the stream for the next command
  3616     res1 = repo.debugwireargs(*vals, **args)
  3616     res1 = repo.debugwireargs(*vals, **args)