Commit Graph

10 Commits

Author SHA1 Message Date
Arun Kulshreshtha
e26bc3ffa4 clidispatch: add --insecure global flag
Summary: Add the `--insecure` flag to the list of global hg flags. This flag is already supported by Python, and adding it here will make it available to Rust code as well. This is used later in the stack.

Reviewed By: quark-zju

Differential Revision: D27243029

fbshipit-source-id: 150d42ee96e1e3194ff1be6a33d9b36887d86f2c
2021-03-31 12:53:46 -07:00
Jun Wu
ed78542610 dispatch: add --trace flag
Summary:
The `--trace` flag enables tracing Python modules.
For compatibility reasons, it also enables `--traceback`.

It can be used with debugshell to make `%trace` more useful.

Reviewed By: sfilipco

Differential Revision: D23278600

fbshipit-source-id: d6d0b34bd5c48111f8cd33d7df115f349b0e95b6
2020-08-27 18:14:28 -07:00
Xavier Deguillard
36ff5d6a7d remotenames: fix expaths
Summary: We need to encode/decode utf8 when reading/writing to the hgrc file.

Reviewed By: DurhamG

Differential Revision: D20286068

fbshipit-source-id: b1d6828fb62a83ad22414de6883004411f302142
2020-03-06 10:29:32 -08:00
Mark Thomas
5168c29e12 encoding: use correct output encoding on windows
Summary:
On Windows, there are *two* 8-bit encodings for each process.

* The ANSI code page is used for all `...A` system calls, and this is what
  Mercurial uses internally.  It can be overridden using the `--encoding`
  command line option.

* The OEM code page is used when outputing to the console.  Mercurial has no
  concept of this, and instead renders to the console using the ANSI code page,
  which results in mojibake like "Θ" instead of "é".

Add the concept of an `outputencoding`.  If this differs from `encoding`, we
convert from the local encoding to the output encoding before writing to the
console.

On non-Windows platforms, this defaults to the same encoding as the local encoding,
so this is a no-op unless `--outputencoding` is manually specified.

On Windows, this defaults to the codepage given by `GetOEMCP`, causing output
to be converted to the OEM codepage before being printed.

For ordinary strings, the local encoded version is wrapped by `localstr` if the
encoding does not round-trip cleanly.  This means the output encoding works
even if the character is not represented in the local encoding.

Unfortunately, the templater is not localstr-clean, which means strings can get
flattened down to the local encoding and the original code points are lost.  In
this case we can only output characters which are in the intersection of the
encoding and the output encoding.

Most US English Windows systems use cp1252 for the ANSI code page and cp437 for
the OEM code page.  These both contain many accented characters, so users with
accented characters in their names will now see them correctly rendered.

All of this only applies to Python 2.7.  In Python 3, everything is Unicode,
the `--encoding` and `--outputencoding` options do nothing, and it just works.

Reviewed By: quark-zju, ikostia

Differential Revision: D19951381

fbshipit-source-id: d5cb8b5bfe2bc131b2e6c3b892137a48b2139ca9
2020-02-20 04:28:48 -08:00
Jun Wu
1fead58252 cmdutil: remove allcmds from UnknownCommand
Summary:
This makes the backtrace much shorter.

Before:

	Traceback (most recent call last):
	  File "edenscm/mercurial/cmdutil.py", line 876, in findsubcmd
	    aliases, entry = findcmd(cmd, table)
	    # cmd = 'foo'
	  File "edenscm/mercurial/cmdutil.py", line 871, in findcmd
	    raise error.UnknownCommand(cmd, allcmds)
	    # allcmds = ['debuggentrees', 'debugsuccessorssets', 'branch', 'br', 'bra', 'bran', 'branc', 'show', ...]
	    # cmd = 'foo'
	UnknownCommand: ('foo', ['debuggentrees', 'debugsuccessorssets', 'branch', 'br', 'bra', 'bran', 'branc', 'show', 'rename', 'move', 'mv', 'ren', 'rena', 'renam', 'mo', 'mov', 'commit', 'ci', 'com', 'comm', 'commi', 'debugremotebookmark', 'gc', 'debugindexedlogdatastore', 'debugexistingcasecollisions', 'debugshell', 'dbsh', 'debugsh', 'debugpython', 'debugpy', 'debugfileset', 'debugdata', 'debugundohistory', 'debugprogress', 'config', 'showconfig', 'debugconfig', 'conf', 'confi', 'paths', 'path', 'bisect', 'bi', 'bis', 'bise', 'bisec', 'debugcheckcasecollisions', 'add', 'debugrename', 'annotate', 'blame', 'blam', 'an', 'ann', 'anno', 'annot', 'annota', 'annotat', 'journal', 'j', 'jo', 'jou', 'jour', 'journ', 'journa', 'parents', 'par', 'pare', 'paren', 'parent', 'rollback', 'debugmergestate', 'identify', 'id', 'ide', 'iden', 'ident', 'identi', 'identif', 'debugformat', 'bookmarks', 'bookmark', 'bo', 'boo', 'book', 'bookm', 'bookma', 'bookmar', 'debugrevspec', 'debugwalk', 'amend', 'am', 'ame', 'amen', 'debughttp', 'hide', 'strip', 'hid', 'str', 'stri', 'tip', 'ti', 'debugcommitmessage', 'hint', 'hin', 'locate', 'loc', 'loca', 'locat', 'debugfilerevision', 'debugfilerev', 'incoming', 'in', 'debugdag', 'next', 'n', 'ne', 'nex', 'unshare', 'rebase', 'unhide', 'unh', 'unhi', 'unhid', 'grep', 'gre', 'archive', 'ar', 'arc', 'arch', 'archi', 'archiv', 'debugmarklanded', 'debugpushkey', 'debugdatapack', 'debugtreestate', 'debugtreedirstate', 'debugtree', 'debuglocks', 'debuglock', 'revert', 'rev', 'reve', 'rever', 'export', 'e', 'ex', 'exp', 'expo', 'expor', 'repack', 'shelve', 'she', 'shel', 'shelv', 'log', 'history', 'debugwaitbackup', 'debugnamecomplete', 'diff', 'd', 'di', 'dif', 'debugdrawdag', 'debugcheckoutidentifier', 'debugdate', 'debuggethistory', 'debugssl', 'init', 'ini', 'debuggetbundle', 'summary', 'sum', 'su', 'summ', 'summa', 'summar', 'unbundle', 'unb', 'unbu', 'unbun', 'unbund', 'unbundl', 'debugwaitonrepack', 'backfilltree', 'debugcrdump', 'outgoing', 'out', 'debugupgraderepo', 'debugmovescratchbookmark', 'debugrebuilddirstate', 'debugrebuildstate', 'debugancestor', 'remove', 'rm', 'rem', 'remo', 'remov', 'debugfillinfinitepushmetadata', 'sparse', 'tags', 'debugcolor', 'debugrunshell', 'debugpathcomplete', 'purge', 'clean', 'undo', 'debugindexedlog-dump', 'debugcheckstate', 'metaedit', 'met', 'meta', 'metae', 'metaed', 'metaedi', 'debugcommands', 'convert', 'debugmutationfromobsmarkers', 'graft', 'gra', 'graf', 'root', 'uncommit', 'unc', 'unco', 'uncom', 'uncomm', 'uncommi', 'verifyremotefilelog', 'copy', 'cp', 'cop', 'debugpreviewbindag', 'files', 'fi', 'fil', 'file', 'debugprocesstree', 'debugproc', 'debugdeltachain', 'fold', 'squash', 'debughistorypack', 'debug-args', 'debugcapabilities', 'debugindexedloghistorystore', 'debuggetfiles', 'debuggetfile', 'debugapplystreamclonebundle', 'redo', 'cloud', 'debugremotefilelog', 'debugsetparents', 'debugmetalog', 'debugindexedlog-repair', 'debugbindag', 'version', 'vers', 'versi', 'versio', 'status', 'st', 'sta', 'stat', 'statu', 'debugmutation', 'debugignore', 'debugobsolete', 'debugupdatecaches', 'debugwaitonprefetch', 'merge', 'mer', 'merg', 'addremove', 'addr', 'addre', 'addrem', 'addremo', 'addremov', 'share', 'debugmanifestdirs', 'serve', 'fastannotate', 'fastblame', 'fa', 'debugdiscovery', 'debugwireargs', 'push', 'debugpickmergetool', 'debugstrip', 'debugbuildannotatecache', 'isbackedup', 'reset', 'debugcomplete', 'debugfsinfo', 'debugfs', 'prune', 'rage', 'unamend', 'una', 'unam', 'uname', 'unamen', 'previous', 'prev', 'previ', 'previo', 'previou', 'continue', 'cont', 'debugsvnlog', 'debugvisibility', 'cat', 'record', 'debugrevlog', 'unshelve', 'unshe', 'unshel', 'unshelv', 'debugrebuildfncache', 'debugdirs', 'import', 'patch', 'im', 'imp', 'impo', 'impor', 'patc', 'backfillmanifestrevlog', 'debuglabelcomplete', 'split', 'spl', 'spli', 'smartlog', 'sl', 'slog', 'sm', 'sma', 'smar', 'smart', 'smartl', 'smartlo', 'debuggettrees', 'debugedenrunpostupdatehook', 'debugstatus', 'manifest', 'mani', 'tag', 'bundle', 'bu', 'bun', 'bund', 'bundl', 'debugtemplate', 'phase', 'ph', 'pha', 'phas', 'dump-trace', 'debugstore', 'rebase', 'reb', 'reba', 'rebas', 'recover', 'debugrefreshwatchmanclock', 'doctor', 'verify', 'forget', 'for', 'forg', 'forge', 'debugextensions', 'pushbackup', 'absorb', 'ab', 'abs', 'abso', 'absor', 'sf', 'debuginstall', 'histgrep', 'debugreadauthforuri', 'prefetch', 'fs', 'blackbox', 'clone', 'histedit', 'histe', 'histed', 'histedi', 'debugpvec', 'resolve', 'reso', 'resol', 'resolv', 'debugcreatestreamclonebundle', 'debugserialgetfiles', 'debugbuilddag', 'debugindex', 'debugcreatescratchbookmark', 'heads', 'hea', 'head', 'debugedenimporthelper', 'githelp', 'git', 'pull', 'pul', 'chistedit', 'debugindexdot', 'debugdirstate', 'debugstate', 'debugknown', 'backout', 'backo', 'backou', 'update', 'up', 'checkout', 'co', 'upd', 'upda', 'updat', 'che', 'chec', 'check', 'checko', 'checkou', 'help', 'hel', 'debugbundle'])
	unknown command 'foo'
	(use 'hg help' to get help)

After:

	Traceback (most recent call last):
	  File "edenscm/mercurial/cmdutil.py", line 876, in findsubcmd
	    aliases, entry = findcmd(cmd, table)
	    # cmd = 'foo'
	  File "edenscm/mercurial/cmdutil.py", line 871, in findcmd
	    raise error.UnknownCommand(cmd)
	    # cmd = 'foo'
	UnknownCommand: foo
	unknown command 'foo'
	(use 'hg help' to get help)

Reviewed By: xavierd

Differential Revision: D19959205

fbshipit-source-id: e3fa6de8edfec7510ecd29defe538dddf8b563a2
2020-02-19 20:12:57 -08:00
Zeyi (Rice) Fan
92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00
Xavier Deguillard
cb64df7197 tests: @command expects str command names
Summary: This change all the tests to use strings as the command names.

Reviewed By: simpkins

Differential Revision: D19649479

fbshipit-source-id: 4b2cb9b3af73a7508ef359ee3c407d04a39c7893
2020-01-30 14:55:55 -08:00
Mark Thomas
d2730c3ba0 tests: update tests-[r-x]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457676

fbshipit-source-id: 5bbab22ff0d98b725b63b906864037fae5fa5171
2020-01-20 02:45:16 -08:00
Jun Wu
75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00