Commit Graph

721 Commits

Author SHA1 Message Date
Durham Goode
75008a9386 pushrebase: fix manifest cache
The manifestctx constructor changed at some point in the past to take a
manifestlog and a node instead of a repo and a node. The pushrebase cache code
wasn't adjusted for this. Luckily the manifestctx object only ever uses the
manifestlog to look at the revlog, and the revlog is only ever used to look at
the delta as a fastpath, so most code paths weren't affected.

We encountered this issue on our server, despite it being in there for several
months. Unfortunately I wasn't able to repro it in a test, but I did insert
manual manifestctx._revlog() lines after the construction to ensure that the
revlog can now be created, versus crashing before.

Differential Revision: https://phab.mercurial-scm.org/D1439
2017-11-21 06:58:11 -08:00
Durham Goode
02afbac4e7 treemanifest: use a connectionpool
remotefilelog and fastannotate already use a connection pool to share and reuse
connections. Treemanifest often does ondemand downloading of trees, such as
during hg log -p, and would greatly benefit from reusing connections as well.

This patch makes the connectionpool and attribute of the repo object, instead of
the fileserverclient object, which allows treemanifest to make use of it easily.

Differential Revision: https://phab.mercurial-scm.org/D1454
2017-11-21 06:52:51 -08:00
Kostia Balytskyi
818f7dee74 tweakdefaults: make util.popen4 input buffer size configurable on Windows
Summary:
This allows us to worry less about deadlocks and be more efficient in our
piped communications (like in fileserverclient.py, for example).

We can also make sure that deadlocks just plainly can't
happen by only writing a known amount of bytes to the pipe.

Test Plan:
- does not seem to break any additional tests on Linux

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1436
2017-11-20 17:02:04 -08:00
Jun Wu
d393146974 sparse: try reading from working copy first
Previously sparse will resolve working file context via its parent
unconditionally if the file is outside sparsematch (introduced by D788).
That could be problematic if the file only exists in working copy.

This patch changes it to always try working copy first (fast), then fallback
to parent commit if the file is outside sparse.

Differential Revision: https://phab.mercurial-scm.org/D1464
2017-11-20 13:56:55 -08:00
Durham Goode
792cc88a63 fbamend: disable --to
We've received multiple reports that the command is broken. Let's disable it for
now.

Differential Revision: https://phab.mercurial-scm.org/D1465
2017-11-20 13:17:44 -08:00
Durham Goode
6334199a3a fbsparse: use unfiltered repo in many places
Computing the hidden commits was showing up as a hot spot in hg status because
hg sparse was accessing the changelog through a filtered repo. This probably
affects many other commands since sparse touches so many places. Since it has no
need to use a filtered repo, let's just have it use unfiltered.

This shaved off 25-30% of the hg status time in some circumstances.

Differential Revision: https://phab.mercurial-scm.org/D1437
2017-11-20 06:40:41 -08:00
Andrew Gallagher
ab16183253 hgext3rd: fix build on aarch64
Summary: On aarch64, use `rdtsc` equivalent.

Test Plan: built on aarch64

Reviewers: durham, rmcelroy, tracelog, phillco, quark

Reviewed By: tracelog, quark

Subscribers: medson, mjpieters

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

Tags: aarch64

Signature: 6368688:1511039472:9b26a569ca1f185d6652ac8fb0c3c5a5d306b0cc
2017-11-19 19:01:57 -08:00
Jun Wu
18decd87e0 clindex: wrapper for future changelog index overrides
This extension is a thin wrapper around the native `changelog.index` object
that allows us to incrementally replace its methods. Since some index
methods (ex. `nodemap.__getitem__`) are called very frequently, Cython
features are used intentionally to avoid overhead. This also makes it easier
to integrate logic with C interface in the future.

As a side effect, this patch enforce `index` to be conceptually separate
from `nodemap`. So `changelog.index[node]` could be made illegal in the
future, which seems to be a good thing.

Test Plan:
Run `hg sl` with and without the extension in a large repo. Check traceprof
outputs. Notice the performance difference around index methods are roughly
10%, which seems acceptable:

Without the extension:

   25      \ node (4823 times)                  changelog.py:361
   18       | node (4931 times)                 revlog.py:631

With the extension:

   27      \ node (4823 times)                  changelog.py:361
   19       | node (4931 times)                 revlog.py:631

Also run `rt --extra-config-opt=extensions.clindex=` from core hg and make
sure changes are all caused by having an extra extension enabled.

Differential Revision: https://phab.mercurial-scm.org/D1353
2017-11-16 21:28:42 -08:00
Durham Goode
6d828d5621 lint: fix lint errors 2017-11-16 10:08:05 -08:00
Wojciech Lis
e6e8b252f8 Using workers in lfs prefetch
Added workers in lfs.
I had to remove the fine progress tracking because between processes in *nix and threads in windows (diffs will appear soon) the tracking of 1MB progress is quite tricky.
With our network tracking progress per file is way enough to see things moving.

This change gives close to 50% speedup on hg sparse --enable-profile when prefetch is run. My current understanding is that prefetch is ran when profile is enabled for the first time.

Test Plan:
Enable profile:
time hg sprase --enable-profile SparseProfiles/TestProfile.sparse
The profile contains 42k files including 9GB of lfs files
On my machine the time improves by 47% while still being dominated by lfs
download time

# Tip: In Git and Mercurial, use a branch like "T123" to automatically associate
# changes with the corresponding task.

Differential Revision: https://phab.mercurial-scm.org/D1424
2017-11-16 06:43:14 -08:00
Phil Cohen
5740873245 rage: sort packs by size
This makes it easy to see if there are realy big packfiles.

Differential Revision: https://phab.mercurial-scm.org/D1422
2017-11-14 21:32:54 -08:00
Phil Cohen
baa9059871 pushrebase: make conflict message a bit more helpful
A very minor change, but we should probably explain that local rebasing is
needed. (You might be forgiven for thinking that `pushrebase` would have
done that for you.)

Differential Revision: https://phab.mercurial-scm.org/D1352
2017-11-14 18:34:41 -08:00
Jeremy Fitzhardinge
d38c94c1d8 checkmessagehook: print more detail on what bad chars were found
Print which bad characters were found on what line, so that users can
fix the problem just from the hook message.

Differential Revision: https://phab.mercurial-scm.org/D1419
2017-11-14 16:52:45 -08:00
Durham Goode
2ee919bf0a treemanifest: support "{manifest % '{node}'}" template
When we changed the treemanifest {manifest} template output it broke the ability
to specifically ask for the node. This is important for tools migrating between
the old and new format. Let's add that back in.

Let's also make tweakdefaults change the '{manifest}' default template for all
repo's, not just tree repos.

Differential Revision: https://phab.mercurial-scm.org/D1418
2017-11-14 15:55:34 -08:00
Martijn Pieters
234ca8ad39 sparse: list available and active profiles
This lets you list your currently active profiles, as well as let you discover
new profiles, provided sparse.profile_directory is set.

Includes JSON output. Future revisions can build on this to provide richer
metadata (parsed from the profile files).

Differential Revision: https://phab.mercurial-scm.org/D1250
2017-11-10 14:39:11 +00:00
Thomas Jacob
a32f14a7e1 arcdiff: add CA path/timeout support to Phabricator conduit calls
Summary:
Fixing SSL verify bug

https://fb.facebook.com/groups/scm/permalink/1472198416163107/

Test Plan:
PYTHONPATH=/home/tja/local/facebook-hg-rpms/fb-hgext/ /home/tja/local/facebook-hg-rpms/hg-crew/hg diff --since-last-arc-diff
no longer fails with SSL error


$ source hg-dev
$ cd fb-hgext/tests
(hg-dev) tja@devvm2620:tests  (6b76aa8)$ rt
.s.............................................................ss.s.....s.......s....ss..s..s......s.....s..ss...s........s.ss......s..s...................................s........................................................................
Skipped test-p4fastimport-gitfusion-race-condition.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-branch.t: missing feature: Perforce server and client
Skipped test-p4fastimport-blobcommit.t: missing feature: Perforce server and client
Skipped test-p4fastimport-blobcommit-lfs.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-incremental.t: missing feature: Perforce server and client
Skipped test-p4fastimport-limit.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-lfs.t: missing feature: Perforce server and client
Skipped test-lfs-test-server.t: missing lfs-test-server
Skipped test-p4fastimport-import-modes.t: missing feature: Perforce server and client
Skipped test-infinitepush-sql.t: missing getdb.sh
Skipped test-p4fastimport-criss-cross.t: missing feature: Perforce server and client
Skipped test-p4fastimport-transaction.t: missing feature: Perforce server and client
Skipped test-p4fastimport-case-insensitive-rename.t: missing feature: Perforce server and client
Skipped test-infinitepush-backup-sql.t: missing getdb.sh
Skipped test-p4fastimport-import-deletes.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-client-mapping.t: missing feature: Perforce server and client
Skipped test-p4fastimport-case-insensitivity.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-special-characters.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-parallel.t: missing feature: Perforce server and client
Skipped test-p4fastimport-import-badclient.t: missing feature: Perforce server and client
# Ran 223 tests, 21 skipped, 0 failed.

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, mjpieters, awestern, medson, #sourcecontrol, samuelkelly

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

Signature: 6272329:1510245174:2969aa7ab17b45f6656e93301806c0a9b157db29
2017-11-09 08:43:57 -08:00
Sergey Nikolaienkov
d224a11248 tweakdefaults: provide advice abouthg uncommit
Advice using `hg uncommit` when a command to prune (like `hg strip`) but keeping the changes (with `--keep` option)

Test Plan:
Run `hg strip -k\--keep` a "'hg uncommit' provides a better UI for undoing commits while keeping the changes" should show up.
Run `hg strip` w/o `--keep` option,  "'hg hide' provides a better UI for hiding commits" should be shown

Differential Revision: https://phab.mercurial-scm.org/D1335
2017-11-08 07:57:03 -08:00
Durham Goode
b13b24ccc1 perftweaks: fix hg book regression
When the dirstate got refactored, we lost the check that only logged the
dirstate size if the dictionary was already populated. This caused a regression
in hg bookmark times (since it normally doesn't populate the dirstate map).
2017-11-07 15:35:26 -08:00
Durham Goode
5987282c25 treemanifest: test commit hooks with pushrebase 2017-11-06 17:26:08 -08:00
Mark Thomas
868ac70976 rage: add info useful for infinitepushbackup debug
Adds information that is useful for debugging infinitepush backup to the rage
output.  In particular:

- Full node hashes in the unfiltered smartlog, so that they can be looked up
  in infinitepush.

- The contents of infinitepushbackupstate.

- The last 100 lines of the infinitepush backup logs for this repo.

Differential Revision: https://phab.mercurial-scm.org/D1264
2017-11-03 09:34:36 -07:00
Phil Cohen
1b759fa578 progressfile: fix last change 2017-11-02 19:27:20 -07:00
Phil Cohen
6c65d42bea progressfile: never wrap if progress.statefile isn't set or is empty
I wasn't 100% sure this is side effect-free if you enable the extension but
don't specify a progressfile, so let's be extra safe.

Differential Revision: https://phab.mercurial-scm.org/D1308
2017-11-02 19:24:10 -07:00
Pulkit Goyal
d3b6e1c63c fbhistedit: add support for json input to histedit
This patch adds support to histedit command to take input from json. The JSON
should be of following format:

{ "histedit": [
                {"action": "...", "node": "..."},
                {"action": "...", "command": "..."},
                {...}
              ]
}

For actions except "exec" and "execr", "node" is required and for "exec" and
"execr", "command" should be there.

The support is plugged in directly and is not hidden behind a config flag. After
this support, the parser which parses the commands file will assume that JSON is
given and will fallback to original parsing if it fails to convert the data in
the file to JSON.
In case where input is JSON but a key is missing, status message is shown and we
fallback to normal parsing.

Both small and large verbs are supported for the action part in JSON.

Differential Revision: https://phab.mercurial-scm.org/D1263
2017-11-03 05:30:12 +05:30
Pulkit Goyal
b00998e4c9 fbhistedit: clean up mess around importing
Differential Revision: https://phab.mercurial-scm.org/D1262
2017-11-03 05:30:12 +05:30
Pulkit Goyal
bb8189683d copytrace: register the config options
One config option is left as that will be dropped in an upcoming patch.

Differential Revision: https://phab.mercurial-scm.org/D1278
2017-11-02 17:00:12 -07:00
Pulkit Goyal
ca6eff4576 copytrace: make import follow the style of hg-core
Differential Revision: https://phab.mercurial-scm.org/D1277
2017-11-02 17:00:12 -07:00
Durham Goode
e4292521ee sparse: fix typo 2017-11-02 13:42:06 -07:00
Durham Goode
81329af9b4 sparse: prevent devel warning
It looks like the devel warning detection complains about reading
extensions.fbsparse with a default value. Let's just suppress it.

Differential Revision: https://phab.mercurial-scm.org/D1294
2017-11-02 13:39:45 -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
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
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
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
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
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
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
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
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
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
Durham Goode
13b21a28eb configs: remove config defaults for registered configs 2017-10-24 17:54:02 -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
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