Commit Graph

3079 Commits

Author SHA1 Message Date
Mark Thomas
9d389170da copytrace: add fast copytracing for amends 2017-07-18 08:52:20 +01:00
Felix Merk
4fdf562a93 undo: improved performance and prep for hg undo
Implements lighttransaction(repo) which improves performance of hg undo and
prevents infinite loops caused by hooks that run true hg commands.  Also adds
_getrevlog and _invertindex commands, factoring out code that will be reused.
Changes output for gaps when typing hg debugundohistory -l for slightly
better ui and clearer testing. Lastly, changes lock from repo lock to new
undolog lock and tests this.  In the future, with some changes to undo.log,
we may be able to take the lock later, bypassing the need to take it for
read-only operations.

Differential Revision: https://phab.mercurial-scm.org/D50
2017-07-17 13:18:54 -07:00
Jun Wu
285b5a92e6 codemod: rewrite nested with
This is the result of running a codemod script:

  python ~/hg/contrib/codemod/codemod_nestedwith.py **/*.py

Plus a manual cleanup that removes the comment in `absorb/__init.py`.

See D76 for the codemod script.

Differential Revision: https://phab.mercurial-scm.org/D78
2017-07-17 12:02:08 -07:00
Durham Goode
81db9c874e tests: remove hard coded line from tests
Replace it with a glob
2017-07-17 04:07:27 -07:00
Stanislau Hlebik
196a16380c fastpartialmatch: fix devel.warn
Summary:
Upstream hg recently introduced new developer warning if files inside .hg are
modified without taking a lock. The usual fix is to add file in
localrepository._wlockfreeprefix list, but it doesn't work for "needrebuild"
fastpartialmatch file because it's stored inside .hg/store.
So to get rid of developer warning let's move needrebuild file to .hg/.
And since we are detecting that partial index needs to be rebuilt in revlog class,
I also had to wrap `runcommand()` and create needrebuild file there, because
`runcommand()` has vfs object, while revlog class doesn't.

Test Plan: Run tests

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D99
2017-07-17 04:03:15 -07:00
Durham Goode
655c9a4f08 obsshelve: update savebackup signature
Summary:
Upstream has changed the signature of saveback to include the full name. Let's
update to match it.

Test Plan: The test now passes

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D105
2017-07-17 04:02:43 -07:00
Durham Goode
e0a50d083b infinitepush: put metadata fill in wlock
Summary:
Upstream has added warnings when writing files outside the wlock, so let's put
this write in the wlock.

Test Plan: The tests now pass

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash, simonfar

Differential Revision: https://phab.mercurial-scm.org/D104
2017-07-17 04:02:43 -07:00
Durham Goode
d651fab9a8 tweakdefaults: take wlock when changing bookmarks
Summary:
Upstream has added devel-warnings when writing to vfs files without taking the
wlock. We need to take the wlock here.

Test Plan: The test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D103
2017-07-17 04:02:43 -07:00
Durham Goode
0afce8a31b cleanobsstore: fix devel-warning
Summary:
Upstream now warns when writing a vfs file outside of a lock. For this
particular file, it's safe to write it outside the lock, so let's add it to the
whitelist.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D102
2017-07-17 04:02:43 -07:00
Durham Goode
bfe9c37568 tests: fix test devel-warning
Summary:
This test writes file to the vfs to indicate a hook is done. We need to tell
Mercurial that this file is ok to write outside a lock.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D101
2017-07-17 04:02:43 -07:00
Durham Goode
3c1c4327b8 mergedriver: move state writing into wlock
Summary:
Upstream has added devel-warnings for writing files without the wlock. This was
one instance.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D100
2017-07-17 04:02:43 -07:00
Mihails Smolins
9a121651cc remotefilelog: enable background prefetch for pull
Summary:
Previously prefetch on pull ran in foreground. Now it can run in background
if specified. Optionally background prefetch can be followed by background
repack.

Test Plan: Added a test case

Reviewers: simonfar, durham

Reviewed By: simonfar

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727343

Signature: t1:5406626:1500059334:207b4100cca536cbe33f6c6dfad596d03a6fa14f
2017-07-17 03:04:22 -07:00
Jun Wu
cd181c7ec8 fastannotate: mark as wlock safe
fastannotate has its own file-level flock implementation and does not need
to use the repo lock.

Differential Revision: https://phab.mercurial-scm.org/D91
2017-07-14 16:11:55 -07:00
Durham Goode
fd07b800c7 morestatus: add wlock around updateargs file
Summary:
Upstream has added a warning around writing files with locks. Since this file is
written as part of an update, let's just take the wlock.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D90
2017-07-14 15:55:26 -07:00
Durham Goode
9c003295c7 gitlookup: move writes into wlock
Summary:
Upstream has introduced a new warning when writing to a repo outside of the
lock. gitlookup triggers this during getgitmeta. Let's take the wlock.

Test Plan: Ran the tests. They now pass

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D88
2017-07-14 15:55:26 -07:00
Durham Goode
3adecb3260 infinitepush: add backup files to vfs warning bypass
Summary:
Upstream has added devel warnings when writing store files outside of a lock.
Certain files allow this though and there's a whitelist of which files are
allowed. Since backups happen behind the scenes and use their own lock, it's
safe to add our files to that list.

Test Plan: Ran the tests against latest upstream hg. They now pass.

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D87
2017-07-14 15:55:26 -07:00
Jun Wu
4e032f7260 hiddenoverride: improve writing logic
Avoid writing if nothing changes, and write inside a lock.

Differential Revision: https://phab.mercurial-scm.org/D86
2017-07-14 15:00:18 -07:00
Sen Li
b974a7cf2c adding hg amend --to option so it amends to a specific commit
Summary: adding hg amend --to option so it can amends to a specific commit

Test Plan: will add a test for this

Reviewers: juehui, durham

Reviewed By: durham

Subscribers: medson, mjpieters

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

Signature: t1:5396805:1499986779:d555d75c636e37adbe484b5b77c1844fcacfdc86
2017-07-14 12:06:22 -07:00
Durham Goode
752a52b68b treemanifest: move treeonly manifest log to separate class
Summary:
We want to reuse the treeonly logic in both the server and the client, so we
need to move the treeonly version of the manifest log to it's own class that
doesn't depend on revlogs. This is actually a lot cleaner too.

Test Plan: Ran the tests

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Subscribers: simpkins

Differential Revision: https://phab.mercurial-scm.org/D12
2017-07-14 11:47:12 -07:00
Durham Goode
e3a87e44e3 pushrebase: add pack files to storage during hooks
Summary:
Hooks should run with awareness of the tree pack data, so we need to pass the
temporary pack location as part of the hook environment.

Test Plan: Added a test

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Subscribers: simpkins

Differential Revision: https://phab.mercurial-scm.org/D8
2017-07-14 11:47:12 -07:00
Durham Goode
c823246e06 treemanifest: add treeonly option
Summary:
Adds a config option that forces all manifest accesses to use treemanifests.
This will be useful in enforcing the final stage of the treemanifest migration
where we use tree manifests for everything.

Test Plan:
A subsequent patch adds a test that runs hooks that touch the manifest while
treeonly is set.

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Differential Revision: https://phab.mercurial-scm.org/D7
2017-07-14 11:47:12 -07:00
Durham Goode
e1b7318640 pushrebase: add config for switching to treemanifest reading
Summary:
Adds functionality and a test for when clients pushes a tree pack to the server
without any flat manifest data, and the server writes the correct flat and tree
manifests during pushrebase.

Test Plan: Added tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: phillco, quark, dsp

Differential Revision: https://phab.mercurial-scm.org/D5
2017-07-14 11:47:12 -07:00
Durham Goode
937ee01b7d sparse: fix interaction with treemanifest
Summary:
Treemanifest relies on the matcher visitdir function, which was not implemented
in our special sparse matchers. Long term we should migrate to using the core
sparse extension. For now let's just implement visitdir().

Test Plan: Added a test. Previously the test would throw a big exception.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D84
2017-07-14 11:13:39 -07:00
Durham Goode
dc09e58efc treemanifest: allow using manifest nodes as base nodes during pack fetch
Summary:
When requesting trees from the server, the client sends a list of manifest nodes
it wants and base nodes it has, then the server sends back any parts of the tree
that are in the desired manifests but not in the base nodes. If no base nodes
are sent, then the server tries to pick appropriate base nodes from the list of
manifests being requested.

Previously, when requesting manifest X, it would only try to pick X^ as the base
node (assuming X^ was in the request set). This meant that if you requested X
and X^^, it wouldn't realize they were very similar and instead it would send
the entire X and entire X^^ trees (with lots of duplication).

With this patch, it will always use the previously requested manifest as the
base node for the next manifest, if no base nodes are specified. So requests X
and X^^ will return the minimal set of nodes.

Test Plan: Added a test.  It fails before and passes afterwards

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Differential Revision: https://phab.mercurial-scm.org/D75
2017-07-14 10:34:12 -07:00
Durham Goode
3102e456ab infinitepush: backout lfs fix
Summary: This broke hg bundle on non-generaldelta repositories.

Test Plan: Ran the tests

Reviewers: #fbhgext, stash, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D74
2017-07-13 13:53:40 -07:00
Durham Goode
370ce5b5ff repack: better error handling
Summary:
We've seen certain machines end up with just datapack files and no dataidx
files. While we can't repro this, the only time this could possibly happen is
between the rename of the two temp files. So let's add error handling around
that logic.

Test Plan: Ran the tests.  Manually inserted an exception between the renames, ran the tests with --keep-tmpdir, and verified there were no packs left over when the exception fired.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D61
2017-07-13 12:47:23 -07:00
Jun Wu
0b38d6d44e hiddenoverride: unhide permanently by bookmark and working parent
We want these behaviors:

  - Checking out an obsoleted revision makes it visible even if another
    revision was checked out later
  - Putting a bookmark on an obsoleted revision makes it visible even if the
    bookmark was removed later
  - Strip/prune could make them hidden again

This is basically a lightweight version of independent hidden.

Differential Revision: https://phab.mercurial-scm.org/D70
2017-07-13 11:04:56 -07:00
Yan Yan
8e95eaafb0 Let non-existing client fail the import early
Summary: Check if the client exists, and if not, exit the import. Added a test for non-regression.

Test Plan: running test-p4fastimport-import-badclient.t

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Signature: t1:5405340:1499965824:394077f0d148be2e5fef15902c69703eaf360bbb
2017-07-13 10:18:39 -07:00
Adam Simpkins
4dfe0364a6 tests: fix 'if False' statements flagged by check-code
Summary:
The check-code test in the upstream mercurial repository was recently updated
to start complaining about "if False" statements.  Two locations in fb-hgext
had this issue.

These both look to be copy-and-pastes of the same function, unfortunately.
That should probably be cleaned up too, but I'll leave that for a separate diff
for now.

Test Plan: Confirmed the test-check-code test passes now.

Reviewers: #fbhgext, durham, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D71
2017-07-12 21:29:28 -07:00
Adam Simpkins
30d1d145d8 conduit: cache and re-use conduit connections
Summary:
Update the phabricator/conduit.py module to cache connections to Phabricator
and re-use them, rather than creating a brand new connection each time
call_conduit() is invoked.

This makes the `{phabstatus}` template reasonable to use outside of the
smartlog extension.  There was already custom logic for smartlog so that it
only makes a single conduit call to look up data on all revisions at once.
However, generic `log` commands would still end up creating a separate
connection to phabricator for each revision.  With this change `log` still ends
up making one call per revision, but at least it does not set up and tear down
a separate connection for each one any more.

Test Plan:
Tested using the `{phabstatus}` template with `hg log` and confirmed it no
longer made a separate connection to phabrictor for each revision.  It is still
pretty slow, but no longer quite as bad.

Reviewers: #mercurial, simonfar, tomaszo

Reviewed By: simonfar

Subscribers: simonfar, medson, mjpieters, net-systems-diffs@fb.com

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

Signature: t1:5383425:1499680847:428185ba762fefbe12a411a1afa0a090aafda2f2
2017-07-12 20:00:00 -07:00
stash@fb.com
35d988093a infinitepush: handle lfs correctly
Summary:
Make sure that infinitepush work fine with lfs. To achieve it we try to use
changegroup3 if it's available and also run prepush hook before infinitepush.

Test Plan: Run `arc unit`

Reviewers: #fbhgext, quark, dsp

Reviewed By: #fbhgext, dsp

Differential Revision: https://phab.mercurial-scm.org/D17
2017-07-12 09:52:03 -07:00
Durham Goode
5c01476371 treemanifest: fix compatibility with old pack protocol
The compatibility shim for the old protocol was just plain broken. This fixes
it. It's hard to write a test for this since the code that produced the old
format is no longer around. But I tested it internally against our servers with
the old format.
2017-07-12 08:53:09 -07:00
Jun Wu
73aa574018 smartlog: remove temporary hack for old revset compatibility
The old smartlog revset is no longer used.

Test Plan:
Confirmed no user uses `smartlog('all')` or `smartlog('recent')` by searching
`smartlog(` globally.

Differential Revision: https://phab.mercurial-scm.org/D48
2017-07-12 02:25:01 +00:00
Durham Goode
79639557a1 datapack: allow 'long' for metadata types
Summary:
Previously the code required that sizes be of type int. Since python plays loose
with integer types, we also need to support long.

Test Plan:
The existing test-remotefilelog-repack-fast.t test was completely
broken. It only enabled fast datapacks for the server repo, not the clients.
Enabling it for the clients as well catches this issue and verifies the fix.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D54
2017-07-11 17:02:15 -07:00
Jun Wu
ce47fb8c56 modcheck: whitelist lz4revlog
Sometimes `test-check-*` were skipped. Upon investigation, it's because
`lz4revlog` was imported and `hg` printed warnings with `modcheck`. So let's
make `lz4revlog` whitelisted.

Differential Revision: https://phab.mercurial-scm.org/D49
2017-07-11 14:42:10 -07:00
Durham Goode
f1ac312e52 tests: enable rebase.singletransaction
Summary:
Upstream rolled back the single transaction rebase by default behavior.
We still want it, so let's enabled it for all our tests.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D47
2017-07-11 13:19:40 -07:00
Durham Goode
fb90f23b77 tests: update to match upstream backup file name change
Summary: Upstream made these changes. Let's follow along.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D46
2017-07-11 13:19:40 -07:00
Mateusz Kwapich
52b1c7b246 tests: add devel-warning to remotenames output
Summary: Will be tehre until remotenames are fixed

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D45
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
fa73f071b8 tests: one new temaplate in the tests message
Summary:

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D44
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
0a6fd21b21 tests: add messages about new obsoleted changestes
Summary:

Reviewers: quark

Reviewed By: quark

Differential Revision: https://phab.mercurial-scm.org/D43
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
f17c815273 tests: remove transaction aborts
Summary: Less transaction rollbacks is good, right?

Reviewers: quark

Reviewed By: quark

Differential Revision: https://phab.mercurial-scm.org/D42
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
8f554eb441 tests: adjust for new messages coming from the strip transaction
Summary:

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D41
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
760d982e3e tests: change the name of backup files
Summary: Looks like the upstream has changed it on us.

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D40
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
7f61612cc8 tests: remove the warning about conflicting configs
Summary: They no longer conflict, in fact we no longer use this config in this repo.

Reviewers: quark

Reviewed By: quark

Differential Revision: https://phab.mercurial-scm.org/D39
2017-07-11 09:44:53 -07:00
Durham Goode
5fe640c293 pushrebase: add comments and basic cleanup
Summary:
As part of refactoring the main pushrebase function, let's add some more
comments and move some declarations closer to where they are used (or delete
them entirely if the initial declaration is not used).

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340604:1498751551:714faa78b8a3a01e165d7f5335484b89b7205995
2017-07-10 15:53:12 -07:00
Durham Goode
f9d954a907 pushrebase: refactor post rebase hooks to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340597:1498751423:8b7ddce604ff7c9bfeea897afecaa7e7cfa8beb4
2017-07-10 15:53:12 -07:00
Durham Goode
c9fba7ef9e pushrebase: refactor rebase into a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340592:1498751349:cf7172ac9c603db0d18a189dc02394f2f0a547f3
2017-07-10 15:53:12 -07:00
Durham Goode
4fc972bfe9 pushrebase: refactor push messaging to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340586:1498751296:f931fb170e0092222a125dc34e2f6ffac74dcfb7
2017-07-10 15:53:12 -07:00
Durham Goode
433f6f1cd4 pushrebase: refactor onto resolution to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340576:1498751222:7ba075ef49ea9d0ad368e6402fb9e61f0d1d0c94
2017-07-10 15:53:12 -07:00
Durham Goode
81959671dd pushrebase: refactor post-lock cache filling to be a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5340571:1498751172:4d926642c68611989ee439fbb0327d6e403cb555
2017-07-10 15:53:12 -07:00