Commit Graph

7 Commits

Author SHA1 Message Date
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
Jun Wu
df06404eb0 hgsql: correct sqlstrip
Summary: When stripping rev x, revlog revisions with linkrev >= x should be deleted.

Reviewed By: phillco

Differential Revision: D10108592

fbshipit-source-id: 2f9f5663327c4494bd7e836ab24ffc7e507530f4
2018-09-28 16:58:37 -07:00
Jun Wu
4ddedaf7d2 tests: remove most rocksdb test cases
Summary:
RocksDB and InnoDB are highly compatibile. There is no need to test RocksDB
engine for every hgsql related tests. Only use rocksdb for 2 of the tests.

Reviewed By: phillco

Differential Revision: D10055068

fbshipit-source-id: f9b7ef546fe7d457b0390e49014ebbe56d3c12c1
2018-09-26 14:20:15 -07:00
Saurabh Singh
e34c0073fd hgsql: respect --cwd global option in commands
Summary:
`sqlrecover`, `sqlrefill` and `sqlstrip` use `ui.environ["PWD"]` to
get the current working directory which leads to not respecting the global
`--cwd` option to the Mercurial commands. This commit switches to using
`pycompat.getcwd()` instead which fixes this issue.

Reviewed By: quark-zju

Differential Revision: D8925908

fbshipit-source-id: 743bf3f6dda0a8545b171b01c1f7d3288f2936b7
2018-07-23 12:59:00 -07:00
Saurabh Singh
bdc7cca4fe sqlstrip: introduce test case to show --cwd is not supported
Summary:
`sqlrecover`, `sqlrefill` and `sqlstrip` use `ui.environ["PWD"]` to
get the current working directory which leads to not respecting the global
`--cwd` option to the Mercurial commands. This commit just introduces a test
case which exposes this issue in `sqlstrip` tests.

Reviewed By: quark-zju

Differential Revision: D8925896

fbshipit-source-id: 0c0e523adc79db8c1357978185d7f157230b9783
2018-07-23 12:58:59 -07:00
Thomas Jacob
0e6b93a0e0 Add support for RocksDB
Summary:
- Add support for RocksDB engine (developed as a drop in replacement for innodb) to hgsql to allow new xdb.hgsql.1-10 shards to host hg repos
- Prefer MySQL test DBs in same region
- Run all hgsql unit tests also for RocksDB engine
- Allow for nested ifs to make that possible (downside if you switch off rockdb tests, innodb tests are run twice)

Reviewed By: quark-zju

Differential Revision: D7014064

fbshipit-source-id: 073c36176aa7eaf74252ef33c3f47da594920b28
2018-04-13 21:51:13 -07:00
Mark Thomas
742cd624f7 hgsql: integrate with hg-crew
Summary:
Move hgsql into the hgext directory, and the tests to tests/test-hgsql-*.

Update the tests to refer to the new places for things.

Test Plan: Run the hgsql tests and make sure they pass.

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6660499

Tasks: T24908724
2018-01-04 07:22:19 -08:00