--- a/mercurial/commands.py Wed Feb 01 17:46:21 2017 +0100
+++ b/mercurial/commands.py Wed Feb 01 17:47:35 2017 +0100
@@ -1860,71 +1860,6 @@
with repo.wlock(False):
return cmdutil.copy(ui, repo, pats, opts)
-@command('debugpathcomplete',
- [('f', 'full', None, _('complete an entire path')),
- ('n', 'normal', None, _('show only normal files')),
- ('a', 'added', None, _('show only added files')),
- ('r', 'removed', None, _('show only removed files'))],
- _('FILESPEC...'))
-def debugpathcomplete(ui, repo, *specs, **opts):
- '''complete part or all of a tracked path
-
- This command supports shells that offer path name completion. It
- currently completes only files already known to the dirstate.
-
- Completion extends only to the next path segment unless
- --full is specified, in which case entire paths are used.'''
-
- def complete(path, acceptable):
- dirstate = repo.dirstate
- spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
- rootdir = repo.root + pycompat.ossep
- if spec != repo.root and not spec.startswith(rootdir):
- return [], []
- if os.path.isdir(spec):
- spec += '/'
- spec = spec[len(rootdir):]
- fixpaths = pycompat.ossep != '/'
- if fixpaths:
- spec = spec.replace(pycompat.ossep, '/')
- speclen = len(spec)
- fullpaths = opts['full']
- files, dirs = set(), set()
- adddir, addfile = dirs.add, files.add
- for f, st in dirstate.iteritems():
- if f.startswith(spec) and st[0] in acceptable:
- if fixpaths:
- f = f.replace('/', pycompat.ossep)
- if fullpaths:
- addfile(f)
- continue
- s = f.find(pycompat.ossep, speclen)
- if s >= 0:
- adddir(f[:s])
- else:
- addfile(f)
- return files, dirs
-
- acceptable = ''
- if opts['normal']:
- acceptable += 'nm'
- if opts['added']:
- acceptable += 'a'
- if opts['removed']:
- acceptable += 'r'
- cwd = repo.getcwd()
- if not specs:
- specs = ['.']
-
- files, dirs = set(), set()
- for spec in specs:
- f, d = complete(spec, acceptable or 'nmar')
- files.update(f)
- dirs.update(d)
- files.update(dirs)
- ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
- ui.write('\n')
-
@command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
'''access the pushkey key/value protocol