Commit Graph

3580 Commits

Author SHA1 Message Date
Stanislau Hlebik
93cabcd26e infinitepush: add reponame to WHERE clause
Summary:
Since reponame is part of the primary key, it also makes sense to add it to
WHERE clause. Otherwise query may trigger full table scan and it can be very
slow.

Test Plan: Run unittest

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D1256
2017-11-02 13:24:53 -07:00
Jun Wu
09af39ffe1 check-ext: ignore pyc files
`.pyc` files could cause false positive. Scan `.py` and `.pyx` files
explicitly.

Test Plan:
Make sure `uncommit.pyc` will not break check-code but `uncommit.pyx`,
`uncommit.py` will.

Differential Revision: https://phab.mercurial-scm.org/D1283
2017-11-02 12:00:11 -07:00
Jun Wu
47b9325724 restack: use multidest rebase to implement restack
With the multidest rebase (D470), restack could be implemented as specifying
the source (`orphan() - obsolete()`) and a revset specifying destination for
each source revision.

This patch changes restack implementation to use that. The revset is
implemented as a private function `_destrestack`, like `_destrebase` in
`rebase.py`.

Most test changes are because the topo-sort in `rebase.py` removes some
unnecessary steps. So the resulting revision numbers are smaller.

There is one interesting test case that gets changed:

```
    D
    |      # amend: B1 -> B2 -> B1
 B2 B1 B3  # amend: B1 -> B3
  \ | /
    A
```

Previously, restack will move D to be on top of B3. Now restack will not
move it because `D` is considered stable (not orphaned) since none of its
ancestors are obsoleted. The new behavior seems to be more desirable.

More tests are added to test restack source revisions (should be in a same
stack) and some "prune" cases.

The transaction logic is also made more robust so `test-copytrace-amend.t`
does not cause a broken rebase state.

Since the rebase operation runs in a same rebase state, restack can be
continued via `rebase --continue` correctly after resolving merge conflicts.
This is reflected in a newly added test.

Test Plan:
With hg-dev, run `./script/unit.py`

Differential Revision: https://phab.mercurial-scm.org/D1139
2017-11-02 11:54:31 -07:00
Durham Goode
8ab92efa9a tests: fix check code 2017-11-02 10:37:38 -07:00
Simon Whitaker
10200ac057 tests: handle case in test-remotefilelog-clone.t where output is out of order
test-remotefilelog-clone.t is flaky, and fails sporadically as follows:

     $ hg clone --noupdate ssh://user@dummy/shallow full
     streaming all changes
  +  abort: unexpected response from remote server: empty string
     remote: abort: Cannot clone from a shallow repo to a full repo.
  -  abort: unexpected response from remote server: empty string
     [255]

The issue happens because the line starting "abort" and the line starting
"remote: abort" come from different processes, and there's no way to
guarantee the order in which they are output.

This change attempts to address the issue by capturing the output of the
local process and examining it separately.

Test Plan:
rt test-remotefilelog-clone.t

Differential Revision: https://phab.mercurial-scm.org/D1279
2017-11-02 14:29:03 +00:00
Simon Whitaker
ae59d3ef08 tests: fix test-tweakdefaults-update.t test failures
Test Plan:
rt test-tweakdefaults-update.t

Differential Revision: https://phab.mercurial-scm.org/D1284
2017-11-02 14:11:25 +00:00
Durham Goode
0332f82cce treemanifest: support readdelta in fastmanifest
If we were using fastmanifest in a treeonly repository, hg show would try to
access the manifest delta via the revlog which would crash. The fix is to make
fastmanifest first try accessing the data via the tree, before falling back to
the delta.

My attempts at automatically testing this failed, but I had a repro in a real
repository and confirmed this fixed the issue.
2017-11-01 17:10:05 -07:00
Durham Goode
712de93f88 treemanifest: catch remote output during tree fetching
There was a flakey test because the remote stderr output was getting eaten part
of the time. This fixes it by capturing all the output and then sending it to
stderr manually.

Tested it by running all the tests in parallel multiple times and not seeing the
issue anymore.

Also we now send that output to the debug output. We're already throwing a more
useful error message, so let's hide the noise.

Differential Revision: https://phab.mercurial-scm.org/D1276
2017-11-01 17:10:05 -07:00
Durham Goode
d6440bad3c treemanifest: test for pulling normal scratch branch into treeonly repo
Adds a test and improves output for dealing pulling a normal scratch branch into
a treeonly repo (so the manifest doesn't exist).

In the future we could fix this by having the server generate the trees on the
fly for infinitepush branches that don't already have them.

Differential Revision: https://phab.mercurial-scm.org/D1268
2017-11-01 17:10:05 -07:00
Durham Goode
0ea3abac80 infinitepush: send treepack parts with the client push
This makes the client side pushes also include tree packs in the push.

Also adds a test to see that the tree parts round trip between two tree-only
clients.

This was reverted in D921 because clients couldn't push old non-tree commits to
infinitepush anymore. I've fixed the issue and added a test to this commit.

Differential Revision: https://phab.mercurial-scm.org/D1017
2017-11-01 17:10:05 -07:00
Durham Goode
5f4f65474d treemanifest: update test for pushing a treeonly commit to a server
The old version of this test relied on the sendflat config being set to false so
it would only send the trees. Since that config is gone, the test then started
sending flat manifests, so it wasn't actually testing what it should've been.

This patch fixes that by making it push a tree only commit and ensuring the
commit hook executes correctly. The test changed a bit, because the hash changed
after the push, because it was a tree only commit on the client (and therefore
used the tree hash) but a hybrid commit on the server (and therefore used the
flat hash).

Differential Revision: https://phab.mercurial-scm.org/D1267
2017-11-01 17:10:05 -07:00
Durham Goode
2f95e6e9ca treemanifest: remove sendflat config
Previously the sendflat config decided if we should send flat manifests or not.
To reduce the number of config permutations we have to handle, let's change the
code to always send the flat manifests, if it exists.

Differential Revision: https://phab.mercurial-scm.org/D1266
2017-11-01 17:10:05 -07:00
Durham Goode
df82fc6557 treemanifest: remove sendtrees
Previously we were relying on config values to determine when to send or not
send tree and flat manifests. This resulted in complicated permutations to test.
Let's remove these config values and always send trees if we have them. A future
patch will do the same for flat manifests.

Differential Revision: https://phab.mercurial-scm.org/D1265
2017-11-01 17:10:05 -07:00
Phil Cohen
348cd43ceb basepack: also log total size of packs on init
This data might be useful too.

Move to _getavailablepackfiles so refresh() picks it up too.

Differential Revision: https://phab.mercurial-scm.org/D1281
2017-11-01 12:55:36 -07:00
Jun Wu
0dd78513e8 rage: fix undefined sparse 2017-11-01 12:11:34 -07:00
Jun Wu
1f82a67648 sparse: fix check-config
Accessing `extensions.fbsparse` also needs to be documented.
2017-11-01 12:11:34 -07:00
Jun Wu
585aa1ca7a rage: import fbsparse instead
Similar to D1048, let's use fbsparse to avoid name collision.

Differential Revision: https://phab.mercurial-scm.org/D1274
2017-11-01 11:49:13 -07:00
Jun Wu
9508f2cf2c sparse: disable automatically when fbsparse is detected
There are some places that both fbsparse and sparse are enabled. To help
them migrate smoothly, let's disable sparse automatically if fbsparse is
detected.

Test Plan:
Run:

  hg --config extensions.fbsparse --config extensions.sparse= sparse -h

Make sure it does not complain about:

  extension 'sparse' overrides commands: ^sparse

Differential Revision: https://phab.mercurial-scm.org/D1273
2017-11-01 11:49:13 -07:00
Jun Wu
4f2096a46a hiddenoverride: work with scmutils.cleanupnodes
Previously, hiddenoverride only unpins nodes when createmarkers gets called.
However, with scmutils.cleanupnodes, createmarkers will not get called when
the nodes are already obsoleted. This patch makes hiddenoverride check
cleanupnodes too to unpin nodes properly.

Differential Revision: https://phab.mercurial-scm.org/D994
2017-11-01 11:49:13 -07:00
Jun Wu
aff5472dda hiddenoverride: add a test demonstrating an visibility issue
The last `uncommit` should make `B` invisible. This is from a user report.

Differential Revision: https://phab.mercurial-scm.org/D993
2017-11-01 11:49:13 -07:00
Jun Wu
05dc0ce236 cdatapack: print path on error
This gives us more context about what pack file is problematic. It's useful
to detect issues like mmapping a 0-sized file.

Test Plan:
Make sure the code compiles without warnings. Run related tests.

```
  make local
  rt test-cstore.t
```

Make sure `setup.py` specifies C99 so variable length array is available.

Differential Revision: https://phab.mercurial-scm.org/D1125
2017-11-01 11:49:13 -07:00
Jun Wu
28b15048a1 sampling: do not log less interesting "uiblocked" fields
We got `alias_*_blocked` and `unknown_system_*` logged which bloated the
table. Since we are not using them, let's just remove them from logging.

Differential Revision: https://phab.mercurial-scm.org/D1064
2017-11-01 11:49:13 -07:00
Phil Cohen
d50df65291 basepackstore: log the number of packs on initialization
This way we could get a handle on how many packs users are contending with.

Note that this location is unsatisfactory because we have so little metadata
available -- it'd be nice to denote type of store (data, history), type of
content (data, trees), and location of store (local, cache). Perhaps callers
could pass these keys to the constructor.

Differential Revision: https://phab.mercurial-scm.org/D1280
2017-11-01 11:32:17 -07:00
Maxime Montinet
f21203a7a7 infinitepush: fix test that broke test build
Summary:
Use python instead of jq in pullbackup test
fixes breakage reported in D6186148

Test Plan:
Run unit tests
Verify build runs without a hitch

Reviewers: swhitaker

Differential Revision: https://phabricator.intern.facebook.com/D6208705
2017-11-01 07:56:44 -07:00
Pulkit Goyal
decf98e505 fold: add support to get json output for node changes
This patch adds support to fold for outputting node changes as a part of it's
json output.

The nodechanges is a dictionary having predecessor as key and list of successors
as value. The successor is a list as we can have multiple successor for a
predecessor in case of split and having a generic format will be helpful.

After this patch, if you want json output from fold, do
  `hg fold ..args.. -Tjson -q`

To just get the dictionary of hash changes, do
  `hg fold ..args.. -T '{nodechanges|json}' -q`

-q is required to prevent the ui.status output coming from hg.update and rebase
part.

Since we have added support to fold for nodechanges, it has been added to
blacklist for cleanupnodes wrapper in tweakdefaults.

Differential Revision: https://phab.mercurial-scm.org/D1041
2017-10-31 13:22:06 -07:00
Pulkit Goyal
76f68acbf1 fold: start using formatter to print output
Differential Revision: https://phab.mercurial-scm.org/D1040
2017-10-31 13:22:06 -07:00
Pulkit Goyal
81504ddb45 fold: use context manager for locks and transaction
Differential Revision: https://phab.mercurial-scm.org/D1174
2017-10-31 13:22:06 -07:00
Durham Goode
2857c2351f tests: fix lint 2017-10-31 13:20:03 -07:00
Pulkit Goyal
0e479f3794 pushvars: move config setting in tweakdefaults and drop the extension
The logic of pushvars extension was moved to core and the extension here just
used to set a config which defaults to False in core. Let's move that config
setting to tweakdefaults and drop the extension.

Differential Revision: https://phab.mercurial-scm.org/D1275
2017-11-01 01:41:55 +05:30
Maxime Montinet
ae3b7f2364 infinitepush: prevent hg pullbackup from doing an automatic backup
Summary:
Instead of making an autobackup, make hg pullbackup simply
write the backup state from the recently restored backup.

Test Plan:
cd ~/facebook-hg-rpms/fb-hgext/tests
source ../../hg-dev
rt test-infinitepush-*.t

Reviewers: #mercurial, cdown, stash

Reviewed By: stash

Subscribers: mjpieters, medson

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

Tasks: T22856338

Tags: bootcamp

Signature: 6186148:1509457565:e66cefc6e95d9b1cfb91e9bf8fa5c40b05e4fb82
2017-10-31 07:00:31 -07:00
Phil Cohen
9d8a77b7df tests: remove the unused blacklist-sqldirstate file
Differential Revision: https://phab.mercurial-scm.org/D976
2017-10-30 20:56:08 -07:00
Phil Cohen
bef53b0ff4 rage: include contents of packdirs
Example output:
```
shared packs (files):
---------------------------
/var/cache/hgcache/fbsource/packs:
total 64K
drwxrwsr-x. 2 phillco svnuser 36K Oct 26 14:09 manifests
...

shared packs (trees):
---------------------------
/var/cache/hgcache/fbsource/packs/manifests:
total 741M
-r--r--r--. 1 phillco svnuser 1.8K Oct  9 00:37 0a0d759b468bf3766b1596d133d7dcf5c55db702.dataidx
-r--r--r--. 1 phillco svnuser  77K Oct  9 00:37 0a0d759b468bf3766b1596d133d7dcf5c55db702.datapack
-r--r--r--. 1 phillco svnuser  33K Oct  9 12:54 0b233c54960ad32a75238334b18bdb8176b95dae.dataidx
-r--r--r--. 1 phillco svnuser 1.7M Oct  9 12:54 0b233c54960ad32a75238334b18bdb8176b95dae.datapack
-r--r--r--. 1 phillco svnuser  74K Oct  8 23:40 0b33a64b257bee2583ded9d38f13404f52a33670.dataidx
...

local packs (files):
---------------------------
/data/users/phillco/fbsource/.hg/store/packs/:
total 856K
drwxrwsr-x. 2 phillco svnuser 856K Oct 26 14:14 manifests


local packs (trees):
---------------------------
/data/users/phillco/fbsource/.hg/store/packs/manifests:
total 27M
-r--r--r--. 1 phillco svnuser 1.2K Oct  3 13:37 000004931915fa871abb373503d0e8656f543d59.dataidx
-r--r--r--. 1 phillco svnuser 4.4K Oct  3 13:37 000004931915fa871abb373503d0e8656f543d59.datapack
-r--r--r--. 1 phillco svnuser 1.2K Oct  3 13:34 0009e3182c6268d64a3c6d9cb79ba74a0f5e3fa2.dataidx
-r--r--r--. 1 phillco svnuser 3.1K Oct  3 13:34 0009e3182c6268d64a3c6d9cb79ba74a0f5e3fa2.datapack
...
```

Differential Revision: https://phab.mercurial-scm.org/D1261
2017-10-30 20:48:06 -07:00
Durham Goode
f64fb99447 pushrebase: fix support for tree manifests
pushrebase can't use the standard rev.manifest() or rev[filepath] accessors
because they aren't aware of treemanifests. Let's refactor our manifest and
filectx accessor patterns into a separate function and use it in the two places
that need manifests.

test-treemanifest-server.t was failing before this. One test was modified
because the does-it-have-the-tree check is now done earlier, before the lock is
taken, so we abort before the output is printed.

Differential Revision: https://phab.mercurial-scm.org/D1251
2017-10-26 14:29:55 -07:00
Durham Goode
0ea8bce203 pushrebase: update fastmanifest test
This test looked like it's been funky since it was introduced. It harded code
an exception from a bug.  The bug was that we're storing bundle manifests in a
cache during pushrebase, and because those manifests are hybrid manifests they
haven't actually loaded from disk. Later we close the bundle, then after that we
try to access these cached manifests, which throws because they can't read from
the file.

The recent change to read the copied files from the manifest before the lock is
taken, forces these manifests to be in loaded, thus fixing the problem. So let's
update the test.
2017-10-26 13:40:59 -07:00
Mark Thomas
7098f7d4b5 pushrebase: check sources of renames when looking for conflicts
When checking the bundle contents against the revisions it is being rebased
over, include the sources of renames, as changes made in those files also
conflict with the bundle.

Differential Revision: https://phab.mercurial-scm.org/D1199
2017-10-26 02:47:39 -07:00
Phil Cohen
8b5727a6d0 tests: fix missing entry in test-merge-conflictinfo.t 2017-10-25 22:25:24 -07:00
Phil Cohen
ca7d60b943 conflictinfo: add more information about the conflict-causing command
In the old version of this extension it was too difficult to determine how to
resume or abort the command that generated conflicts. Let's add that
information so consumers can programatically continue or abort.

Differential Revision: https://phab.mercurial-scm.org/D713
2017-10-25 22:20:32 -07:00
Kyle Lippincott
8d138fe9ce basepack: do not keep fd open
Once `mmap` succeeded, it's no longer necessary to keep the underlying fd
open. Therefore just close them as an attempt to reduce file descriptors
opened by the process.

This is similar to 592c614a259f, but on the pure python side.
2017-10-25 17:02:48 -07:00
Mateusz Kwapich
0db7fe6449 crdump: fix the binary file dumping on windows
Summary:
Stupid bug corrupted files with extra \r on windows.

From python manual:



>On Windows, 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for ASCII text files, but it’ll corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files. On Unix, it doesn’t hurt to append a 'b' to the mode, so you can use it platform-independently for all binary files.


Test Plan: the crdump tests should now pass on windows as well (didn't actually run them on Windows because I don't really know how)

Reviewers: #mercurial, rmcelroy, ikostia, medson

Reviewed By: medson

Subscribers: mjpieters, medson

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

Tasks: T23027803

Signature: 6151931:1508964509:65806961cbde26884cd45def17767135ceeac05f
2017-10-25 13:59:24 -07:00
Kostia Balytskyi
a3dca2b53f test-merge-conflictinfo: include expected failures according to sid's hotfix 2017-10-24 17:54:02 -07:00
Durham Goode
13b21a28eb configs: remove config defaults for registered configs 2017-10-24 17:54:02 -07:00
Stanislau Hlebik
be4f75067d infinitepush: fix tests
In 272dd7d8a1bb1b2e93697b5b65183b08c8bf0853 upstream hg commit phase pushes
started to use separate bundle2 part. Because of that:
1) pushkey hook is not called when updating phases.
2) pushkey bundle2 part doesn't process phases anymore, 'phase-heads' part do
it instead.

It caused breakages in infinitepush, because phases handling is not skipped even during
infinitepush.  This diff fixes it.

Test Plan:
Run infinitepush tests

Differential Revision: https://phab.mercurial-scm.org/D1225
2017-10-24 09:33:41 -07:00
Durham Goode
29bb657526 tests: fix fastmanifest tests
Changing the config defaults to be part of the config registrar caused the unit
tests to fail (since they don't load the registrar).
2017-10-23 20:13:13 -07:00
Durham Goode
f260c80298 configs: register more of our configs
Upstream has added devel warnings that require us to register all the configs
and remove the defaults that are specified at read time. This doesn't fix all
the cases, but is the start.

Differential Revision: https://phab.mercurial-scm.org/D1206
2017-10-23 20:02:57 -07:00
Durham Goode
6db0ad3d03 config: rename allowdivergence to evolution.allowdivergence
Upstream has renamed this config. Since the old config name was still an alias
for the new name, it was technically only breaking the test output where we
hardcoded the config name in the output. But I went ahead and updated every
place anyways.

Differential Revision: https://phab.mercurial-scm.org/D1209
2017-10-23 19:31:43 -07:00
Durham Goode
7600b6f0d5 smartlog: fix wrapping of _show
Upstream has added a new parameter, so let's wrap it more generically.

Differential Revision: https://phab.mercurial-scm.org/D1207
2017-10-23 19:31:43 -07:00
Saurabh Singh
4285fc47b4 repack: fix the hg executable location for background repack
Summary:
The background repack uses the incorrect executable while running the
repack command due to which there are no logs for the background repack. This
commit fixes that by specifying the correct executable.

Test Plan:
  - Ran all the tests.

  - Tested the output of `util.hgexecutable()` with system hg and chg, and
    verified that it returns the correct path. As expected, `util.hgcmd()`
    returns the corresponding path for hg and chg in this case.

  - Did a `hg pull` on one of the repos and verified that it triggered a
    background incremental repack.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D1221
2017-10-23 16:50:46 -07:00
Stanislau Hlebik
808ae58590 pushrebase: handle pushing phases through separate bundle2 part
In 272dd7d8a1bb1b2e93697b5b65183b08c8bf0853 upstream hg commit phase pushes
started to use separate bundle2 part. Because of that:
1) pushkey hook is not called when updating phases.
2) pushkey bundle2 part doesn't process phases anymore, 'phase-heads' part do
it instead.

It caused breakages in pushrebase. This diff fixes it.

Test Plan:
Run tests test-pushrebase*  and test-treemanifest*

Differential Revision: https://phab.mercurial-scm.org/D1204
2017-10-23 10:36:16 -07:00
Stanislau Hlebik
1eebe223d0 tests: register some config options
Previously test-treemanifest-treeonly.t was hanging. Now it doesn't hang (but
still fails).

It obviously doesn't fix the real issue, but at least it doesn't make test
hang.

Test Plan:
Run test-treemanifest-treeonly.t

Differential Revision: https://phab.mercurial-scm.org/D1205
2017-10-23 10:07:38 -07:00
Jun Wu
ef11eb995c test-pushrebase: add a test case about modifying copy source
This is what happened to D1048 and D1050. Pushrebase should ideally check
the copy source in additional to modified files and block the push.

Differential Revision: https://phab.mercurial-scm.org/D1172
2017-10-20 17:15:01 -07:00