Commit Graph

10 Commits

Author SHA1 Message Date
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
Kostia Balytskyi
45755289bd mononoke-replay: move unbundlereplay and checkserverbookmark to util.timed
Reviewed By: StanislavGlebik

Differential Revision: D15494128

fbshipit-source-id: 4a76a5f9dbffa989f17c9a5d2e78d130bb46635f
2019-05-25 10:57:49 -07:00
Thomas Orozco
1619f10b07 sendunbundlereplay: allow passing a log file for output
Summary:
This makes it easier for a wrapping job to associate output with a given command it ran.

Note that creating a SSH peer creates its own copy of the `ui` object, which is why we have to push a buffer to both `ui` instances.

Reviewed By: ikostia

Differential Revision: D15468456

fbshipit-source-id: c6f1937749447e27332801577538d9874eb18898
2019-05-24 03:40:45 -07:00
Kostia Balytskyi
7abc07832c sendunbundlereplay: add batch mode of operation
Summary: This will hopefully improve our mononoke-hg-sync speed.

Reviewed By: StanislavGlebik

Differential Revision: D14915529

fbshipit-source-id: dd4c111f9e52828f3ea355fad9b0d83515a29de8
2019-04-29 09:48:50 -07:00
Kostia Balytskyi
8e92391e67 mononoke: preserve more output from hg side in the sync job
Summary: This will help us debugging of what's going on on the server side.

Reviewed By: StanislavGlebik

Differential Revision: D14876167

fbshipit-source-id: 17aaa6dca9d5b5d7bbf69be46b58e454fe9f3fc3
2019-04-10 18:05:37 -07:00
Stanislau Hlebik
dee75aa345 pushrebase: support deletion of a bookmark in sendunbundlereplay
Summary:
Previously one couldn't use `sendunbundlereplay` to replay a bundle that just
deletes a bookmark i.e. sends only pushkey part. The problem was in that
`bundleoperation.gettransaction` method wasn't called and so a few hook
arguments weren't set.

In order to fix it this diff just calls this method before calling pushkey. The
solution is not clean, but I don't see much better alternatives.

Another smaller change that this diff is doing is changing sendunbundlereplay
command to require `--deleted` flag. This is just for convenience.

Reviewed By: quark-zju

Differential Revision: D14185380

fbshipit-source-id: f511dc0b9906520b7877501b37639d89ada6fc45
2019-02-25 13:08:00 -08:00
Stanislau Hlebik
086e927aab sendunbundle: better process errors
Summary:
We didn't process parts like `error:abort` and so we might have easily missed
an error. This diff fixes it.

Reviewed By: quark-zju

Differential Revision: D14185378

fbshipit-source-id: e68e365fd939a4bd6a0c2835a513ebc94530aa87
2019-02-25 13:08:00 -08:00
Stanislau Hlebik
ddd0f0ed99 mononoke: mononoke -> hg sync job
Summary:
First stab at a job that will keep hg in sync with Mononoke when Mononoke
becomes a source of truth.

Reviewed By: ikostia

Differential Revision: D14018269

fbshipit-source-id: f88c5eba8bf5482f2f162b7807ca8e41a3b4291d
2019-02-21 05:46:40 -08:00
Kostia Balytskyi
4a3a890f0d unbundlereplay: do not produce changegroup response part
Summary:
This is a perf optimization. `unbundlereplay.respondlightly` instructs the
server to not produce the pushback parts regardless of what `replycaps` part
of the incoming bundle says. This is important, since the mononoke-hg sync will
send all the bundles in a searialized way, so we want to optimize time where
possible.

Reviewed By: StanislavGlebik

Differential Revision: D14131575

fbshipit-source-id: afec15347d43fa52b1ec64b4ac8ece5b227ccf7d
2019-02-20 08:47:25 -08:00
Kostia Balytskyi
da3e429150 wireproto: add unbundlereplay command
Summary:
This is to be used from Mononoke->hg sync.
Currently expects only `pushrebase` bundles, e.g. one head and one book to
move.

Reviewed By: StanislavGlebik

Differential Revision: D14116130

fbshipit-source-id: 959a6e51f51e21da5592c84188e294a33057ffaa
2019-02-19 01:57:39 -08:00