Commit Graph

13996 Commits

Author SHA1 Message Date
Xavier Deguillard
0ad557a531 test: add a test showing rust repack failure on non present directories
Summary:
Looking at the Hgerror scuba table, I see a lot of failures due to ENOENT on
Sandcastle. I'm suspecting this has to do with Sandcastle not having a local
manifest.

Reviewed By: quark-zju

Differential Revision: D14906506

fbshipit-source-id: a5d3eec824168e78ce3146dbde2d2bbbed1702f9
2019-04-15 11:06:04 -07:00
Max Kareta
27abd9e79d dispatch: fixed arguments escaping before invoking hooks
Summary:
This diff adds args escaping using single quote symbol before sending them to hooks.
Before all arguments where joined by space symbol " " which was producing incorrect result when argument itself contains space symbol.

Reviewed By: markbt

Differential Revision: D14799188

fbshipit-source-id: df5a4324d138515a4b881df96f2991de03df7a5b
2019-04-15 06:56:50 -07:00
Mark Thomas
f4245770a3 shelve: add shelvename template keyword
Summary:
Add `shelvename` template keyword, which expands to the name of the shelve for
commits that contain shelves.

Reviewed By: farnz

Differential Revision: D14932985

fbshipit-source-id: cddebd2dbc6454f7c61ed296f37822179da8a2de
2019-04-15 05:44:49 -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
Stefan Filip
14fde96b83 tests: fix test-hgsql-encoding
Summary: This test was failing because mercurial wants the file paths to be valid utf-8.

Reviewed By: singhsrb

Differential Revision: D14924604

fbshipit-source-id: be2db5c437df77ad3ad70f6956451e4a03835378
2019-04-12 19:57:44 -07:00
Mark Thomas
105e0dccf6 obsolete: don't create autorels for the final successor
Summary:
Autorels attempts to detect the scenario where `P -> Q` and `X -> Y` are
being added, and there already exists a `P -> ... -> X` relationship.

In this case it will create a `Q -> Y` "copy" marker to express the fact
that `Q` should be copied.

However, this also triggers in the case where `Q == Y`, creating a revive
marker for `Q`.

Normally this is benign, as Q is probably visible anyway, however when there
are two commits associated with a diff that has been landed, pullcreatemarkers
can create two markers: `P -> L` and `X -> L`.  Since P and X are for the same
diff, there probably exists a `P -> ... -> X` relationship, and so autorels
attempts to make an `L -> L` marker.  This fails because L is public.

Differential Revision: D14891063

fbshipit-source-id: 3f076a003508dd7b7d17e3eb7cdaeb8ac09e6b15
2019-04-11 07:49:21 -07:00
Mark Thomas
32b06d418d obsolete: add test demonstrating autorels obsoleting a public commit
Summary:
Demonstrate that a combination of autorels and pullcreatemarkers causes an
attempt to obsolete a public commit.

Differential Revision: D14891064

fbshipit-source-id: 29f5cea9c843cc87aef18f74bad11eaabfa7b311
2019-04-11 07:49:21 -07:00
Mark Thomas
90b12d41f4 mutation: use tglogm in all tests
Summary:
The `tglogm` test function displays a graph log with mutation information.
Use this common function in all tests.

Differential Revision: D14876688

fbshipit-source-id: 2eb29a45b6267d448d292ac13dbfb0135d6fc8e4
2019-04-11 07:49:20 -07:00
Mark Thomas
511b52863e visibility: support cloud sync
Summary:
Add support for explicit visibility tracking in commit cloud sync.

This means commit cloud reads the visibleheads and syncs these with the commit
cloud heads directly, removing the source of problems where obsmarkers disagree
on different hosts.

Commit cloud requires that the ordering of heads is maintained to get stable
ordering of new commits.  Update the visibleheads tracking to maintain
ordering, rather than using sets.

Finally, the calculation of the replacement node was slightly off.  This was
revealed in the new test case that is being added, so it is also fixed.

Differential Revision: D14876266

fbshipit-source-id: fe5b6bffd196d3bd74e7582e29484969495eac8e
2019-04-11 07:49:20 -07:00
Mark Thomas
d562032896 mutation: improve performance of obsolete check
Summary:
The computation of whether a commit is obsolete or not can be improved.

We can cache which commits are known to not be obsolete.

We can also have a cache for each filter type so that we only need to compute
obsolete nodes that match the filter.

Finally, when we need to compute all obsolete commits, we can start by looking
for commits which are made obsolete by only their closest successors, and then
filling back obsolescence to the predecessors of these obsolete commits.

Reviewed By: DurhamG

Differential Revision: D14858655

fbshipit-source-id: 1d03e214ad878ecb6ae548f80373702e2a184146
2019-04-11 02:45:16 -07:00
Mark Thomas
a5207547aa mutation: add absorb support
Summary: The `absorb` command should also record mutation information when it modifies commits.

Reviewed By: DurhamG

Differential Revision: D14871232

fbshipit-source-id: 46bc95b7f5781f0b5f5e057a34c755fcfe653f7e
2019-04-11 02:45:16 -07:00
Mark Thomas
07f5225572 visibility: don't let hiddenoverride pin commits visible
Summary:
With explicit visibility tracking, the hiddenoverride feature of the amend
extension is no long necessary.  When upgrading to explicit visibility,
include the pinned visible commits, however after that point, hiddenoverride
should have no effect.

Users can permanently reveal obsoleted commits using `hg unhide`.

Reviewed By: DurhamG

Differential Revision: D14851269

fbshipit-source-id: b516fa97ed1545d39b51baaf9c574cb73a571645
2019-04-11 02:45:15 -07:00
Mark Thomas
d803ebb3c7 visibility: make enabling or disabling of tracking a command
Summary:
Rather than implicitly upgrading or downgrading a repo based on the
`visibility.tracking` config option, add a new `hg debugvisibility` command to
do this explicitly.

Reviewed By: DurhamG

Differential Revision: D14871231

fbshipit-source-id: 73f4648408b3eca9ac12bd77e54d2d37ee342069
2019-04-11 02:45:15 -07:00
Mark Thomas
38930fd664 pullcreatemarkers: also create synthentic mutation entries and update visibility
Summary:
The pullcreatemarkers extension creates fake markers for landed commits by comparing
the differential revision of draft commits with those of landed commits.

In the future, mutation records will handle lands correctly, however until that stage,
replicate the pullcreatemarkers behaviour.

Reviewed By: DurhamG

Differential Revision: D14834746

fbshipit-source-id: e196ee28645270ccab1775ea896f0e453740c03e
2019-04-11 02:45:15 -07:00
Mark Thomas
2f0922256b mutation: add debugmutationfromobsolete to backfill mutation records
Summary:
Add `hg debugmutationfromobsolete` which backfills mutation information from
obsmarkers.

Reviewed By: DurhamG

Differential Revision: D14603199

fbshipit-source-id: 64458c52ba0e9f7bc9b38abeb94660cd1423fca7
2019-04-11 02:45:14 -07:00
Kostia Balytskyi
8e92391e67 mononoke: preserve more output from hg side in the sync job
Summary: This will help us debugging of what's going on on the server side.

Reviewed By: StanislavGlebik

Differential Revision: D14876167

fbshipit-source-id: 17aaa6dca9d5b5d7bbf69be46b58e454fe9f3fc3
2019-04-10 18:05:37 -07:00
Mark Thomas
87d3ef1330 mutation: record predecessors and operation in commit loginfo
Summary:
Record the commit predecessors and the mutation operation in the commit loginfo
so that it can be logged to telemetry.

Reviewed By: quark-zju

Differential Revision: D14798032

fbshipit-source-id: 9c4ac1a4df3c91087c776d1f8e5fca94713b0390
2019-04-10 15:16:17 -07:00
Mark Thomas
0cc0028d21 run-tests: don't disable linewrapping if there is nothing to output
Summary:
The tests for run-tests expect there to be no linewrapping control characters
output when there are no progress lines to print.  Make sure they only get
printed if there are lines to print.

Reviewed By: DurhamG

Differential Revision: D14851271

fbshipit-source-id: 4004f848e2e205d36bd0dd107ced2fe9d69e31d8
2019-04-09 13:31:56 -07:00
Aida Getoeva
0af9f95998 add backup command
Summary:
The command is supposed to check if the given commits are backed up and if not to back them up.

This is needed for `jf submit` to make sure that all the commits submitted are backed up by hg.

Reviewed By: markbt

Differential Revision: D14685222

fbshipit-source-id: 224a438ec1c5c17af6988c511be4af4a3a988a79
2019-04-09 12:14:08 -07:00
Aida Getoeva
6f4459dd42 don't skip metadata while creating data wirepacks
Summary:
Currently we skip metadata when constructing data wirepacks.
We need copy metadata in the data packflies, because the client expects the base text to contain copy metadata since the delta base on the server also contains copy metadata.

It is also needed for future file nodes validation.

Differential Revision: D14851678

fbshipit-source-id: 1a3f79dc2565cdb864bee2400d331ae3a7c3751b
2019-04-09 10:37:01 -07:00
Aida Getoeva
b8454aac03 test missing copy-from info in datapacks fetched from the server
Summary: Added new test to show that applying changes on the renamed file fails because of missing copy-from data in the datapacks.

Reviewed By: StanislavGlebik

Differential Revision: D14851679

fbshipit-source-id: 41fa2008bdfe0a74c97a0a24af58bf6abf4ebd80
2019-04-09 10:37:01 -07:00
Mark Thomas
d0edbd5b64 run-tests: don't disable linewrap all the time
Summary:
The progress indicator for run-tests.py disables terminal line wrapping at the
start of run-tests, and re-enables it at the end.  This causes two problems:

* Diff output is not wrapped, so only the start of changed lines are visible.
* Sometimes run-tests.py exits without restoring line wrapping.  In this case
  the shell session is adversely affected.

Disabled line wrapping is only necessary when outputting the progress, so
restrict it to there.

Reviewed By: quark-zju

Differential Revision: D14834719

fbshipit-source-id: 2c0380e7e1a1d5be195b025c252c80208e83a545
2019-04-09 03:37:44 -07:00
Saurabh Singh
b1d033afa3 test-adding-invalid-utf8: skip the test for OSX
Summary:
Files with invalid `UTF-8` names are not allowed on OSX anyway and
therefore, this test can be skipped on OSX.

Reviewed By: sfilipco

Differential Revision: D14835026

fbshipit-source-id: 5ad80a4e98ab5088951b1e8209981a3e7fdb03a1
2019-04-08 10:52:57 -07:00
Mark Thomas
15242183ef treemanifest: consider all parents of outgoing nodes for tree comparison
Summary:
When determining the contexts to compare trees against, consider all parents
of the missing nodes that aren't themselves missing.

In the case of:
```
  C
 / \
D   B
    |
    A
```
Where A and D are common and B and C are missing, the parents of the roots
are only A, which means D's tree will not be compared against and all of its
trees will be included.

Reviewed By: StanislavGlebik

Differential Revision: D14798681

fbshipit-source-id: c80add907338a3011daf54a2304ea19415b7f9fb
2019-04-08 03:32:00 -07:00
Mark Thomas
86118d3150 treemanifest: add test demonstrating infinitepush backing up too many trees
Summary:
When infinitepush is backing up merge commits that have a public commit as one
of their parents, and draft commits as the other, treemanifest doesn't look at
the public parents' trees when building the bundle.  This means the bundle may
contain the public parent's trees.  If this is a merge of two distinct
histories, it will contain a full tree for the public parent.

Add a test that shows the generated bundle contains too many trees.

Reviewed By: StanislavGlebik

Differential Revision: D14798683

fbshipit-source-id: 1bc1324cef2c2ade74ff4aa59a391cc0fcccf12f
2019-04-08 03:32:00 -07:00
Stefan Filip
9751716173 commitctx: refuse to commit files names that can't be interpreted as UTF-8
Summary: This is a stop gap measure while we move internal path encodings to UTF-8.

Reviewed By: quark-zju

Differential Revision: D14791761

fbshipit-source-id: e4d5a845aa4f28ed0744cf80021fd1446f3d6129
2019-04-05 16:30:00 -07:00
Mark Thomas
31312b0e34 checkoutidentifier: make dirstateinfo test deterministic
Summary:
Ordering of execution of the racing commands in the dirstate info test can vary
in a way that affects output ordering.  Capture the log output and print it
after the commands have completed to ensure the ordering is consistent.

Reviewed By: quark-zju

Differential Revision: D14798950

fbshipit-source-id: e7c7dc63302be4764970b012a50f55bc631ebfc5
2019-04-05 09:58:39 -07:00
Mark Thomas
2c7721b44a remotefilelog: datapack version mismatch can also return MemoryError
Reviewed By: ikostia

Differential Revision: D14800819

fbshipit-source-id: ad759fa64f725bf448aa5ed36f73ac2b9928c6bc
2019-04-05 09:31:08 -07:00
Jun Wu
31c8ecbdf4 dispatch: print shorter crash header
Summary:
Change the crash header to just a single line without blaming extensions or
Python. This makes the crash log shorter, and easier to read when there are
crashes in run-tests.py diffs.

Remove `ui.supportcontact` since it's no longer used.

Reviewed By: sfilipco

Differential Revision: D14393982

fbshipit-source-id: 3ede8d3d3d8fd5d125944a9a750350d3ce356b14
2019-04-04 23:38:34 -07:00
Xavier Deguillard
d6704f25f0 tests: fix test-gendoc.t
Summary: The german test was removed, which caused this test to fail.

Reviewed By: sfilipco

Differential Revision: D14778895

fbshipit-source-id: 35579fb6ec80fe3a435da8e6b93ccd14f1ac276d
2019-04-04 11:36:31 -07:00
Mark Thomas
9867fdb893 cmdutil: add checkout identifier to commit loginfo
Summary:
Add the checkout identifier to the loginfo for commit contexts that take data
from the working copy.

Reviewed By: quark-zju

Differential Revision: D14751601

fbshipit-source-id: 6ddcbf17b970ee24237edf501ae3d7fc8d320193
2019-04-04 11:29:50 -07:00
Mark Thomas
5274006a31 context: add loginfo for committable contexts
Summary:
Add `loginfo`, a new field to committable contexts, the contents of which will
be logged when the commit is committed to the repository.

Initially the logging only includes the commit node and author, but more things
will be added later.

Reviewed By: quark-zju

Differential Revision: D14751602

fbshipit-source-id: 2432dfb92dd2489cb8ad3464316a42ebaa79657c
2019-04-04 11:29:50 -07:00
Mark Thomas
fc9106e076 dirstate: add checkoutidentifier to identify and correlate checkouts
Summary:
When the user checks out a new commit (either by updating to it, by
creating a new commit, or by amending or rebasing the current commit), create a
unique identifier for that checkout.

Log this identifier at the start and end of command processing, and allow other
tools to also query and log the identifier.

This allows both Mercurial commands and other commands that log the identifier
to be correlated with a particular checkout.

Reviewed By: quark-zju

Differential Revision: D14648523

fbshipit-source-id: 2fad79c3010f5fad1a0e180e3d3d6d9c0a7f8e85
2019-04-04 11:29:49 -07:00
Xavier Deguillard
fb47e4793e tests: remove test-gendoc-de.t
Summary:
The test has been failing since D14627242. Since we're not updating our
i18n, let's just remove it.

Reviewed By: DurhamG

Differential Revision: D14761412

fbshipit-source-id: 8fa34121bffe159169a91a629996ae51036a7620
2019-04-03 15:23:27 -07:00
Xavier Deguillard
e2abd6aeca remotefilelog: more incremental repack for loosefile
Summary:
Loosefiles are quite slow to repack, and this is significantly affecting
laptops as the repack can potentially run for hours when a large amount of
loosefiles are present.

One of the reason for that is that an incremental repack really isn't
incremental for loosefiles as all of them are repacked at the same time.
Instead let's repack only one of the top-level directory at a time.

Reviewed By: quark-zju

Differential Revision: D14690348

fbshipit-source-id: ffba49840302ae0d99e32db410647e83e213fe64
2019-04-02 17:43:49 -07:00
Marla Azriel
39e4eb08af commands: help text for status, add, remove
Summary: Updated help text for hg status, hg add, hg remove

Differential Revision: D14627242

fbshipit-source-id: 83367838273e861b9ca6e73e588b175219dbe187
2019-04-02 14:26:03 -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
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
Mark Thomas
99c025c567 infinitepush: allow scratch bookmarks on public commits
Summary:
Allow running `hg push --to scratch/bookmarkname -r X` where X is a public
commit.

Note that updating a scratch bookmark that is on a public commit will
require a force push.

Reviewed By: quark-zju

Differential Revision: D14527730

fbshipit-source-id: dbc234b43d74a36b7403bea19e1e917ad69cdbbf
2019-04-01 05:03:18 -07:00
Jun Wu
9cba88f929 debugprocess: add a --sleep parameter
Summary: This makes it easier to debug real world progress related issues.

Differential Revision: D14691592

fbshipit-source-id: 2a653f657b6ba9f9369f1551845949ac7e4d0b9d
2019-03-29 20:32:22 -07:00
Durham Goode
b5d29d31b4 pushrebase: fix pushrebase for treeonly lfs pushes
Summary:
When doing a pushrebase, the server needs to mount a bundle over the
exist repository to run hooks. With lfs enabled this uses changegroupv3, and
with a treeonly client no manifests are sent as part of the changegroup (they
are instead sent as a separate part).

The combination of these three things hits an edge cases where if there are no
manifests in a changegroupv3 bundle, the bundlerepo class may not skip the
entire manifest part, and therefore the bundle appears to have no files in it,
even though the data is there.

This only happens if the server is in treeonly mode, or during pushrebase hooks
where we fake treeonly mode briefly. Since we don't have any server repos that
are treeonly and lfs yet, this didn't break us, but it would have. We caught it
because some of our hooks are affected when they try to read file contents.

The fix is to account for the cgv3 case in the bundle manifest consuming code.
Eventually we can get rid of all of this logic once we get rid of revlogs and
changegroups.

Differential Revision: D14676674

fbshipit-source-id: 86ac1ff4a92e37c4da3767a66760b55b658c836f
2019-03-29 13:57:54 -07:00
Durham Goode
a09517d05f pushrebase: add test demonstrating treeonly+lfs bug
Summary:
When a server is treeonly and using lfs, pushrebase pushes can fail
because bundlerepo doesn't know how to process a changegroupv3 with an empty
manifest section. This diff adds a test demonstrating the failure.

A future diff fixes it, and explains the bug in more detail.

Differential Revision: D14676673

fbshipit-source-id: fb3c4815a42e69e31b4f1673797de95516a83406
2019-03-29 13:57:54 -07:00
Mark Thomas
275ab15494 visibility: add undo support
Summary:
Add basic support for `undo` by updating visibility according to what the undo
extension would normally do with obsmarkers.

A future enhancement would be to use the `draftheads` directly as the new
visibleheads, however:

* `undo` currently uses `heads(draft())` which doesn't take into account
  secret commits.
* In order to support the `--branch` flag, we would need to make significant
  changes.  The flag is marked as ADVANCED and isn't used very much, so we may
  consider removing it.

Reviewed By: quark-zju

Differential Revision: D14603196

fbshipit-source-id: 5b8c91b4d8fa2b28cf9ad5726d88a3735aca50ad
2019-03-27 04:49:14 -07:00
Mark Thomas
ab9eb302f2 mutation: record mutation entries inside transactions
Summary:
Record mutation entries inside transactions.  This ensures that they only get
written when the transaction completes.

Indexedlog doesn't have support for pending writes, so mutation entries are not
visible to hook scripts.

Reviewed By: quark-zju

Differential Revision: D14566781

fbshipit-source-id: eb4c7bbd3878df82e8e7096a69509525f9fb93c0
2019-03-27 04:49:13 -07:00
Mark Thomas
6d84ff8825 mutation: create mutation store entries for local commits
Summary:
Computing mutation entries for all local commits is expensive when there are
lots of local draft commits.  Ideally we would have an indexed changelog that
would make these lookups fast, but until we have that, put entries in the
mutation store for these commits to take advantage of the fast lookup there.

Reviewed By: quark-zju

Differential Revision: D14566782

fbshipit-source-id: cc3a05715337a510a65d8ff436c59d16d0f0447e
2019-03-27 04:49:12 -07:00
Mark Thomas
4cef0e2f38 mutation: remove instabilities revsets
Summary:
The computations for instabilities revsets (`orphan`, `contentdivergent` and
`phasedivergent`) are complex, and aren't really necessary for the way we use
mutation information.

The `orphan` revset can be implemented as an alias for `obsolete():: -
obsolete()`.  The other conditions can be detected on a case-by-case basis
later if we need them.

Reviewed By: quark-zju

Differential Revision: D14566784

fbshipit-source-id: 60b8443ad4c0c82d8250d8e9a10e73fae770daa8
2019-03-27 04:49:12 -07:00
Mark Thomas
d6cf315f8f mutation: prefix predecessor hashes with hashing scheme
Summary:
To support future alternate hashing schemes, predecessor identities should be
prefixed with the hashing scheme in use.

Currently there is only one hashing scheme: `hg`, which is the Mercurial
hashing scheme.

Reviewed By: quark-zju

Differential Revision: D14566778

fbshipit-source-id: baaaf2f078886a1cc7ac20d12923a63b4da09db6
2019-03-27 04:49:12 -07:00
Jun Wu
d03f2d26c2 manifest: drop manifestv2 support
Summary:
The upstream has removed it in https://phab.mercurial-scm.org/D2393. Do the
same.

The deleted C++ code seems to leak `Py_False` if `usemanifestv2` is not set.

Reviewed By: singhsrb

Differential Revision: D14611525

fbshipit-source-id: d828526c31aaa861d100a846bba79d1f5898e245
2019-03-26 13:32:45 -07:00
Jun Wu
f3d5b0e27e revlog: drop v0 and v2 support
Summary:
A user hit cryptic error message:

  File "revset.py", line 423, in ancestor
    ancestors = repo.changelog.index.ancestors
  AttributeError: 'list' object has no attribute 'ancestors'

That was because they have run `rm -rf` and the `.hg` directory was mostly
removed. `hg` falls back to revlog v0, and the code in question obviously
dislikes revlog v0.

Change the error message to just say repo corruption.

Since there are code depending on revlog v1, and we don't use v0 or v2. Remove
both of them.

Reviewed By: singhsrb

Differential Revision: D14610769

fbshipit-source-id: 9015b74989d8fa4ad50bc36ec48bca26a1faa361
2019-03-26 13:32:45 -07:00
Durham Goode
73683c048e tracing: add various tracing across the code base
Summary:
Now that we have perftracing infra, let's trace a bunch of likely
problem spots.

Reviewed By: sfilipco

Differential Revision: D14426367

fbshipit-source-id: 354a241aa9ac5d75d34062a9838d581b4f46746f
2019-03-25 19:31:13 -07:00
Xavier Deguillard
ed47a4b8ea repack: add an option to run background repack with --packsonly
Summary:
Most of the repacks are background repacks, and most of the complaints are
coming from laptops users. Thanks to the rust repack, most of time during
repack is now spent in repacking loosefiles. While repacking them is expensive,
testing whether data is in a loosefile and obtaining it is actually pretty
fast. Packfiles have the opposite issue, repacking them is fast, but finding
data in them may be expensive if a lot of them are present.

Based on this, it makes sense to repack packfiles more frequently than
loosefiles. At first, the newly added option will be used to turn-off loosefile
repack for laptop users. A less frequent loosefile repack will be implemented
in a later patch.

Reviewed By: DurhamG

Differential Revision: D14586986

fbshipit-source-id: 5bc5c839cf8d2d78bcc4ffa016bbe3cf1b2ef3f7
2019-03-25 18:39:26 -07:00
Jun Wu
a5a8b9cafd tests: update an lfs test
Summary:
I'm not sure which change broke the test. It requires `lfs-test-server` to run,
which is not installed by default. So that's why people didn't realize it.

Differential Revision: D14607695

fbshipit-source-id: 3b0e6d4250f476abced414c00bddfe7d29d062d4
2019-03-25 18:33:06 -07:00
Jun Wu
077313f1af dispatch: move deferred to atexit handler
Summary:
See D14606986 for context. `repo.close` should be protected by not crashing on
stdout or stderr write errors (SIGPIPE or EPIPE). Move `deferred` to `atexit`
handler to get the protection.

Test changes are caused by ordering changes.

Differential Revision: D14607407

fbshipit-source-id: 5a42aefcec395f48b8ecb67426429ef2e41f5666
2019-03-25 18:33:05 -07:00
Jun Wu
7873db8242 ui: silent stdio write errors during atexit
Summary:
This is the first diff of an alternative fix of D14528603. See also D14603974
for context.

We'd like atexit handlers to not crash with EPIPE or SIGPIPE when writing to
stderr or stdout. Therefore disable SIGPIPE signal handler and patch ui methods
to do so.

Differential Revision: D14607159

fbshipit-source-id: 274c5174813d402a7e0b8b5be7c8fcb0524fcdb3
2019-03-25 18:33:05 -07:00
Durham Goode
ce423933c3 tracing: log perftraces to the blackbox
Summary:
Now that we're recording perftraces, let's log their results to the
blackbox if the command exceeds a configurable threshold.

Reviewed By: sfilipco

Differential Revision: D14426366

fbshipit-source-id: 24f261aaa2b089dbc959d709e51de1c0359d976d
2019-03-25 17:12:42 -07:00
Mateusz Kwapich
75c069b199 heurestics to resolve a obs/non-obs ambiguity
Summary:
This particular situation happens in the wild when the amend doesn't rebase
because of conflicts and users work on their stack using `hg prev` and `hg next
--rebase`. In this case when there's non-obsolete child that's always the child
we want to choose.

We're verbose about what we're doing so it's not confusing to the users.

Reviewed By: quark-zju

Differential Revision: D14560584

fbshipit-source-id: a453c0301a5156eea0d19ceb40d9a64e80b7fca7
2019-03-22 03:38:52 -07:00
Mateusz Kwapich
0034b0d018 test the "hg next" behaviour in case of obs/non-obs ambiguity
Summary: The next commit introduces a heurestic to resolve those.

Reviewed By: zertosh

Differential Revision: D14560585

fbshipit-source-id: b62b59e4b254e59e88cfc7859aa21feffc360b05
2019-03-22 03:38:52 -07:00
Jun Wu
2fef3bf971 smartlog: wrap user-provided revs with smartlog revset function
Summary:
Wrap user-provided revs with `smartlog` revset function. This makes more sense
together with the next change.

The test change is because "parents" of drafts are selected.

Reviewed By: DurhamG

Differential Revision: D14461519

fbshipit-source-id: 2a48931680f0dc50b80b87cea827152c21cf4791
2019-03-21 17:33:45 -07:00
Jun Wu
524fc6b566 smartlog: remove ancestorcache
Summary:
With the last change, the benefit of ancestorcache is limited.  Therefore just
remove it to reduce complexity. This also makes `smartlog` closer to `log`.

Reviewed By: DurhamG

Differential Revision: D14461523

fbshipit-source-id: eb108a09e12b07e5012f70aef0b2940b07d746fb
2019-03-21 17:33:45 -07:00
Durham Goode
1186282722 workers: flush mutable data before forking workers
Summary:
We encountered a bug where if a file descriptor was not flushed prior
to forking the process, then both processes would end up flushing the same data
to the file, resulting in duplicate data and a corrupt file.

The real fix is to stop using fork, but for now let's address the most visible
problem by flushing pack files before forking.

Reviewed By: kulshrax

Differential Revision: D14569005

fbshipit-source-id: e002abe72c8014cbe49ccffab6159f8372affdb0
2019-03-21 16:20:36 -07:00
Liubov Dmitrieva
f30ce27cd8 commitcloud: deprecate filtration of the push side
Summary: Deprecate due to complexity of the code.

Reviewed By: mitrandir77

Differential Revision: D14561405

fbshipit-source-id: 6184317f549c0ab84335b09c4b48efccdf31f7fc
2019-03-21 10:27:13 -07:00
Aida Getoeva
220e4c9879 add loose files size and count metrics
Summary: Added new metrics to log loose files size and number during repack. We need it to understand how much better the pack files work in terms of disc and memory usage.

Reviewed By: markbt

Differential Revision: D14544811

fbshipit-source-id: 5a4d894bd5a3358c7e0f93ecc9db5e9f2c2f2372
2019-03-21 09:59:44 -07:00
Liubov Dmitrieva
805a3aee56 add logic for safe switching cloud sync between Mercurial and Mononoke and back
Summary:
Basically we should check that the commits have been backed up.
If this is not true and the commits are local we can just back them up.
If they are not known by this repo, pull from the old one and then back them
up.

Reviewed By: markbt

Differential Revision: D14508239

fbshipit-source-id: 3fdd83335cb937b153510ec3c7510ecd1167d0ca
2019-03-21 09:02:23 -07:00
Jun Wu
b40af5890c metrics: add metrics about fetching remote data
Summary: Log data about round-trip count, and object count for files, trees, and SSH calls.

Differential Revision: D14515776

fbshipit-source-id: cce416fd7dccdad3c73a9f1751a04ddac0d2c507
2019-03-20 22:49:18 -07:00
Jun Wu
ea16e76336 metrics: make ui.metrics.gauge log to the sampling extension
Summary:
Make it possible to use `ui.metrics.gauge` to collect metrics for a single
command, via the sampling extension.

Differential Revision: D14515775

fbshipit-source-id: e8a53549b00c1bc7b6509a5990a51d955d767d7e
2019-03-20 22:49:18 -07:00
Jun Wu
0dfbf77f04 extensions: always enable the sampling extension
Summary: This makes sure `ui.log` always runs through the sampling code path.

Differential Revision: D14515774

fbshipit-source-id: 585cd14eaecda12a9c2dd6ed003f0a457d67daf1
2019-03-20 22:49:18 -07:00
Jun Wu
6a4c2ea9b5 metrics: slightly change the API
Summary:
Before this patch, metrics was designed to send stats to a global counter. I'd
like to use it for stats local to the current command (ex. count of file
fetching, count of round-trips, etc).

Change the API so "entity=None" forbids stats from sending to a global counter.

Differential Revision: D14515779

fbshipit-source-id: b5b3b040d674c71f467153c308b56aa6f506eb0c
2019-03-20 22:49:18 -07:00
Jun Wu
d47e205e87 ignore: disable hgignore by default
Summary:
Disable parsing `.hgignore` and related fileset `hgignore()` by default. They can
still be enabled via configuration. The plan is to completely remove them
later.

A replacement for `hgignore()` fileset was added as `gitignore()`.

The `hgignore()` fileset seems to be only used by zertosh in the past 3 months.

Reviewed By: singhsrb

Differential Revision: D14543232

fbshipit-source-id: f2385062a0e816331f693239f62448979876078a
2019-03-20 22:32:58 -07:00
Mark Thomas
5cbf536bf3 infinitepushbackup: use better revset for determining what to back up
Summary:
Change how infinitepush determines what to back up.

Commits to back up are all draft ancestors of non-obsolete commits, *plus* all
draft ancestors of bookmarked commits, which may be obsolete.

Previously, in a stack of the form:
```
  | x B (obsolete, bookmarked)
  | |
  | o A
  |/
  o
```
neither A or B would be backed up, despite normally being visible to the user.

Reviewed By: liubov-dmitrieva

Differential Revision: D14540356

fbshipit-source-id: 0d6ad330c53c818b08f736a9af64704cf0be7cd5
2019-03-20 11:24:22 -07:00
Mark Thomas
29d2bc3201 commitcloud: use better revsets for determining what to sync
Summary:
Change how commit cloud determines what to sync and what has been successfully
synced when some commits fail to push.

Commits to sync are all draft ancestors of non-obsolete commits, *plus* all
draft ancestors of bookmarked commits.

Commits to sync when only some commits have successfully been pushed are
ancestors of the newly pushed heads, *plus* ancestors of the commits to be
synced that were successfully synced last time.

Reviewed By: liubov-dmitrieva

Differential Revision: D14540357

fbshipit-source-id: c082a2f2822f8bce4cd2bbac93a70e27e2ffaa59
2019-03-20 11:24:22 -07:00
Mark Thomas
97c27f2303 commitcloud: add test demonstrating issue with bookmarked hidden commits
Summary:
If a bookmarked commit is shared between two machines, but was hidden in one
repo prior to commit cloud being enabled, then commit cloud sync will
repeatedly try to upload the commit on the machine where it is not hidden.

Reviewed By: liubov-dmitrieva

Differential Revision: D14520200

fbshipit-source-id: e2674387e34a5cbf87ef7286a5b8099020ea1f9f
2019-03-20 11:24:22 -07:00
Liubov Dmitrieva
96ec46f70d infinitepush - fix tests
Summary:
Now at the beginning of pushbackup we always check what the server already
have, this triggered changes in the output of the tests.

Before the limit of the check was 3 heads. I made it to 0 by default earlier and broke tests. Now we have fast way to check on the server side, so the limit 3 was not good. There is no reason to re-back up those.

Basically before we could backup the same thing again.

Reviewed By: markbt

Differential Revision: D14539582

fbshipit-source-id: 569b354580128c944a95fa64c0c964304a2cca8b
2019-03-20 07:57:36 -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
Jun Wu
3ca494b062 revset: optimize ancestor revset function
Summary:
Change `ancestor` to send 24 revs to the native ancestor logic at a time,
instead of 2 revs at a time.

This makes it much faster when calculating ancestor of many commits.

Before:

  quark@devvm33994 ~/fbcode/scm/hg % hg.real log -r 'ancestor(limit(draft(),6000))' -T '{node}\n' --time --hidden
  ca4beab06459e016ac1b4041400029165b701afa
  time: real 66.620 secs (user 44.800+0.010 sys 21.840+0.000)

After:

  quark@devvm33994 ~/fbcode/scm/hg % ./hg log -r 'ancestor(limit(draft(),6000))' -T '{node}\n' --time --hidden
  ca4beab06459e016ac1b4041400029165b701afa
  time: real 3.470 secs (user 2.380+0.000 sys 1.000+0.020)

This also affects `merge.preferancestor`. That's a dangerous config option and
seems fine to be ignored in the revset implementation.

Reviewed By: DurhamG

Differential Revision: D14461521

fbshipit-source-id: ec00921aece0adc6aaca49e5580bff52784c4ca5
2019-03-14 20:14:37 -07:00
Jun Wu
770a8f102c smartlog: clean up master logic
Summary:
Use "interestingmaster()" to make it easier to see how "master" gets decided.

Change the type of "master" argument taken by "smartlog" revset from string to
revset.  This is more consistent with other revset functions.

Reviewed By: DurhamG

Differential Revision: D14436003

fbshipit-source-id: 5aa166b523f36672f77dc4f161ae8d64c2b50579
2019-03-14 20:14:37 -07:00
Jun Wu
9b4487b1c5 smartlog: add a test about revset
Summary:
Add a simple test about smartset revset. It shows "smartlog(master=revset)"
does not work.

Reviewed By: DurhamG

Differential Revision: D14436005

fbshipit-source-id: e566aa35d1cb335718a48db1314454d2dc50411b
2019-03-14 20:14:37 -07:00
Jun Wu
4c4ec3513a smartlog: change smartlog revset to take heads
Summary:
Make `heads` in `smartlog` customizable. This makes smartlog more flexible.
Instead of using the default selection, the user can choose draft branches, and
potentially pass in `interestingbookmarks()` to include bookmarks and remote
bookmarks. For example, `smartlog(.::)` shows the current branch and the public
commit it bases on.

Drop `recentdays` as it can now be expressed using `heads` directly. See the
test change.

This would also hopefully make test-fb-hgext-smartlog-hide-before.t stable,
as it no longer uses `time.time()`.

Reviewed By: DurhamG, sfilipco

Differential Revision: D14436007

fbshipit-source-id: 5e0a76e4424b01312fef02fae23a3abd74e863c6
2019-03-14 20:14:37 -07:00
Jun Wu
f0dcadfa28 smartlog: rewrite part of the logic using efficent revset
Summary:
The old code basically selects ancestors of heads.

Rewrite the logic using revsets. Assuming we're only interested in ancestors
that are drafts, we can take advantage of `draft() & ::x` optimization.

The new logic also assumes master rev is public. Otherwise it can be slightly
different from the old logic.

The new code is much faster on my repo:

New code:

  quark@devvm33994 ~/fbcode/scm/hg % ./hg log -r 'smartlog()' --hidden -T . --time | wc -c
  time: real 0.630 secs (user 0.550+0.000 sys 0.030+0.000)
  6716

Old code:

  quark@devvm33994 ~/fbcode/scm/hg % hg.real log -r 'smartlog()' --hidden -T . --time | wc -c
  time: real 5.470 secs (user 3.920+0.000 sys 1.550+0.000)
  6716

This might make the ancestorcache hack (D5135746) unnecessary.

Reviewed By: DurhamG, sfilipco

Differential Revision: D14436008

fbshipit-source-id: 3c3bf47ccb67ea0e238542995009da9b9250b43b
2019-03-14 20:14:37 -07:00
Jun Wu
fa37745dd0 smartlog: change unmaned head query to heads(draft())
Summary:
The code falls back to head() if there are no remotenames. We don't need that
behavior. Therefore just simplify it by always using `heads(draft())`.

Reviewed By: DurhamG

Differential Revision: D14436009

fbshipit-source-id: 25c2d245ed64a29e3e1677ededb4c2ba7b4a3ceb
2019-03-14 20:14:36 -07:00
Xavier Deguillard
d0801a56d3 test-fb-hgext-treemanifest-server.t: silence spurious errors
Summary:
The test frequently fails with spurious remote errors such as:

  remote: ** Unknown exception encountered with possibly-broken third-party extension treemanifest.
  remote: ** Please disable treemanifest and try your action again.
  remote: ** If that fixes the bug please report it to the extension author.
  remote: ** Python 2.7.11 (default, Feb  5 2019, 17:19:11) [GCC 5.x 20180625 (Facebook) 5.5.0+]
  remote: ** Mercurial Distributed SCM (version 4.4.2_dev)
  remote: ** Extensions loaded: remotefilelog, rebase, simplecache, treemanifest, conflictinfo, debugshell, errorredirect, githelp, mergedriver, progressfile, pushrebase
  remote: Traceback (most recent call last):
  remote:   File "<string>", line 44, in <module>
  remote:   File "<string>", line 42, in __run
  remote:   File "/usr/local/fbcode/gcc-5-glibc-2.23/lib/python2.7/runpy.py", line 162, in _run_module_as_main
  remote:     "__main__", fname, loader, pkg_name)
  remote:   File "/usr/local/fbcode/gcc-5-glibc-2.23/lib/python2.7/runpy.py", line 72, in _run_code
  remote:     exec code in run_globals
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/hg.py", line 42, in <module>
  remote:     entrypoint.run(False)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/entrypoint.py", line 80, in run
  remote:     dispatch.run()
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 99, in run
  remote:     status = (dispatch(req) or 0) & 255
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 393, in dispatch
  remote:     ret = _runcatch(req)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 575, in _runcatch
  remote:     return _callcatch(ui, _runcatchfunc)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 584, in _callcatch
  remote:     return scmutil.callcatch(ui, func)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/scmutil.py", line 135, in callcatch
  remote:     return func()
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 565, in _runcatchfunc
  remote:     return _dispatch(req)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 1353, in _dispatch
  remote:     lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 1053, in runcommand
  remote:     ret = _runcommand(ui, options, cmd, d)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 1365, in _runcommand
  remote:     return cmdfunc()
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/dispatch.py", line 1350, in <lambda>
  remote:     d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/util.py", line 1337, in check
  remote:     return func(*args, **kwargs)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/commands/__init__.py", line 5635, in serve
  remote:     s.serve_forever()
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/sshserver.py", line 107, in serve_forever
  remote:     while self.serve_one():
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/sshserver.py", line 139, in serve_one
  remote:     self.handlers[rsp.__class__](self, rsp)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/sshserver.py", line 88, in sendstream
  remote:     for chunk in gen:
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/bundle2.py", line 710, in getchunks
  remote:     self._getcorechunk(), self._compopts
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/bundle2.py", line 732, in _getcorechunk
  remote:     for chunk in part.getchunks(ui=self.ui):
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/bundle2.py", line 1165, in getchunks
  remote:     pycompat.raisewithtb(exc, tb)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/bundle2.py", line 1141, in getchunks
  remote:     for chunk in self._payloadchunks():
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/bundle2.py", line 1181, in _payloadchunks
  remote:     chunk = buff.read(preferedchunksize)
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/util.py", line 2062, in read
  remote:     for chunk in self.iter:
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/mercurial/util.py", line 2033, in splitbig
  remote:     for chunk in chunks:
  remote:   File "/data/users/xavierd/fbsource/fbcode/buck-out/dev/gen/scm/hg/hg#link-tree/edenscm/hgext/treemanifest/__init__.py", line 2255, in _generatepackstream
  remote:     for subname, subnode, subtext, x, x, x in subtrees:
  remote: RuntimeError: std::exception

They don't seem to affect what the test expect (missing node on the server), so
let's disable these

Reviewed By: DurhamG

Differential Revision: D14446457

fbshipit-source-id: 0ecb114bfcdeef1a3fcfef5a927f725401f90d4e
2019-03-14 16:01:22 -07:00
Durham Goode
ee7f2e0275 archive: prefetch remotefilelog files before executing archive
Summary:
Currently archive is almost useless because it fetches each file
one-by-one. Let's add prefetching.

Differential Revision: D14460880

fbshipit-source-id: 1f06e1ac9d03aae3ab27d3064f9fe6141051be06
2019-03-14 14:57:50 -07:00
Durham Goode
161cbd88ad archive: add test demonstrating multiple fetches during archive
Summary:
Remotefilelog is not optimized for archive, and does many fetches. A
future test will fix this, but let's add a test first.

Differential Revision: D14460881

fbshipit-source-id: 1797193be3dfec246fabb659ffaeea3dea69b8f3
2019-03-14 14:57:49 -07:00
Saurabh Singh
b04b0537b8 fbconduit: make globalrevs/svnrevs tests more robust
Summary:
D14448505 added the functionality of supporting globalrevs/svnrevs
with fbconduit. Lets add some more tests for it. In particular, this adds tests
for the failure case.

Reviewed By: quark-zju

Differential Revision: D14461674

fbshipit-source-id: 27d52f88013f694a2cb6bf1af795eba4f5dccc93
2019-03-14 10:35:32 -07:00
Kostia Balytskyi
b2284a0ad1 chg: remove the ability to produce an actual binary
Summary: We don't run this binary anymore, no reason to build and ship it.

Reviewed By: quark-zju

Differential Revision: D14437317

fbshipit-source-id: dd6da521783f18a2a518a7aa042be98950894e89
2019-03-14 06:35:45 -07:00
Saurabh Singh
d4c9456be9 fbconduit: fix resolving phabricator callsign for WWW
Summary: See the linked task for details.

Reviewed By: quark-zju

Differential Revision: D14448505

fbshipit-source-id: fc2efa71510b718c25a2cea3acf39663d280f19a
2019-03-13 18:35:09 -07:00
Saurabh Singh
6525966fd1 memcommit: enforce target parent to be original parent
Summary:
After going over the code review for D14332967, I have decided to keep
things simple for now and only allow making commits to same target parent as
the original parent. This was already the intention with the existing code.
Therefore, this commit just further enforces the requirement.

Reviewed By: quark-zju

Differential Revision: D14422351

fbshipit-source-id: 2f786fc3596b17c5020de9906adf8f22b50be4dd
2019-03-13 11:50:42 -07:00
Saurabh Singh
f6eb9864da memcommit: allow specifying destination parents while serializing commits
Summary:
This is useful for testing the `memcommit` command as the clients can
specify different destination parents than the original parents of the commit.

Differential Revision: D14410213

fbshipit-source-id: 846e0d764b9606f00aed95995c694f379457eec7
2019-03-12 12:27:39 -07:00
Saurabh Singh
14081b0ae9 memcommit: use a better error message for disallowing unrelated roots
Summary:
Earlier message suggested the feature is not supported when in fact it
is allowed via a configuration.

Differential Revision: D14410214

fbshipit-source-id: 0ec2a22920417c378cf3ac596565f9d2fa5f6d5c
2019-03-12 12:27:38 -07:00
Xavier Deguillard
41d275ad36 revisionstore: ignore transient errors during repack
Summary:
Corrupted packfiles, or background removal of them could cause repack to fail,
let's simply ignore these transient errors and continue repacking.

Reviewed By: DurhamG

Differential Revision: D14373901

fbshipit-source-id: afe88e89a3bd0d010459975abecb2fef7f8dff6f
2019-03-11 18:15:45 -07:00
Stefan Filip
3f33e9f3e9 configparser: fix XDG config loading
Summary:
The spec for both XDG and Mercurial say that when the XDG_CONFIG_HOME variable
is not set, we should default to $HOME/.config.

Windows and macOS also have a designated config folder outside of the home directory.
The `dirs` crate provides consistent access to this folder. I see no harm in looking at config
 folders across all operating systems.

Reviewed By: quark-zju

Differential Revision: D14380686

fbshipit-source-id: 5e5a9cd4694aaa49fbc526f4917dc4afdaeb9842
2019-03-11 15:32:55 -07:00
Liubov Dmitrieva
ea8ba67697 fix infinitepush state files in hg rage
Summary:
Since state files have been changed, now it is one per path, we should dump
them in a correct way

Reviewed By: markbt

Differential Revision: D14406311

fbshipit-source-id: 8d74a51e63028ec81bcf5e55ad117d3c960b4651
2019-03-11 12:13:05 -07:00
Jun Wu
28b4dfbb38 smartlog: show more commits
Summary:
To make "draft()" bounded and train users to hide unused commits manually,
change smartlog to "hide commits before <a static date>", instead of
"hide commits that are older than <a static time span>". Then we can
incrementally decrease the static date, and eventually show everything, and
force the user to think about what commits to keep or hide.

Reviewed By: singhsrb

Differential Revision: D13993584

fbshipit-source-id: 1a2b56f50d7f014a589f798cd2feaa6931e64fe3
2019-03-11 11:11:59 -07:00
Jun Wu
9e0a7c41a4 subrepo: remove subrepo support
Summary:
Subrepo is another unloved features that we don't want to support.

Aggressively remove it everywhere, instead of just turning off configs.

I didn't spend much time to split this commit so it's smaller and more friendly
to review. But it seems tests are passing.

Reviewed By: sfilipco

Differential Revision: D14220099

fbshipit-source-id: adc512a047d99cd4bafd0362e3e9b24e71defe13
2019-03-11 10:43:55 -07:00
Mark Thomas
dbe1d30cf0 treemanifest: include all trees when infinitepush rebundle converts trees
Summary:
If an infinitepush bundle contains flat manifests and is served from a
treemanifest repository, it can potentially fail to send all the needed data to
the client.

Understanding the bug requires two bits of context:
1. When sending commits from a tree server to a tree client, we generally don't
send any trees because they can be fetched by the client ondemand later. The one
exception to this is for infinitepush bundles, where the trees inside the bundle
cannot be served ondemand, and therefore must be served at pull time. To do this
we check if a given manifest node exists in the repositories permanent storage,
and if it doesn't, we assume it came from an infinitepush bundle and serve it
with the pull.
2. When we lookup a manifest and fail to find a tree, our last resort is the
ondemandstore which knows how to convert a flat manifest into a tree manifest.
On the server, this is responsible for converting each of the flat bundle's
manifests into treemanifests before we serve the bundle to the client. As part
of converting the flat manifests into treemanifests, it writes the new tree
data into a pack file.

The bug is then, when serving a stack of commits, if we try to package up the
top tree first (i.e. the most recent tree), we end up converting the entire
stack from flat into trees, which inserts the bottom most trees into the
temporary pack file.  Because they exist in the temporary pack file, when we
later check if they are part of the repositories store we end up finding them,
which causes us to treat them as not-infinitepush-trees which means we don't
serve them to the client.

The fix is to change the infinitepush tree-serving code to not consider the
mutable packs when checking if it should send trees.

Reviewed By: mitrandir77

Differential Revision: D14403925

fbshipit-source-id: 38043dfc49df5ff9ea2fae1d3cac341c4936509c
2019-03-11 05:39:49 -07:00
Jun Wu
ec163cfbfa drawdag: allow overriding dates
Summary: Make it possible to override dates in commits.

Reviewed By: singhsrb

Differential Revision: D13993585

fbshipit-source-id: 59a72302d7ed0cb22f4eff84c1325e167963508c
2019-03-08 20:27:07 -08:00
Jun Wu
58027d450b runtests: add --update-output flag
Summary:
Add a `--update-output` flag to answer "yes" for all `-i` prompts.
Also add an "all" option for the `-i` prompt.

This is useful to apply changes to a large range of tests.

Reviewed By: DurhamG

Differential Revision: D14233452

fbshipit-source-id: ebfc5c9a897a7fc7fea779aefef538e420e1e197
2019-03-08 17:15:52 -08:00
Jun Wu
f8e28f1466 bookmarks: remove branch name collision check
Summary:
Eventually we'd like "default" to be not a special name. This is one step
torwards that.

Differential Revision: D14233455

fbshipit-source-id: 739091a124bc667c607c283bf00abc66b4081d25
2019-03-08 16:33:20 -08:00
Jun Wu
c0d96cde7d hook: make "mercurial" module available for Python hooks
Summary:
Some hooks (ex. mergedriver) are checked in old release branches. Provide
"mercurial" module compatibility so they won't break.

Reviewed By: mitrandir77

Differential Revision: D14366343

fbshipit-source-id: d47cc4fd512f63e4f6cdc5d7e5ab2c4398216b2f
2019-03-08 16:04:38 -08:00
Jun Wu
46266b7436 tests: use hg files to decide testrepohg vs syshg
Summary:
`helpers-testrepo.sh` decides whether to use the in-repo hg or the system hg.
With the latest treemanifest chagne, the in-repo hg could fail on `hg files`
complaining about `remotefilelog.reponame` not being set, while `hg id` still
works.

Since most `test-check` tests just run `hg files`. Use the same command instead
of `hg id` to decide whether to use system hg.

Reviewed By: sfilipco

Differential Revision: D14372231

fbshipit-source-id: e87d407ff1d2552306f62912e0805dafe3c0bacb
2019-03-08 15:45:51 -08:00
Mark Thomas
c202c9953b fs: add start, stop and restart subcommands
Summary:
Add `hg fs start`, `hg fs stop` and `hg fs restart` subcommands to start, stop
and restart the eden daemon.

Reviewed By: chadaustin

Differential Revision: D13888876

fbshipit-source-id: ab190675d2b2ad56f38d723d1859f516aa3165e8
2019-03-08 06:02:21 -08:00
Mark Thomas
3c5d3fba54 visibility: add pushrebase support
Summary:
Support updating of commit visibility when using pushrebase.  Since obsmarkers
may not be available, this also involves looking at the commit mutation data
returned from the server.

Reviewed By: DurhamG

Differential Revision: D12980783

fbshipit-source-id: 837e356e500e7bf9710a3619a31094cae21d36c9
2019-03-08 03:05:58 -08:00
Mark Thomas
d7375d7397 visibility: update visibility when commits are modified
Summary:
When commits are added or modified, update the set of visible heads if
visibility tracking is enabled.

Reviewed By: DurhamG

Differential Revision: D12980779

fbshipit-source-id: 8f44045159c86a374ae530fa4327ee0807b4320d
2019-03-08 03:05:58 -08:00
Mark Thomas
3b41f2f54c mutation: detect landed commits using synthetic mutation records
Summary:
Add support for detecting landed commits.

Since we don't currently have an index for successor information in the
changelog, we can only detect the successor relationship for predecessors of
draft commits (for which we build a cache).  As a temporary workaround,
make it possible to put mutation records in the mutation store that lead to
landed commits.  These will allow land detection to work until we have a
changelog that supports indexing on predecessor.

Reviewed By: quark-zju

Differential Revision: D12980780

fbshipit-source-id: d7b14fa073d0406990b92731fe66dfe1c73b404c
2019-03-08 03:05:57 -08:00
Mark Thomas
2e67ee0c44 templatekw: add mutations template keyword
Summary:
The `mutations` template keyword expands to a list of the results of mutating
the commit.  Each element of the list has an `operation` field, which is a
string describing the mutation operation, and a `successors` field, which is a
list of the successor commits for this operation.  Sequences of mutations that
result in a single successor are collapsed into a single `rewrite` operation.

Reviewed By: quark-zju

Differential Revision: D12980787

fbshipit-source-id: 82be2f9131832209cc3ab088f587c45f8c45a9ad
2019-03-08 03:05:57 -08:00
Mark Thomas
6ce749a3e1 infinitepush: exchange mutation information via infinitepush bundles
Summary:
Include mutation records for all predecessors of the pushed commits in
infinitepush bundles.

When received from infinitepush, store these additional records in the local
store.  This allows us to bridge any gaps in mutation that are omitted from the
local commits when they are received from infinitepush.

Reviewed By: DurhamG, quark-zju

Differential Revision: D12980777

fbshipit-source-id: b1535ca29c0fca3e6cb0f563d78c4c60d4aef58e
2019-03-08 03:05:57 -08:00
Mark Thomas
b059c3a3bf mutation: implement successorssets and foreground
Summary:
Implement successorssets and foreground in terms of mutation records and
replace them when mutation metadata usage is enabled.

Reviewed By: quark-zju

Differential Revision: D10149263

fbshipit-source-id: bbf6d1fc44a9787660147e15936a9ee1951373ca
2019-03-08 03:05:56 -08:00
Mark Thomas
892986d685 mutation: use mutation information for revsets
Summary:
When enabled, use mutation metadata for the `obsolete`, `extinct`, `orphan`,
`phasedivergent` and `contentdivergent` revsets.

Reviewed By: quark-zju

Differential Revision: D10149265

fbshipit-source-id: 5559fa22a6025e1d341538f3eb2257d8efee15e5
2019-03-08 03:05:56 -08:00
Mateusz Kwapich
1f26aa77eb improve githelp for 'rebase -i'
Summary: We have rebase -i, let's mention it.

Differential Revision: D14363798

fbshipit-source-id: 94d3322af8dafd8fc81bfcfc86b61227bec85968
2019-03-07 13:11:28 -08:00
Jun Wu
40044e66d5 tests: remove hgweb, commandserver, and http related tests
Summary:
We don't care about hgweb, or commandserver, or the Python http interface.
Maintaining those low-impact tests for breaking changes have been a pain.
Therefore just remove them, to make upcoming breaking changes slightly easier.

There are also long tests which are written in ways that are very hard to
maintain, namely:

- test-command-template.t
- test-glog.t
- test-revlog.t

We might just rewrite them once we have ideas about what the replacement
APIs are.

Reviewed By: DurhamG

Differential Revision: D14222121

fbshipit-source-id: 5c18f32bb55fb20cf8ccafe1cdd169a4ffaaf5ce
2019-03-07 13:06:29 -08:00
Liubov Dmitrieva
6a40cb0312 infinitepush - better handling changes of the path
Summary:
Unfortunately, Mononoke team needs to rename paths to add the markers everywhere.

They deprecated mononoke url:

ssh://hg.vip.facebook.com//mononoke/fbsource

And they are asking us not to use ssh://hg.vip.facebook.com//data/scm/fbsource url without markers.

We finally agreed to have:

```
infinitepush = ssh://hg.vip.facebook.com//data/scm/fbsource?force_mercurial

infinitepush-other = ssh://hg.vip.facebook.com/data/scm/fbsource?force_mononoke
```

So, we would like that rename of the path don't cause `hg sl` show that nothing is backed up.

We use the path as part of our filename.

So, we will go to the server to check the commits, it might slow down a bit the very first `hg sl` or `pushbackup` after the path change, but it should be acceptable.

Reviewed By: quark-zju

Differential Revision: D14366820

fbshipit-source-id: a0fd7bad530dd6690926fe02d38b93c2a72df00b
2019-03-07 11:01:30 -08:00
Xavier Deguillard
f09d3b816c treemanifest: fix repack and backfilltree
Summary: These 2 commands were broken when treemanifest.treeonly=True was set

Reviewed By: DurhamG

Differential Revision: D14316779

fbshipit-source-id: e626df41c92036fa3bd61c072f09b0d6c99c6f9f
2019-03-05 11:40:46 -08:00
Stanislau Hlebik
48e7592c3e localrepo: fix changed file generation
Summary:
If an executable filenode was reused from p2 and mode hasn't been
changed (i.e. a filenode was executable and it is still an executable after a
merge) and and p1 didn't have this file at all then file will still be listed as
changed just because manifest1.flags(fname) returns ''.

After this diff if a filenode is reused then file will be listed as changed
only if it's a parent from where this filenode was reused have different flags.
So if filenode was reused from p1/p2 and p1/p2 has same flags and new
filenode, then file is not listed. But if filenode was reused from p1 and p1
has different flags, then filenode won't be reused.

It's possible that both new filenode is equal to both p1 and p2. In that case
we'll compare only with p1's mode.

Note that it's only get triggered during pushrebase, because during local
commits `fctx.filenode()` is None

Reviewed By: DurhamG

Differential Revision: D14300214

fbshipit-source-id: 1bf6c4802cfce5db6654da673333a56389432617
2019-03-05 10:53:32 -08:00
Johan Schuijt-Li
fe14359a3b logginghelper: log normalized repo name
Summary:
Filter query strings from logging helper to avoid polluting logging tables with
parameters.

Reviewed By: StanislavGlebik

Differential Revision: D14298421

fbshipit-source-id: fe5d405570ce6f0e16d574b9970b2d526ec8b5c9
2019-03-04 00:05:00 -08:00
Mark Thomas
87da4d2043 infinitepushbackup: always check remote when checking remote backups
Summary:
Currently when checking if a commit is backed up on the server, we assume that
if the local backup state says it is not backed up then the server can't have
it.  However, it's possible for the local repo to have received the commit
from elsewhere even if the backup state says it is not backed up, when in fact
it is.  Make the --remote flag always check with the server, even if the local
state says the commit is not backed up.

Reviewed By: ikostia

Differential Revision: D14279495

fbshipit-source-id: cbd8253c6bfd0ee4cc3f573fabe5b632af7ad569
2019-03-01 10:04:18 -08:00
Durham Goode
1c4bc4c533 treemanifest: don't crash when pushing empty commits
Summary:
When pushing an empty commit, the server receives a pack part with no
data, which ends up not producing any pack files. Some newly added logic tries
to access the pack paths, which then crash.

Let's fix it so we get None for the paths in this situation, and update the only
consumers of those paths to handle the None case.

Reviewed By: quark-zju

Differential Revision: D14237452

fbshipit-source-id: 418bd30179fdb76b9de3bc2c2509079502edfef8
2019-02-27 09:53:16 -08: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
Saurabh Singh
ac86455d22 memcommit: print JSON output for easy consumption by clients
Summary:
The `memcommit` command output will be processed by the calling
process and therefore, let's just output JSON for easy consumption.

Reviewed By: quark-zju

Differential Revision: D14177417

fbshipit-source-id: 541cf73fa2bef20512164b43f1c4224415fba596
2019-02-26 13:16:35 -08:00
Saurabh Singh
5b52bc60d9 memcommit: introduce command to allow making commits without working copy
Summary:
This commit introduces the `memcommit` command to allow creation of
commits without a working copy.

Reviewed By: quark-zju

Differential Revision: D14177415

fbshipit-source-id: 518d29e2fe8fcc7e74d10ec22ebfcd22e136da06
2019-02-26 13:16:35 -08:00
Johan Schuijt-Li
3150d75e47 hgsubversion: fix or silent tests with latest branchmap change
Summary: Same fix as D14210968.

Reviewed By: quark-zju

Differential Revision: D14224459

fbshipit-source-id: 58adb09a7092e5bc2106fe10e409d8bad5581952
2019-02-26 08:44:42 -08:00
Johan Schuijt-Li
15776f6393 hgsubversion: fix or silent tests with latest branchmap change
Summary: Same fix as D14210968.

Reviewed By: lukaspiatkowski

Differential Revision: D14223540

fbshipit-source-id: 952f60fbf71e9b1829a16826b2029c976606cdda
2019-02-26 03:23:08 -08:00
Adam Simpkins
06e4448f19 only print backup status message when backing up
Summary:
Change the message about limiting the number of backup heads to only print
when actually performing a backup.  Previously it was printed by anything that
used the `notbackedup()` revset predicate, which could cause it to be printed
in `hg log` commands in the middle of normal log template output.

e.g.:

  $ hg log -r. --graph -T'{node} {sl_backup}\n'
  @  backing up only recent 50 heads
  |  ffc89f60162956497cd9e8e33798dd1d63ddd1da
  ~

This diff also changes the behavior to print the message to stderr rather than
stdout (using `ui.warn()` instead of `ui.status()`).

Reviewed By: quark-zju

Differential Revision: D14212701

fbshipit-source-id: ef3636850d8149cb0c1931b84b9a5b45e60f89c7
2019-02-25 20:40:28 -08:00
Saurabh Singh
72d929c351 memcommit: introduce extension and debug command for serializing commit
Summary:
This commit introduces the `memcommit` extension along with the
`debugmemcommit` command. The `debugmemcommit` serializes a commit in a format
that is consumable by the command for creating commit i.e `memcommit`
introduced in D14177415. The `debugmemcommit` is mainly for testing purposes.

Reviewed By: quark-zju

Differential Revision: D14177419

fbshipit-source-id: 3a05a210986402f661d7d08902f28fd53f4bdb2d
2019-02-25 18:55:20 -08:00
Jun Wu
304e5c383b push: remove newbranch option
Summary:
`push --new-branch` is very rarely used and it does not make much sense with
checkheads removed (D14179861). Remove it everywhere.

There is still [one user](https://fburl.com/t5hmcxrp) of the
`push --new-branch` flag. Do not remove it just yet.

Reviewed By: singhsrb

Differential Revision: D14212180

fbshipit-source-id: 18f80576ab6464fc36b047a8a35b339231ee9d8e
2019-02-25 17:51:10 -08:00
Stanislau Hlebik
dee75aa345 pushrebase: support deletion of a bookmark in sendunbundlereplay
Summary:
Previously one couldn't use `sendunbundlereplay` to replay a bundle that just
deletes a bookmark i.e. sends only pushkey part. The problem was in that
`bundleoperation.gettransaction` method wasn't called and so a few hook
arguments weren't set.

In order to fix it this diff just calls this method before calling pushkey. The
solution is not clean, but I don't see much better alternatives.

Another smaller change that this diff is doing is changing sendunbundlereplay
command to require `--deleted` flag. This is just for convenience.

Reviewed By: quark-zju

Differential Revision: D14185380

fbshipit-source-id: f511dc0b9906520b7877501b37639d89ada6fc45
2019-02-25 13:08:00 -08:00
Stanislau Hlebik
086e927aab sendunbundle: better process errors
Summary:
We didn't process parts like `error:abort` and so we might have easily missed
an error. This diff fixes it.

Reviewed By: quark-zju

Differential Revision: D14185378

fbshipit-source-id: e68e365fd939a4bd6a0c2835a513ebc94530aa87
2019-02-25 13:08:00 -08:00
Jun Wu
da0b66a8ec copytrace: fix an issue where undesirable entries are reported
Summary:
This solves an issue vipannalla saw that the heuristics logic behaves incorrectly
when running `hg up -C c4a88583; hg graft 23001ead`. The file `great_persons_on_ex_civilization-inl.h`
would be marked as "unresolved" and removed from the working copy potentially
due to other mergedriver actions, while it should be merged cleanly and do not
appear in mergestate at all.

After debugging, the file was only renamed on one side, and not changed on the
other side. In the heuristics code path, the file was reported as copied and
confused the callsite.

Reviewed By: singhsrb

Differential Revision: D14195031

fbshipit-source-id: 0602fd56b75219f851c0175debfe72c4d49d652d
2019-02-25 12:43:20 -08:00
Jun Wu
3f0893c3ab tests: add a test showing suboptimal copytrace + mergedriver behavior
Summary: As explained in the test.

Reviewed By: singhsrb

Differential Revision: D14195032

fbshipit-source-id: 29a19d5ad4abd4a8d77480bd72922b8967a11997
2019-02-25 12:43:20 -08:00
Jun Wu
97755349f5 hgsubversion: fix or silent tests with latest branchmap change
Summary:
This is probably not the proper fix but we're getting rid of svn too.

Remove tests coupled with named branches. Modified some critical tests (ex.
"push") so they can still pass.

Reviewed By: DurhamG

Differential Revision: D14210968

fbshipit-source-id: 62e02179b0e4745db8f90f718613afad42d7376a
2019-02-25 11:23:56 -08:00
Saurabh Singh
45971b1eb7 branchcache: fix the tests after removal of branch cache
Summary:
It seems these tests were not updated while fixing the branch cache.
This commits updates the test to address the test failures.

Reviewed By: quark-zju

Differential Revision: D14208936

fbshipit-source-id: 6ec741886a2ef8da0feb294847757d3ae94b36ee
2019-02-25 09:18:41 -08:00
Mark Thomas
9a19e06fee strip: move extension to core and rename to debugstrip
Summary:
Move the strip extension to core.  Rename the command to `hg debugstrip` as it
is not intended for use by users.  Users should use `hg hide` instead.

Reviewed By: quark-zju

Differential Revision: D14185822

fbshipit-source-id: ef096488cb94b72a7bb79f5bf153c064e0555b34
2019-02-25 03:55:08 -08:00
Mark Thomas
cb47493670 commitcloud: accept cloud bookmarks for hidden commits
Summary:
When receiving cloud bookmarks, if they point to a hidden/obsolete commit,
don't omit them.  The bookmark will make the commit visible again.

Reviewed By: quark-zju

Differential Revision: D14183009

fbshipit-source-id: ddcb8cce6aaa1eefae93490f76c3dffeaffda21c
2019-02-25 02:34:50 -08:00
Jun Wu
bfaf19a6a8 fetch: remove the extension
Summary:
`fetch` is a deprecated extension. It uses non-trivial branch-related logic.
Drop it to unblock further branch related cleanups.

Differential Revision: D14180593

fbshipit-source-id: 8288a7f0ac1ba72cf476cb78f109c71aa11c92c0
2019-02-22 21:02:42 -08:00
Jun Wu
56338d7005 branchmap: drop revbranchcache and other unused logic
Summary:
They're no longer used. Drop them. The `branchcache` is still somehow used,
although it's basically equvilent to `{"default": heads}`.

We can probably clean it up further after detached from subversion.

Reviewed By: singhsrb

Differential Revision: D14180592

fbshipit-source-id: 45230d486f203bf3f55e89ce9eb89e6855e14e54
2019-02-22 21:02:41 -08:00
Jun Wu
b8eecfa308 streamclone: drop branchmap code
Summary: It's a no-op already. Drop it.

Reviewed By: singhsrb

Differential Revision: D14180595

fbshipit-source-id: 9f904b818bcf56b9d12405ca9894baa9c786801b
2019-02-22 21:02:41 -08:00
Jun Wu
e188aff028 revset: make "branch(x)" equvilant to "all()"
Summary:
All commits belong to `default` branch. Therefore `branch(x)` can be seen as
just `all()`, assuming `x` is a valid name.

This removes the only user of `repo.revbranchcache`.

In a later step, branch related features will be moved to an extension so the
code becomes separate and features are optional.

Reviewed By: sfilipco

Differential Revision: D14180594

fbshipit-source-id: 9dc52743f1b69a1838114c8c0de5fc69383dc41e
2019-02-22 21:02:41 -08:00
Jun Wu
66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00
Jun Wu
d30f175cde test-treediscovery: remove the tests
Summary:
The tests are about HTTP bundle1 support, which is not an environment we care
about. They will break in a way that is non-trivial to fix with the upcoming
branchmap removal. There is little value keeping them. So let's just remove the
tests.

Reviewed By: sfilipco

Differential Revision: D14179859

fbshipit-source-id: 09392bb2e5c0aebc30e584ed3a6593b0b2a81089
2019-02-22 21:02:41 -08:00
Jun Wu
9c13621dea test-hgweb-non-interactive: remove the test
Summary:
The WSGI parameter part gets changed with the upcoming branchmap removal.
We don't have resources to maintain WSGI for now, so let's just remove the
test.

Reviewed By: singhsrb

Differential Revision: D14179860

fbshipit-source-id: b2b82f7658a754caece220fa5f80d15514dd9260
2019-02-22 21:02:41 -08:00
Jun Wu
850022dd70 convert: drop cvs support
Summary:
The CVS branch support will break with the upcoming branchcache removal.
CVS repos are rare. Let's just remove the code.

Differential Revision: D14179863

fbshipit-source-id: 890ce34958d2efe4f2ef02b1d72cf92f6269378c
2019-02-22 21:02:41 -08:00
Jun Wu
047b1a05f4 exchange: kill checkheads
Summary:
We had `ui.checkheads=false` set for a long time. Let's remove the feature
entirely and update the tests.

This is necessary before killing the branch cache, as some tests still use
different branches and there would be suddently more "heads" that cause
test issues.

Reviewed By: sfilipco

Differential Revision: D14179861

fbshipit-source-id: 0de76566799a9560b45e823cc5f49cfda9e3dd30
2019-02-22 21:02:41 -08:00
Jun Wu
581f379320 tests: remove tests about checkheads
Summary:
The checkheads feature is being removed. See D8148016 for details.
This diff just removes tests with "checkheads" in their names.

Reviewed By: sfilipco

Differential Revision: D14179862

fbshipit-source-id: abd5bb26c0d92276273bef7ea93096ca3fde95dc
2019-02-22 21:02:41 -08:00
Johan Schuijt-Li
877d1315da treemanifest/remotenames: use write path for reads after push
Summary:
Treemanifest uses it's own fallbackpath for reads in all cases, but
particularly in the case of remotenames it should stay on the path that is
actively being used by the push. It is possible to have remotenames which are
mirrored and selected by query strings in the repo path. In this case it is
possible that the mirror is still out of date when reading back data from our
push. Ensure that when doing a push the remote server this is considered
'sticky' so that we read back from the remote we pushed to, rather then
determening the path ourselves.

To disable, please use:
  treemanifest.stickypushpath=False

Reviewed By: DurhamG, markbt, quark-zju

Differential Revision: D14165444

fbshipit-source-id: 75a53ffab895d87a4c52814f7887145c134868b5
2019-02-22 06:03:18 -08:00
Stanislau Hlebik
8922f8a4b1 hook: make it possible to record stderr of failed python hooks
Summary:
Context: in pushrebase replay job we run on Mononoke we also want to test our
hooks i.e. replay pushrebase requests that were denied on mercurial because of
a hook failure. The problem is that at the moment the only error message we have
is `prepushrebase.driver hook failed` (see xdb table `xdb.mononoke_production`,
query `select * from pushrebaserecording where pushrebase_errmsg like '%hook%'
limit 10;`). This error message tells us nothing, not even what hook failed.

To change it I suggest to make it possible for python hooks to raise HookAbort
and provide more information in the `hook_failure_reason` field.

Reviewed By: quark-zju

Differential Revision: D14131359

fbshipit-source-id: 69a2b51b30c78efadf3ba0d3332f46a777022568
2019-02-22 05:10:46 -08:00
Liubov Dmitrieva
db6d74a622 pushbackup - add a message when we truncate heads that needs to be backed
Summary: In chef there is currently an override to 50, so if someone got more due to some reason, it is nice to add a message.

Reviewed By: quark-zju

Differential Revision: D14170749

fbshipit-source-id: 3f3c79e4e6103523c14c8d9c1600f104e3d5d3d8
2019-02-21 20:27:32 -08:00
Stanislau Hlebik
ddd0f0ed99 mononoke: mononoke -> hg sync job
Summary:
First stab at a job that will keep hg in sync with Mononoke when Mononoke
becomes a source of truth.

Reviewed By: ikostia

Differential Revision: D14018269

fbshipit-source-id: f88c5eba8bf5482f2f162b7807ca8e41a3b4291d
2019-02-21 05:46:40 -08:00
Stanislau Hlebik
e36da58ac9 pushrebase: fix choosing commit timezone
Summary: There was a typo, the timezone is `[1]` and not at `[0]`

Reviewed By: ikostia

Differential Revision: D14147329

fbshipit-source-id: 8ad4bff810ed949a9f8e86d03ef62bc63aaf11bd
2019-02-21 00:59:13 -08:00
Jun Wu
f6c3848463 commands: remove more branch related CLI flags
Summary:
Remove:
- log --only-branch
- pull --branch
- push --branch
- record --close-branch
- incoming --branch
- outgoing --branch

Currently, `log --branch` is kept since some arcanist code still uses it.
We can probably remove it after the next arcanist release.

Differential Revision: D14116320

fbshipit-source-id: 50960ae8700200b322f615c4defd9c05353c2435
2019-02-20 20:05:29 -08:00
Jun Wu
2dc2a3d2a2 dispatch: do not show help on CommandError
Summary:
CommandError happens if there is an unknown command flag, or a required
argument is missing. The old behavior is to print an error message to
stderr, then start the pager with the command help printed to stdout.

There are 2 problems with that approach:
1. When using mosh, a long help text might flush the actual error to out of the
   screen. The error message will be missed.
2. When captured in shell scripts, the help text printed to stdout would be
   captured, which is almost always undesirable.

The actual motivation of this change is for 2. Zsh themes like bullet-train [1]
uses `hg id -b 2>/dev/null` and we'd like to remove `id -b` support. After that,
the command should not polluate stdout with help text.

[1]: bd88ade263/bullet-train.zsh-theme (L102)

Differential Revision: D14151200

fbshipit-source-id: edd38e91115f96929438379aa2e40edfba560b41
2019-02-20 18:44:35 -08:00
Jun Wu
fba42ecd00 mergedriver: handle queueremove correctly
Summary:
It's possible that the non-mergedriver code path decides to create ("get") a
file, because it only exists in one side of the merge parents, while
mergedriver decides to remove that file. That makes the file exist in both
"g" (get, aka. create) and "r" (remove) lists and result in incorrect
dirstate state.

Fix it by detecting the case and remove the conflicted files from the "g" list.

Reviewed By: DurhamG

Differential Revision: D14145990

fbshipit-source-id: f4e5d9787dca5cda6cae270f8a84296ecddf553c
2019-02-20 18:11:33 -08:00
Jun Wu
1321ab12f9 mergedriver: add a test showing suboptimal behavior
Summary:
vipannalla encountered an issue that his mergedriver code does not know the
complete list of files to "driver-resolve" at the "preprocess" step.

When doing "queueremove" files from one-side in the "conclude" step, the
dirstate would have "!" state afterwards.

Add a test to show that.

Reviewed By: DurhamG

Differential Revision: D14145989

fbshipit-source-id: e316aedea3359260dfbf7578a332f87b99fb37f9
2019-02-20 18:11:33 -08:00