Commit Graph

16 Commits

Author SHA1 Message Date
Saurabh Singh
c137206645 globalrevs: return globalrevs while resolving svnrev template keyword
Reviewed By: quark-zju

Differential Revision: D16361887

fbshipit-source-id: 547b03af9c17aa7ab033f9d1bd733f4a63830d07
2019-07-18 12:23:00 -07:00
Aida Getoeva
f2a68e1174 selectivepull: show hint in hg log to fetch remotename
Summary: When selective pull will be enabled, `hg log` won't be able to show any information about the remote bookmarks that are not in subscriptions for particular user. So we need to hint the user that they may want to explicitly pull the remote bookmark first, if hg log fails to find it.

Reviewed By: quark-zju

Differential Revision: D15516462

fbshipit-source-id: 5be77b0048d8e175a737f76a8e89768f4c837f60
2019-06-10 09:31:15 -07:00
Saurabh Singh
ecfe13aa97 globalrevs: clean up the 'globalrev' template to not rely on hgsubversion
Summary:
We will eventually get rid of the `hgsubversion` extension and
therefore, we want to remove any dependency on it in the long term. This commit
removes any dependency on the `hgsubversion` extension for retrieving the
`globalrev` corresponding to a commit. Note that the `globalrev` for the older
commits is just the `svnrev`.

Reviewed By: quark-zju

Differential Revision: D15579401

fbshipit-source-id: 021e6d93d008b07591e1b7801062d9c5fbfc7651
2019-05-31 12:16:54 -07:00
Durham Goode
ad813edcbd treemanifest: enable treemanifest by default in tests
Summary:
Now that all our repos are treemanifest, let's enable the extension by
default in tests. Once we're certain no one needs it in production we'll also
make it the default in core Mercurial.

This diff includes a minor fix in treemanifest to be aware of always-enabled
extensions. It won't matter until we actually add treemanifest to the list of
default enabled extensions, but I caught this while testing things.

Reviewed By: ikostia

Differential Revision: D15030253

fbshipit-source-id: d8361f915928b6ad90665e6ed330c1df5c8d8d86
2019-05-28 03:17:02 -07:00
Saurabh Singh
5f5c2d2eae globalrev: enable fast commit lookup using globalrev
Summary:
This is a requirement to enable Phabricator migration to a globalrev
based repository. The release engineering team has also expressed interest in a
faster way to lookup the commits using globalrev.

I am just using indexed log for now to enable faster lookup. We might not need
to backfill the indexed log since we mostly care for the newer commits. But if
we do need to, we can do it later.

Reviewed By: quark-zju

Differential Revision: D14687707

fbshipit-source-id: fe02e9a72b9edb57cfd49a294642014c7204c058
2019-04-01 12:43:00 -07:00
Saurabh Singh
0d204fba6f globalrevs: introduce configuration for specifying valid starting revision
Summary:
We need a configuration option for specifying the starting revision
beyond which we will consider the global revisions associated with the commit
valid for the following reasons:

 - It lets us have the flexibility to support `globalrevs` from a commit of our
   choice.
 - We need this configuration to decide when we should fallback to looking at
   the `svnrev` instead of the `globalrev`.

Reviewed By: quark-zju

Differential Revision: D12888966

fbshipit-source-id: 46d6314886ed5074edb537ba340d5606ec354619
2018-11-06 16:42:10 -08: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
Jun Wu
f7475e03c2 globalrevs: wrap repo.commitctx instead of wrapping extensions
Summary:
The next patch will change pushrebase code path so it does not have to go
through pushrebase._commit. Change globalrevs to wrap the lower-level
repo.commitctx to make sure commits have global revs assigned. Pushrebase
and hgsubversion wrappers are removed accordingly.

This also affects "hg commit" running in the server-side repo. Therefore
the test is changed to keep the change minimal.

It's also incorrect to reset the next revision counter at `repo.invalidate`.
It should only be reset at transaction abort. The original concern was
to get an up-to-date view of the revision number. Doing it in `repo.invalidate`
is risky. Enforce hgsql lock when reading the number to make it safer.

As we're here, change the transaction code so it does not wrap `_abort`
unnecessarily for nested transactions.

Reviewed By: singhsrb

Differential Revision: D10023541

fbshipit-source-id: 82d4b57dc2eafa8bc3cdf553e891db6e8c5ff741
2018-09-25 16:06:21 -07:00
Saurabh Singh
a72db7de63 globalrevs: add a configuration option to run in read only mode
Summary:
This commit adds a way to run the `globalrevs` extension only in read
only mode. This is useful in cases where repository `x` pulls from repository
`y`, both the repositories have `globalrevs` and `hgsql` enabled, we only
want to embed `globalrevs` in the commits for repository `y`, and we want to be
able to read the `globalrevs` in repository `x`.

Reviewed By: phillco, quark-zju

Differential Revision: D9978146

fbshipit-source-id: b9530e8e9cfadc28e2cd30e51649cee9e6e144bf
2018-09-20 14:28:07 -07:00
Saurabh Singh
c1e276b215 globalrevs: do not wrap extensions if hgsql is bypassed
Summary:
In the current implementation, the `globalrevs` extension complains if
the `hgsql` extension is enabled but bypassed. This creates issues in cases
where the `hgsql` extension is bypassed intentionally as in D5012225. This
commit changes the logic in `globalrevs` extension to not wrap any extensions
if the `hgsql` extension is bypassed intentionally instead of raising an
exception.

Reviewed By: quark-zju

Differential Revision: D9883231

fbshipit-source-id: c57eaad4f661b69752a6457e6ecdd43f377285c1
2018-09-17 13:22:05 -07:00
Saurabh Singh
6187668183 globalrevs: add namespace to lookup based on global revision numbers
Summary:
We need to look up commits in the repository based on the strictly
increasing global revision numbers. This commit adds the following way of doing
so:

 - `m<number>`: `hg log -r m<number>` would match the commit having `number` as
   the strictly increasing global revision number.

Reviewed By: quark-zju

Differential Revision: D9764819

fbshipit-source-id: b9d3a80852c7acebd0c939a4d4f43c3c9a6cb0ab
2018-09-12 15:09:30 -07:00
Saurabh Singh
b0e2154df6 globalrevs: add revsets to look up based on global revision numbers
Summary:
We need to look up commits in the repository based on the strictly
increasing global revision numbers. This commit adds two ways of doing so:

 - `globalrev(number)` revset: `hg log -r 'globalrev(number)'` would match the
   commit having `number` as the strictly increasing global revision number.
 - `m<number>` stringset: `hg log -r m<number>` would also match the commit
   having `number` as the strictly increasing global revision number.

Reviewed By: quark-zju

Differential Revision: D9756146

fbshipit-source-id: db9ecf8f8244634d71957ddb645dfda675cab662
2018-09-11 15:22:26 -07:00
Saurabh Singh
743490c386 globalrevs: allow specifying custom repository name for globalrevs
Summary:
We can have situations where using the repository name from the
`hgsql.reponame` configuration as key for `globalrevs` data in the database can
lead to issues. As an example, for some repo `x`, we usually have a
`x-from-svn` Mercurial repository which gets the commits from svn and then
repository `x` pulls that data from `x-from-svn`. In such a setup, the
`hgsql.reponame` is usually set to `x-from-svn` for the corresponding
repository and similarly for the repository `x`. For the purpose of getting rid
of the backing Subversion repository, we will need to use the `globalrevs`
extension in the `x-from-svn` repository and it makes sense for us to have the
repository name as `x` from the beginning instead of `x-from-svn` from a
`globalrevs` perspective.

This commit just allows specifying a custom repository name to help with
aforementioned situation.

Reviewed By: quark-zju

Differential Revision: D9372695

fbshipit-source-id: 080e08a4a3ab3a4ba7a213e5177e40deb5dd5d88
2018-08-16 16:21:25 -07:00
Saurabh Singh
6abe49da8c globalrevs: allow making commits without using pushrebase
Summary:
As an intermediate step in conversion of the `WWW` repository to being
an Mercurial only repository, we will be modifying the `hgsubversion` extension
to start supporting `globalrev` in the commits pulled from the source
Subversion repository.

The `globalrevs` extension needs to allow for creation of commit through means
other than pushrebase for this process to succeed. Therefore, let's introduce a
configuration option for this purpose.

Reviewed By: quark-zju

Differential Revision: D8925894

fbshipit-source-id: ecb253828c0801c1c39f57ccaf2e11992a924e63
2018-07-23 12:58:58 -07:00
Saurabh Singh
a468f0d5b0 test-global-revs: add test for simultaneous pushes
Summary: See the commit content itself for the details on the testing.

Reviewed By: quark-zju

Differential Revision: D8695360

fbshipit-source-id: c7d4bb85a1c5ec3648a00e171b3ad592066d5daf
2018-06-29 15:05:50 -07:00
Saurabh Singh
938a9b048d test-global-revs: introduce tests for the globalrevs extension
Summary:
This commits just adds some tests for the `globalrevs` extension. See
the commit content itself for the details on the testing.

Reviewed By: DurhamG

Differential Revision: D8364382

fbshipit-source-id: f32b9fedd70f5f8ad40a034ce0d28867f9d1bdb4
2018-06-29 11:08:15 -07:00