Commit Graph

6 Commits

Author SHA1 Message Date
Jun Wu
3c289e7803 scmutil: print out stat information on permission errors
Summary: This allows us to get more details when permission errors happen.

Reviewed By: sfilipco

Differential Revision: D18215999

fbshipit-source-id: fbc3216df09f47218c652dfb0cad87cf21bfed68
2019-10-30 17:48:12 -07:00
Jun Wu
5e5465c313 testutil/dott: match shell's behavior on quote handling
Summary:
This diff makes the code closer to shell behavior.

For example, globs are disabled for both single and double quotes:

  ~ % echo /bin/bash*
  /bin/bash /bin/bashbug
  ~ % echo "/bin/bash*"
  /bin/bash*
  ~ % echo '/bin/bash*'
  /bin/bash*

Environment variables are not expanded for single qutoes:

  ~ % echo $PWD
  /home/quark
  ~ % echo "$PWD"
  /home/quark
  ~ % echo '$PWD'
  $PWD

Tests using single quoted environment varialbes are updated to use double
quotes, mostly by using this vim command:

  %s/\(sh % ".*\)'\([^'$]*\$[^']*\)'/\1\\"\2\\"

The translation script was updated to prefer double quotes to preserve
environment variable expansion behavior.

Reviewed By: xavierd

Differential Revision: D17675351

fbshipit-source-id: d5c8d5f23ea8e29fe093c4e6ae89ddacda97141e
2019-09-30 16:53:25 -07:00
Jun Wu
210bf49f5e clidispatch: replace Dispatcher with CommandTable
Summary:
The `Dispatcher` provides lots of features but its internal state only contains
the command table. Replace it with `CommandTable` and make the methods free
functions.

This makes function dependencies more cleaner, for example things like "locating
a repo", "getting the args" etc. won't require a `Dispatcher`.

A side effect of this change is the non-utf8 command line arguments are no longer
supported. This is already broken since our hg wrapper (accidentally) enforced
utf-8 command line. Therefore related tests are removed.

Reviewed By: sfilipco

Differential Revision: D16796395

fbshipit-source-id: a793ce7b8befe7caf62405c582fc932eb3daa099
2019-08-21 12:16:35 -07:00
Jun Wu
5b543c3f59 test-command-template: fix compatibility on Windows
Summary: Fix various Windows compatibility issues in the test.

Reviewed By: sfilipco

Differential Revision: D16501049

fbshipit-source-id: 72de26fc80a5f9e023e4b30cc2111810c7ff4626
2019-07-25 17:43:42 -07:00
Jun Wu
c07c411b27 test-command-template: fix the test
Summary:
Manually fix the test so it runs. This is done by removing incompatible
features (cmp, diff), and rewritting bash for loops to Python loops.

It took 183s before, and 6.6s now.

Reviewed By: xavierd

Differential Revision: D16435711

fbshipit-source-id: abf8889caa8b9b7b4137c873f3926ce1c6792f55
2019-07-24 14:32:25 -07:00
Jun Wu
0789866163 test-command-template: auto translate the test
Summary:
This is done via:

  python -m testutil.dott.translate --black --verify test-command-template.t
  hg mv --after test-command-template.t test-command-template-t.py

The test is currently broken, though. It will be fixed in the next diff.

Reviewed By: xavierd

Differential Revision: D16450199

fbshipit-source-id: 73f80fd616e34c402016ff82a37eb68651a75b6e
2019-07-24 14:32:25 -07:00