Commit Graph

14 Commits

Author SHA1 Message Date
Xavier Deguillard
2cd2ffbd58 replace use of Queue with pycompat.queue
Summary: The Queue module doesn't exist in Python3, use pycompat.queue instead.

Reviewed By: ikostia

Differential Revision: D17610680

fbshipit-source-id: 7f5bc7fe2b434fd959dc5fd5ed821c7b73b8030d
2019-09-26 15:29:49 -07:00
Xavier Deguillard
c5957985a3 use pycompat.range instead of xrange
Summary: The xrange function doesn't exist in python3, use the pycompat version instead.

Reviewed By: ikostia

Differential Revision: D17607522

fbshipit-source-id: c7b992071ad7933372033892ca99e240aa11ccba
2019-09-26 15:29:48 -07:00
Jun Wu
b178492317 changelog: disable inline revlog
Summary:
The inline revlog format merges `.i` and `.d` into one `.i` file. It was intended to reduce the
number of files for filelogs. For the changelog one extra file does not hurt.

This makes it easier to write native code parsing the changelog revlog index.

Reviewed By: xavierd

Differential Revision: D17125922

fbshipit-source-id: f48ffe0d2df71abec007a80e05b684dcbac71883
2019-08-30 14:58:02 -07:00
Durham Goode
55575572b8 hgsql: use mmap for hgsql revlog validation
Summary:
Opening all the revlogs to validate them is showing up as a performance
bottleneck for hgsql transactions. Let's switch them to using mmap to avoid
reading a bunch of data from disk.

Actually making this have an effect on our servers will also require setting the
experimental.mmapindexthreshold config.

Reviewed By: quark-zju

Differential Revision: D15441867

fbshipit-source-id: 4edde0bc3419ef75f82a4234c9dfc6604c6db9f4
2019-05-23 10:50:29 -07:00
Thomas Orozco
398d8bcc1f hgsql: expose reason on top of sqlisreporeadonly
Summary:
This introduces `repo.sqlreporeadonlystate()`, which works similarly to `repo.sqlisreporeadonly()`, but also gets the reason why the read only state is the way it is.

The underlying goal is to use this in a repo hook to report the lock state.

I retained the `sqlisreporeadonly` function so that we don't need to synchronize deployment of this code and the underlying hook.

Reviewed By: quark-zju

Differential Revision: D15165946

fbshipit-source-id: 0a62147167fa826b575178dd261990a956b5f317
2019-05-02 09:08:51 -07:00
Saurabh Singh
640c1b7d87 hgsql: refactor to use existing method during sqlstrip
Summary:
We have an existing method which can capture the desired functionality
without dropping all the data in the `revision_references` table. This
primarily solves these problems:

 - Reuse of code.

Reviewed By: farnz

Differential Revision: D15107057

fbshipit-source-id: 5f9970ffd13536808c1b201481b6d2015fbe8295
2019-05-01 10:46:30 -07:00
Stanislau Hlebik
8adfcdd88c hgsql: use fetchall method in committodb
Summary:
It makes this method 25-30% faster (shaves off 250-300 ms).

Also it counts number of fetched rows correctly - fetchall method was
overriden, but looks like __iter__ method wasn't

Reviewed By: ikostia

Differential Revision: D14915472

fbshipit-source-id: 313695c1a83d05dac2fc801792226b6b64539cb5
2019-04-13 03:20:27 -07:00
Harvey Hunt
024e39dbb5 hg: Fix sqlisreporeadonly sql connection
Summary:
When the sql_repo_lock.py hook is run, the sql connection won't have been
established yet. Let's open a connection and clean it up afterwards.

Reviewed By: quark-zju

Differential Revision: D14708851

fbshipit-source-id: f20b6dacdcb12cee839163325164d2e75816100c
2019-04-01 18:00:53 -07:00
Harvey Hunt
9f82b1f8e8 hg: Add ability to check repo lock status from hgsql
Summary:
As part of the mononoke write path rollout we want to be
able to dynamically block writes to a repo. This is implemented as
a table in hgsql (repo_lock) that both hg and mononoke can read, but
will only be updated by scmadmin.

Expose a function that can be used by in-process hooks to check if a repo is
locked for mercurial.

Reviewed By: quark-zju

Differential Revision: D14279169

fbshipit-source-id: f8bb4afeeeda67796cf806ab7f3fe42f4089818f
2019-03-18 09:42:37 -07:00
Liubov Dmitrieva
93057c645f codeformat - remove weird looking + for string concat on the same line
Summary:
These was probably introduced by moving to black.

The changes in the diff were generated by script.

Reviewed By: mitrandir77, singhsrb

Differential Revision: D14439667

fbshipit-source-id: 54f6e0bdcc59c1c6deb4eea46dc6f865bcd48cf8
2019-03-13 11:40:26 -07:00
Saurabh Singh
f93cde953d hgsql: execute memcommit with the hgsql lock
Summary:
We need to ensure that memcommit is executed with the hgsql lock if
the `hgsql` extension is enabled.

Reviewed By: DurhamG

Differential Revision: D14177416

fbshipit-source-id: dcabf08003b618579461c608f924fe7f5b796c37
2019-02-26 13:16:35 -08:00
Jun Wu
98bb16cace hgsql: fix hggit sync
Summary: Teach mysql connector to deal with bytearray.

Reviewed By: DurhamG, StanislavGlebik

Differential Revision: D14025816

fbshipit-source-id: 738d9ef37b985afad5fe62815be134a4a5913b9a
2019-02-11 13:47:12 -08: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
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00