sapling/edenscm/hgext
Jun Wu ac7e07dbdf commands: define prefixes as aliases
Summary:
At a recent team meeting we've decided to remove the command prefix matching
behavior, as it can be really annoying for the Rust parser (since it needs to
know all the names, but it wants to avoid spinning up Python). It's even more
annoying for subcommand support. FWIW git does not have prefix matching.

This diff adds various aliases to "roughly" keep the command prefix matching
behavior.

The list of aliases are obtained by this script in `hg dbsh`:

  def unique(prefix, names):
    m = __import__('edenscm.mercurial').mercurial
    try:
      return m.cmdutil.findcmd(prefix, m.commands.table, False)[0][0] in names
    except:
      return False

  nameslist=sorted([i.replace('^','') for i in m.commands.table])
  aliases = {}

  for names in nameslist:
    names = names.split('|')
    for name in names:
      if name.startswith('debug'):
        continue
      for prefix in [name[:i] for i in xrange(1, len(name))]:
        if unique(prefix, names):
          aliases.setdefault(name, []).append(prefix)

Debug commands, and commands that are rarely used are not changed, including:

  'backfillmanifestrevlog': ['backfillm', 'backfillma', 'backfillman', 'backfillmani', 'backfillmanif', 'backfillmanife', 'backfillmanifes', 'backfillmanifest', 'backfillmanifestr', 'backfillmanifestre', 'backfillmanifestrev', 'backfillmanifestrevl', 'backfillmanifestrevlo'],
  'backfilltree': ['backfillt', 'backfilltr', 'backfilltre']}
  'blackbox': ['blac', 'black', 'blackb', 'blackbo'],
  'cachemanifest': ['cac', 'cach', 'cache', 'cachem', 'cachema', 'cacheman', 'cachemani', 'cachemanif', 'cachemanife', 'cachemanifes'],
  'chistedit': ['chi', 'chis', 'chist', 'chiste', 'chisted', 'chistedi'],
  'clone': ['clon'],
  'cloud': ['clou'],
  'convert': ['conv', 'conve', 'conver'],
  'copy': ['cop'],
  'fastannotate': ['fa', 'fas', 'fast', 'fasta', 'fastan', 'fastann', 'fastanno', 'fastannot', 'fastannota', 'fastannotat'],
  'fold': ['fol'],
  'githelp': ['gi', 'git', 'gith', 'githe', 'githel'],
  'histgrep': ['histg', 'histgr', 'histgre'],
  'incoming': ['in', 'inc', 'inco', 'incom', 'incomi', 'incomin'],
  'isbackedup': ['is', 'isb', 'isba', 'isbac', 'isback', 'isbacke', 'isbacked', 'isbackedu'],
  'manifest': ['ma', 'man', 'mani', 'manif', 'manife', 'manifes'],
  'outgoing': ['o', 'ou', 'out', 'outg', 'outgo', 'outgoi', 'outgoin'],
  'prefetch': ['pref', 'prefe', 'prefet', 'prefetc'],
  'prune': ['pru', 'prun'],
  'pushbackup': ['pushb', 'pushba', 'pushbac', 'pushback', 'pushbacku'],
  'rage': ['ra', 'rag'],
  'record': ['recor'],
  'recover': ['recov', 'recove'],
  'redo': ['red'],
  'repack': ['rep', 'repa', 'repac'],
  'reset': ['rese'],
  'rollback': ['rol', 'roll', 'rollb', 'rollba', 'rollbac'],
  'root': ['roo'],
  'serve': ['se', 'ser', 'serv'],
  'share': ['sha', 'shar'],
  'sparse': ['spa', 'spar', 'spars'],
  'svn': ['sv'],
  'undo': ['und'],
  'unshare': ['unsha', 'unshar'],
  'verifyremotefilelog': ['verifyr', 'verifyre', 'verifyrem', 'verifyremo', 'verifyremot', 'verifyremote', 'verifyremotef', 'verifyremotefi', 'verifyremotefil', 'verifyremotefile', 'verifyremotefilel', 'verifyremotefilelo'],

Reviewed By: sfilipco

Differential Revision: D17644676

fbshipit-source-id: f60f5e6810279b52f9a4a1e048eeb529a96bd735
2019-10-08 09:45:59 -07:00
..
absorb commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
amend commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
commitcloud commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
convert Fall back to project name if path not present 2019-09-26 19:35:19 -07:00
extlib watchman: pywatchman: remove close_fds when resolving sockname 2019-10-03 09:26:40 -07:00
fastannotate commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
fastmanifest manifest: add subdir_diff compatibility function for gettreepacks 2019-08-30 10:50:05 -07:00
fsmonitor hgmain: make bindings a builtin module 2019-09-20 18:32:36 -07:00
hgevents logging: migrate watchman command logs to new blackbox event 2019-07-06 02:46:16 -07:00
hggit hggit: git_handler: use StringIO.tell(), not pos 2019-10-07 13:09:36 -07:00
hgsubversion replace StringIO with pycompat.StringIO 2019-09-26 15:29:49 -07:00
highlight codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
infinitepush snapshot: add the unionstore to handle the rebundling of snapshot bundles 2019-10-01 06:46:43 -07:00
lfs snapshot: add the unionstore to handle the rebundling of snapshot bundles 2019-10-01 06:46:43 -07:00
memcommit commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
perfsuite hgext: use commit hashes to call other commands 2019-08-22 13:00:14 -07:00
pushrebase remotefilelog: add make{datapackstore, historypackstore} 2019-09-05 10:21:27 -07:00
remotefilelog gc: do not break indexedlog data 2019-10-07 08:36:47 -07:00
repogenerator codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
snapshot pep-479 codemod 2019-10-04 15:24:23 -07:00
treemanifest treemanifest: allow configurable HTTP prefetching strategy 2019-09-30 20:26:37 -07:00
__init__.py codemod: move Python packages to edenscm 2019-01-28 18:35:41 -08:00
arcdiff.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
automv.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
blackbox.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
catnotate.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
checkmessagehook.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
checkserverbookmark.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
chistedit.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
churn.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
cleanobsstore.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
clienttelemetry.py blackbox: clean up blackbox logging and log more during rage 2019-04-23 02:48:50 -07:00
clindex.py setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
clindex.pyx setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
clonebundles.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
commitextras.py test-revset: do not use "hg branch" directly 2019-02-14 17:44:39 -08:00
conflictinfo.py hgext: reformat using black 2019-03-13 18:35:09 -07:00
copytrace.py copytrace: properly detect when gdbm is absent 2019-09-23 17:37:46 -07:00
crdump.py crdump: remove the dependency on 'hgsubversion' 2019-09-26 16:01:57 -07:00
debugcommitmessage.py subrepo: remove subrepo support 2019-03-11 10:43:55 -07:00
debugshell.py hgmain: make bindings a builtin module 2019-09-20 18:32:36 -07:00
dialect.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
directaccess.py directaccess: avoid false positive detection of revnum usage 2019-08-22 13:00:12 -07:00
dirsync.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
disablesymlinks.py disablesymlinks: add extension to disable symlinks 2019-02-06 08:41:34 -08:00
drop.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
edrecord.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
eol.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
errorredirect.py blackbox: clean up blackbox logging and log more during rage 2019-04-23 02:48:50 -07:00
extdiff.py subrepo: remove subrepo support 2019-03-11 10:43:55 -07:00
extorder.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
extutil.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
fastlog.py changelog: get access to config options 2019-08-15 12:47:35 -07:00
fbconduit.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
fbhistedit.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
fixcorrupt.py fixcorrupt: fix debugfixcorrupt on treeonly repos 2019-07-19 20:15:36 -07:00
generic_bisect.py codemod: move Python packages to edenscm 2019-01-28 18:35:41 -08:00
githelp.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
gitlookup.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
gitrevset.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
globalrevs.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
gpg.py codemod: replace os.fdopen with util.fdopen 2019-06-27 13:10:20 -07:00
grepdiff.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
grpcheck.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
hgsql.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
hiddenerror.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
histedit.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
infinitepushbackup.py commitcloud: incorporate infinitepush backups into commitcloud 2019-05-20 06:19:47 -07:00
interactiveui.py add skip 1 day buttons to interactive history 2019-07-29 08:52:13 -07:00
journal.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
linkrevcache.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
logginghelper.py logginghelper: log normalized repo name 2019-03-04 00:05:00 -08:00
lz4revlog.py hgmain: make bindings a builtin module 2019-09-20 18:32:36 -07:00
mergedriver.py tracing: trace mergedriver 2019-05-09 08:08:19 -07:00
morecolors.py blackbox: clean up blackbox logging and log more during rage 2019-04-23 02:48:50 -07:00
morestatus.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
myparent.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
nointerrupt.py dispatch: remove Python alias handling 2019-08-19 19:27:29 -07:00
ownercheck.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
patchrmdir.py setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
patchrmdir.pyx codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
phabdiff.py hg | phabdiff | Properly handle both 't' and 'T' prefixes for tasks when parsing them out of commit messages. 2019-04-29 14:41:38 -07:00
phabstatus.py snapshot: fix graphnode and phabstatus templates for snapshots 2019-10-04 10:07:53 -07:00
phrevset.py phrevset: avoid crashing on null graphql reply 2019-04-09 07:53:43 -07:00
progressfile.py progressfile: include pid in progress information 2019-09-16 19:02:38 -07:00
pullcreatemarkers.py snapshot: make the snapshots invisible after pull 2019-09-26 04:50:17 -07:00
purge.py match: remove explicitdir 2019-10-02 11:00:23 -07:00
rage.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
rebase.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
remotenames.py remotenames: add a debug command to write remotenames 2019-09-23 17:11:23 -07:00
reset.py reset: fix visibility interaction 2019-05-03 17:44:51 -07:00
sampling.py sampling: add a debug option 2019-09-20 18:32:38 -07:00
schemes.py hgext: reformat using black 2019-03-13 18:35:09 -07:00
sendunbundlereplay.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
share.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
shelve.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
sigtrace.py sigtrace: use smarttraceback and print to stderr 2019-09-04 13:37:39 -07:00
simplecache.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00
smartlog.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
sparse.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
sshaskpass.py codemod: replace os.fdopen with util.fdopen 2019-06-27 13:10:20 -07:00
stablerev.py stablerev: pass information using environment variables 2019-09-05 15:53:37 -07:00
stat.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
traceprof.py setup: move native extensions to edenscmnative 2019-06-19 17:55:49 -07:00
traceprof.pyx codemod: move Python packages to edenscm 2019-01-28 18:35:41 -08:00
tweakdefaults.py commands: define prefixes as aliases 2019-10-08 09:45:59 -07:00
undo.py undo: support visibility + narrow-heads directly 2019-09-25 17:22:53 -07:00
whereami.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
win32mbcs.py codemod: import from the edenscm package 2019-01-29 17:25:32 -08:00
win32text.py use pycompat.range instead of xrange 2019-09-26 15:29:48 -07:00