Commit Graph

8 Commits

Author SHA1 Message Date
Kostia Balytskyi
fb54cc5694 hgsubversion: move to absolute import
Summary:
Let's move hgsubversion to absolute_import, just to be consistent with the rest
of Mercurial codebase.

Reviewed By: markbt

Differential Revision: D15392154

fbshipit-source-id: e4c32939aff0616790828da508f3feea158669e1
2019-05-21 09:15:21 -07:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
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
2019-01-29 17:25:32 -08:00
Saurabh Singh
a249ab6d9d globalrevs: return svn revision as global revision for older commits
Summary:
This requirement was discussed in both this thread:
https://fb.facebook.com/groups/247583349136387/permalink/359377874623600/ and
D13277462. Basically, we want

```
hg log -r <hash> -T "globalrev()"
```

to return the svn revision in case there is no global revision assigned to the
commit which is possible for older commits.

Reviewed By: phillco

Differential Revision: D13370832

fbshipit-source-id: 5f8ba4c1781f83204de775127554a4944f00bb1d
2018-12-06 17:55:08 -08:00
Saurabh Singh
b496efcc9a test-hgsubversion-globalrevs: test revset interoperability
Summary:
D12888964 added the capability for `svnrev` revsets to be
interoperable with the `globalrev` revsets. This commit adds the tests for it.

Reviewed By: quark-zju

Differential Revision: D12888960

fbshipit-source-id: 07b12632d534a329c32179e978b058b1e427e688
2018-11-06 16:42:11 -08:00
Saurabh Singh
ff98fdcc08 test-hgsubversion-globalrevs: remove the capturing ui
Summary:
The capturing UI is not required as we can use the much cleaner
`ui.pushbuffer`/`ui.popbuffer` for the intended purpose.

Reviewed By: quark-zju

Differential Revision: D12906912

fbshipit-source-id: ae93e6417135ca23b28a11af63745464344fa3cf
2018-11-06 16:42:11 -08:00
Saurabh Singh
32b539a13a test-hgsubversion-globalrevs: add useful params to the assert log method
Summary:
This method always prints the graph for the commits in the repository.
This commit adds supports for specifying any revset as input for the log and
also, makes printing the graph optional.

Reviewed By: quark-zju

Differential Revision: D12888965

fbshipit-source-id: 794606fa17f9836fd73675d36d11220b11994f41
2018-11-06 16:42:11 -08:00
Saurabh Singh
e9ebb554f3 test-hgsubversion-globalrevs: include svnrev in tests instead of rev
Summary: The `svnrev` is more useful than the `rev` in this context.

Reviewed By: quark-zju

Differential Revision: D12888963

fbshipit-source-id: a902c57ecc3bc3eca9da77ab6e14ef58512d5ad8
2018-11-06 16:42:11 -08:00
Saurabh Singh
33ea4e3f9c globalrevs: add tests for commits created through hgsubversion
Summary:
This commit adds basic tests for testing `globalrevs` in the commits
created via the `hgsubversion` extension.

Reviewed By: quark-zju

Differential Revision: D8925893

fbshipit-source-id: 288042d9c93527e96f5ff50069cab98cd45b780b
2018-07-23 18:53:16 -07:00