Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.
Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.
Reviewed By: phillco
Differential Revision: D13868981
fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
Summary:
This is required for testing `globalrevs` integration with
`hgsubversion`. In particular, we will test out whether we can resolve
`r<svnrev>/r<globalrev>` correctly later. Seems like this configuration should
be on during all the tests because it is the configuration we use in
production. Therefore, this commit in resolves revset string with prefix `r`
for all the `hgsubversion` tests.
Reviewed By: quark-zju
Differential Revision: D12888961
fbshipit-source-id: af9b2e1aea9771f42fe1fb2d3f9a759a926b1ce3
Summary: Its functionality was folded into core a while ago, so we can just call `log -G`.
Reviewed By: quark-zju, singhsrb
Differential Revision: D10509538
fbshipit-source-id: 5c16ff708072e9bebabaf3b8e1474091dfb35216
Summary:
In the hgsubversion tests, a develwarn from another component (which doesn't
have a `config` key) crashes with a `KeyError`. Change to `get` so that
it doesn't crash.
Reviewed By: quark-zju
Differential Revision: D9699155
fbshipit-source-id: c360d5fb5ab7daf7f609d41e0ddfb7456b022666
Summary:
This commit just introduces `ui` and `repo` as optional arguments to
the `dispatch` method. This enables testing with custom `ui` and `repo` objects
during the tests.
Reviewed By: quark-zju
Differential Revision: D8925903
fbshipit-source-id: b720bf5fdb94cb08f83c69565b97b81e114a3327
Summary:
Currently, the `hgsubversion` tests use the same `ui` object while
creating the test repository. This commit just refactors and introduces some
methods to ease testing with a custom `ui` object.
This is useful for enabling other extensions together with `hgsubversion`
during the testing.
Reviewed By: quark-zju
Differential Revision: D8925900
fbshipit-source-id: 7c70fe7c9a58b242ab0af10045ce1589c67231b5
Summary:
This commit introduces a class for easily connecting with the test
database required for testing `hgsubversion` extension along with `hgsql`.
Reviewed By: quark-zju
Differential Revision: D8925907
fbshipit-source-id: ebf30a17ef71d62a8b95b52454a99d73fb6a1c0e
Summary:
Previous code format attempt (D8173629) didn't cover all files due to `**/*.py`
was not expanded recursively by bash. That makes certain changes larger than
they should be (ex. D8675439). Now use zsh's `**/*.py` to format them.
Also fix Python syntax so black can run on more files, and all lint issues.
Reviewed By: phillco
Differential Revision: D8696912
fbshipit-source-id: 95f07aa0c5eb1b63947b0f77f534957f4ab65364
Summary:
Solves issues below:
```
hgext/backups.py:18:1: F811 redefinition of unused 'registrar' from line 17
hgext/catnotate.py:1:1: F811 redefinition of unused 'util' from line 1
hgext/remotenames.py:57:5: F811 redefinition of unused 'registrar' from line 34
hgsubversion/setup.py:103:5: F401 'mercurial' imported but unused
hgsubversion/setup.py:109:5: F401 'hgsubversion.svnwrap.svn_swig_wrapper' imported but unused
i18n/polib.py:1281:29: F841 local variable 'exc' is assigned to but never used (Python 2)
i18n/polib.py:1427:13: F841 local variable 'typ' is assigned to but never used
i18n/polib.py:28:1: F401 'sys' imported but unused
mercurial/manifest.py:411:5: F811 redefinition of unused '_lazymanifest' from line 168
mercurial/posix.py:419:5: F811 redefinition of unused 'normcasefallback' from line 362
mercurial/posix.py:425:5: F811 redefinition of unused 'checkexec' from line 167
mercurial/posix.py:431:5: F811 redefinition of unused 'checklink' from line 234
mercurial/pycompat.py:29:5: F401 'http.cookiejar as cookielib' imported but unused
mercurial/pycompat.py:30:5: F401 'http.client as httplib' imported but unused
mercurial/pycompat.py:31:5: F401 'pickle' imported but unused
mercurial/pycompat.py:33:5: F401 'socketserver' imported but unused
mercurial/pycompat.py:34:5: F401 'xmlrpc.client as xmlrpclib' imported but unused
mercurial/statprof.py:573:36: F812 list comprehension redefines 'parent' from line 562 (Python 2)
mercurial/util.py:1076:5: F811 redefinition of unused 'nogc' from line 1051
mercurial/util.py:3221:5: F811 redefinition of unused 'dirs' from line 3184
tests/silenttestrunner.py:24:5: F811 redefinition of unused 'main' from line 6
tests/test-context.py:90:1: F811 redefinition of unused 'scmutil' from line 4
tests/test-fb-hgext-cstore-treemanifest.py:146:5: F811 redefinition of unused 'testDeeplyNested' from line 134
tests/test-fb-hgext-extutil.py:46:5: F811 redefinition of unused 'testbgcommandfailure' from line 37
tests/test_hgsubversion_util.py:47:1: F811 redefinition of unused 'svnwrap' from line 31 (Python 2)
tests/test_hgsubversion_util.py:49:1: F811 redefinition of unused 'svnwrap' from line 47 (Python 2)
```
Reviewed By: ryanmce
Differential Revision: D6934533
fbshipit-source-id: 8b51851a76fec88bb59107ed05a901d42c7326f8
Summary:
`run-tests.py` should set up `sys.path` correctly so `import mercurial` in
the hgsubversion tests should just work.
Also add a comment in `run-tests.py` to clarify this.
The hgsubversion module check is removed since it assumes the module lives in a
same directory as the test, which is not true with the `run-test.py --rebuild`
case.
Reviewed By: phillco
Differential Revision: D6758588
fbshipit-source-id: ba34253991e671dc972bcb1900243eab6b69fd92
Summary:
Here we make imports in `hgsubversion` tests work again.
This consists of two main parts:
1. tests were importing each other as python modules. Now that they have `-` in
their names, it is impossible. However, we can utilize some tricks to work
around this (`imp.load_source`)
2. tests where doing some weird location assumptions, we clean that up
Depends on D6719890
Test Plan: - `./run-tests -l test-hgsubversion-*`, see non-import-exception failures
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6719894
Summary:
This is in line with our general spirit of renaming things into test-extname-smth.
Depends on D6719883
Test Plan: - test fixes and runs follow in the stack
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.intern.facebook.com/D6719886