Commit Graph

593 Commits

Author SHA1 Message Date
Durham Goode
fd4e029920 pushrebase: preload manifests before the lock is taken
Summary:
This adds a hint to the bundle2 stream that indicates which manifests should be
read before starting the unbundle. This allows us to spend all the parse time
outside of the lock, thus increasing our commit throughput.

Test Plan:
Manually added it to a server and verified the total lock held time
went down. Also ran the tests.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D2485920

Signature: t1:2485920:1443483219:8626105814b511a34a410265310986f936d7c450
2015-09-28 11:31:24 -07:00
Durham Goode
6859d09094 pushrebase: copy manifest cache to bundlerepo
Summary:
As part of increasing our commit throughput, we want to allow precaching the
manifests before the lock is taken. This requires that we are able to use those
cache results from inside the bundle repo. So let's copy the cache data
structures into the bundle repo manifest cache.

Test Plan:
Ran it on a mercurial server along with some timers and verified we
got more cache hits.

Reviewers: pyd, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2485911

Signature: t1:2485911:1443482960:c585f72383c72cd815448814a54d701fca71b1b7
2015-09-28 11:30:31 -07:00
Durham Goode
4d72067cbd Add option to disable reading from the tag cache
Summary:
The tag cache can be pretty expensive to populate, and in many of our repos we
do not even allow tags, so let's allo disable it entirely.

Test Plan: Added a test

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: #sourcecontrol, rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D2481606
2015-09-25 13:45:08 -07:00
Cecile Berillon
c521ae86f6 Adding tag tweak
Summary: Adding tag tweak and warning on the tags command

Test Plan:
Testing the tag command if allowed, not allowed with default message and not allowed with custom message
Testing if the default warning message or custom message prints when tags is called

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: #sourcecontrol, rmcelroy

Subscribers: cdelahousse, durham

Differential Revision: https://phabricator.fb.com/D2477368

Tasks: 8500389
2015-09-24 11:29:41 -07:00
Durham Goode
e69ea77935 pushrebase: remove transaction spam from tests
Summary:
This tests were A) unreadable, and B) not deterministic. Let's remove all that
text and have a special test just for making sure the hook vars we care about
are present.

Also break the output into multiple lines for easier reading and diffing.

And fix a change in order for the remotenames test.

Test Plan: Ran the tests

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2479274
2015-09-24 20:03:02 -07:00
Durham Goode
64ed8a8d62 fbamend: fix to use loaded rebase, instead of system rebase
fbamend was using the python system rebase instead of the one loaded by
Mercurial. This broke the tests when the installed rebase differed from the
version of Mercurial we were running the tests with.
2015-09-24 19:46:12 -07:00
Ryan McElroy
1e7a9fca92 tweakdefaults: fix bad relative behavior with hgwatchman
Summary:
Status on large repos got slow due to using re: and not '' and clowny
matcher behavior.

Test Plan:
In a large repo, I ran hg status with the old tweakdefaults and it consistently
took 10 seconds. Using the new tweakdefaults, it took 10 seconds the first time,
and was much faster afterwards.

I removed .hg/watchman.state and ran `hg status re:` with the old watchman and
it remained slow after multiple invocations. I ran `hg status re:` twice with
the new tweakdefaults and it was fast on the second invocation.

Reviewers: sid0, wez, #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2479154
2015-09-24 19:05:26 -07:00
Eric Sumner
ae66dcdfae Make pushrebase set HG_NODE when it makes a commit
Test Plan: ran tests

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2471540
2015-09-23 10:25:24 -07:00
Ryan McElroy
3724810d00 make status relative
Test Plan:
updated test; made sure to include `HGPLAIN`

ran `arc diff` from repo root and from subdir; both worked

In `fbsource/fbobjc` I ran `arc lint` and there were no warnings but it did fail to find `/usr/bin/xcrun` (which is the same behavior as before).
I repeated this in `fbsource/fbobjc/Configurations` to check for path issues; same result.

In `www` I ran `arc lint` and there were no warnings. I repeated this in `www/flib` and got the same result.

Reviewers: durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: durham, akushner

Differential Revision: https://phabricator.fb.com/D2457648

Tasks: 8432204

Signature: t1:2457648:1442622676:611ad3072d11b91feb947c0eb7eb25b621c61eb1
2015-09-18 10:20:49 -07:00
Ryan McElroy
7e8bf80a31 tweakdefaults: fix ordering issue for real
Summary: I thought we had already done this

Test Plan: Used new tweakdefaults and the rebase abort issue was fixed!

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2457645
2015-09-18 10:15:59 -07:00
Durham Goode
e50afd54cc Fix smartlog error on readonly file systems
Summary:
The completion hint writing logic didn't account for repos where the user
doesn't have write access.  Let's add a try/catch for that.

Test Plan: chmod a-w .hg/completionhints && hg sl

Reviewers: gulshan

Differential Revision: https://phabricator.fb.com/D2461444
2015-09-20 14:39:13 -07:00
Mat Wood
e209fa0e70 Fixing fb-hgext fbamend test
Summary: The test-fbamend.t test is failing because of some error codes that no longer happen with an unsuccessful 'hg amend' command. The command prints out 'nothing changed' and no longer throws an error.

Test Plan: After the change, I ran the tests and confirmed the test-fbamend.t test is now passing.

Reviewers: cdelahousse, jetzhao, ttung, romanchadnov, matwood, durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: rmcelroy, pyd, mitrandir

Differential Revision: https://phabricator.fb.com/D2446352

Signature: t1:2446352:1442536997:e0d7ec996062f8bba5ee125c51091168750f1472
2015-09-17 17:40:18 -07:00
Mat Wood
83adb89ac4 Fixing smartlog errors on empty repo
Summary: An empty repo will cause the smartlog extension to have errors. SCM is trying to iterate through an empty dataset. Smartlog needs to catch the exception and abort if the current repo is empty.

Test Plan: Added tests to make sure 'hg smartlog' on a newly created repo doesn't explode. Confirmed that tests failed before the fix, and they pass with the fix in place.

Reviewers: cdelahousse, jetzhao, romanchadnov, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, ericsumner

Differential Revision: https://phabricator.fb.com/D2446132

Tasks: 8118567

Signature: t1:2446132:1442512709:6a666351a02639f6e0b15c6c7476a8cdd25370c9
2015-09-15 16:13:13 -07:00
Laurent Charignon
7f096bc4c0 smartlog: use core's implementation to speed up grandparent computation
Summary:
Before this patch, we were using grandparent's implementation in python that
was copied from core. With this patch, we are leveraging reachableroots
implemented in C to make grandparent's computation faster.

Test Plan:
Tests are passing + checked on facebook-hg-rpms and configerator-hg
that smartlog behaves as expected

Reviewers: durham, pyd, rmcelroy

Differential Revision: https://phabricator.fb.com/D2442208
2015-09-14 18:02:29 -07:00
Gulshan Singh
0e1385521f smartlog: write all hashes from smartlog to .hg/hashes
Summary: The hashes in .hg/hashes can be used for bash/zsh completion

Test Plan: Run `hg sl` in a repo. Check that .hg/completionhints contains the same hashes shown by `hg sl`.

Reviewers: durham

Reviewed By: durham

Subscribers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2440503

Tasks: 8331035

Signature: t1:2440503:1442268630:c3bb3a52a301d2b6fa461158ccbd087c87e883a5
2015-09-14 13:37:45 -07:00
Mateusz Kwapich
84c1720a00 fbhistedit: use user shell in histedit exec command
Summary:
This is hacky way of executing user shell in interactive mode so they get their aliases, bash functions, output coloring and more...

I put this behind config knob so if this doesn't work for user with very obscure shell they can always turn it off.

Test Plan: Tested it in my shell - used my shell aliases with exec (can't write unit tests since it's very environment specific - suggestions welcome).

Reviewers: ericsumner, rmcelroy, #sourcecontrol

Reviewed By: rmcelroy, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2433238

Tasks: 5852393

Signature: t1:2433238:1441961664:e4a9cb804dfb4f714278865e3abf370277836e5b
2015-09-10 22:53:28 -07:00
Gulshan Singh
03004ac2ef fbamend: return 0 on amend/commit with nothing changed
Summary: return 0 on amend/commit with nothing changed

Test Plan:
Make or checkout a mercurial repository and make a commit. Run the following commands and make sure the output is the same:

$ hg ci; echo $?
nothing changed
0
$ hg amend; echo $?
nothing changed
0

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2427283

Tasks: 8313450
2015-09-09 14:43:16 -07:00
Durham Goode
a7692bbfc6 pushrebase: disable check_heads check
Summary:
exchange.check_heads is used to verify that the server's heads haven't changed
between when the client does discovery and when it obtains the lock. With
pushrebase we want to allow concurrent pushes, so this is a scenario we want to
support.

So let's disable that check.

Test Plan: Ran the tests and verify that the wrapfunction call was hit.

Reviewers: ericsumner, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2419949
2015-09-07 18:26:53 -07:00
Durham Goode
1aa331964a statprof: fix writing data to bad home dirs
statprof attempts to save data to the user's home dir, for future investigation.
If this fails (because of permission issues, or because the home dir doesn't
exist), it was failing the command entirely.  Let's catch and eat those
exceptions.
2015-09-07 17:32:12 -07:00
Durham Goode
1ce3b1fcaf Add statprof 2015-09-07 13:46:29 -07:00
Christian Delahousse
bcaf93b996 Added git checkout -f without args to githelp
Summary:
`githelp` supported `git checkout -f xyz` but not the same command with out a
path or a rev. Added support for it and wrote a test.

Test Plan:
Added tests and ran them.

Task: #7499727

Reviewers: ericsumner, durham

Reviewed By: durham

Subscribers: joesavona

Differential Revision: https://phabricator.fb.com/D2372309

Signature: t1:2372309:1440530832:cb32553b2ef7f7ff0e09cb80ff6449a8c26c2caf
2015-08-21 16:32:43 -07:00
Christian Delahousse
f90fce8d84 Fixed test-tweakdefaults.t on hg up failure
Summary:
Commit 865f9f0d3df0 modifying the `hg up` command broke the tests. I updated
the test.

Test Plan:
    $ ./run-tests.py test-tweakdefaults.t
    warning: Testing with unexpected mercurial lib: /usr/lib64/python2.6/site-packages/mercurial
            (expected /tmp/hgtests.PK6gU9/install/lib/python/mercurial)
    .
    warning: Tested with unexpected mercurial lib: /usr/lib64/python2.6/site-packages/mercurial
            (expected /tmp/hgtests.PK6gU9/install/lib/python/mercurial)
    # Ran 1 tests, 0 skipped, 0 warned, 0 failed.

Task: #8105963

Reviewers: durham, ericsumner

Reviewed By: ericsumner

Subscribers: thm, joesavona

Differential Revision: https://phabricator.fb.com/D2373449

Tasks: 8105963

Signature: t1:2373449:1440439161:44e57904fbd32a4d92cc7ebae94aecde4671542e
2015-08-23 00:08:06 -07:00
Hunter Matthews
2bfa3be15a Update hg pull error message to suggest a fix for a naked hg up.
Summary:
Facebook disables naked "hg up" as found in many googled mercurial docs.
https://www.selenic.com/hg/help/update
https://www.selenic.com/mercurial/hg.1.html
http://hginit.com/01.html
etc.

We should have our error/abort messages make suggestions to correct course when
our configs conflict with upstream.

Test Plan:
"hg up --config extensions.tweakdefaults=~/fb-hgext/tweakdefaults.py"
in a repo that both needs updating to master and one in which it doesn't.

Results:
In repo needing an update:
/home/thm/fbsource/fbcode/tupperware/config/pe-security [thm@devvm1531]
> hg up --config extensions.tweakdefaults=~/fb-hgext/tweakdefaults.py
abort: You must specify a destination to update to, for example "hg up master".
(If you're trying to move a bookmark forward, try "hg rebase -d <destination>".)

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2348818
2015-08-14 15:18:15 -07:00
Tony Tung
6fdff081b8 fix breakages due to fbconduit api changes regarding missing revs
Summary:
FBConduit used to throw a conduit error when a rev didn't map.
Now, it just returns an empty string for the mapping.  This updates the
fbconduit extension so that it matches the server behavior.

Test Plan: passed unit tests.

Reviewers: mitrandir, ericsumner, durham

Reviewed By: ericsumner

Subscribers: mitrandir

Differential Revision: https://phabricator.fb.com/D2331464

Tasks: 7970302

Signature: t1:2331464:1439500203:cbf79e9b9c54aebdf33bbad82c1982b5a69e8bc9
2015-08-10 21:22:21 -07:00
Ryan McElroy
273f9d02a8 Make smartlog's 'important' bookmarks configurable
Summary:
Different repos have different notions of important bookmarks. Allow
configuring it.

Test Plan: added a new test

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2340061

Tasks: 7955325
2015-08-12 14:58:41 -07:00
Durham Goode
868dc4af4b githelp: improve rebase -i message 2015-08-12 17:05:21 -07:00
Durham Goode
07da1f3e15 pushrebase: fix rebasing merge commits
Summary:
It turns out commit.files() does not return all the affected files during a
merge commit. It only returns files which differ from both p1 and p2, so in a
merge commit where we accept the changes from p2, the changes were lost during
the rebase.

This fixes it by performing a manifest diff if we're grafting a merge commit.

Test Plan:
Updated the tests to check the file contents (this test would fail
before)

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2331586
2015-08-10 22:15:03 -07:00
Ryan McElroy
b37d684953 tweakdefaults: update documentation 2015-08-12 14:53:26 -07:00
Josh Braegger
5576d9be8d githelp: Add 'deprecated' message for 'git whatchanged'
Summary: Just in case someone trys to use 'git whatchanged', at least tell them why it's not supported

Test Plan: added a test

Reviewers: rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2329289

Tasks: 7966012

Signature: t1:2329289:1439242809:56fb56704e1110dc95a6366ee9c3eb948e1bf415
2015-08-10 14:00:23 -07:00
Laurent Charignon
d3debca37b inhibitwarn: fix broken test 2015-08-06 11:20:20 -07:00
Laurent Charignon
37e7425cfa inhibitwarn: improve the warning message
Summary:
We had some complain about the warning message, this is a rework of
the wording to make it clearer. The diff is not complete until we have the
link for the Source Control FYI post coming this morning.

Test Plan: N/A

Reviewers: pyd, durham

Differential Revision: https://phabricator.fb.com/D2315002
2015-08-05 10:42:58 -07:00
Durham Goode
6347babe11 fbhistedit: add execr action
Summary:
Adds an xr/execr action that executes the command relative to the
current working directory. This allows our users to run 'arc diff' and pick up
whatever the current arc project is (instead of whatever arc project is at the
root of the repository).

Test Plan: Added a test

Reviewers: davidsp, #sourcecontrol, lcharignon

Reviewed By: #sourcecontrol, lcharignon

Subscribers: rmcelroy, lcharignon

Differential Revision: https://phabricator.fb.com/D2311298

Tasks: 7795286
2015-08-04 10:55:33 -07:00
Durham Goode
32627292e9 fbhistedit: reapply the backed out change
Now that we've rolled out new rpms everywhere, we can redo this change.
2015-08-04 23:10:59 -07:00
Durham Goode
dc196e2b2d fbhistedit: backout 192e9fd62d3c since the tests aren't passing 2015-08-04 10:08:04 -07:00
Laurent Charignon
062fc29b9d fbamend: take a lock for the whole fbamend process
Summary:
Before this patch we were not taking a lock when dealing with bookmarks.
Which means that any process running while fbamend was running would lead to
corruption / loss of bookmark. This patch makes sure that we have a lock for
the whole duration of the fbamend run and avoids corruption.

Test Plan:
Tests are passing and this fixes an issue that we have
been seeing with inhibit where inhibit would take a lock on bookmark write
and overwrite the .preamend bookmark

The following repro does not show the issue anymore:

    mkcommit a ; mkcommit b ; hg book b ; hg up .^ ; hg book a ; echo "OO" > r ; hg commit --amend --rebase -Am 'oo'

Reviewers: durham, pyd

Reviewed By: pyd

Differential Revision: https://phabricator.fb.com/D2303299

Signature: t1:2303299:1438623825:e8160001600449cf5f505cc55a078d30c1e75a14
2015-08-04 09:10:50 -07:00
Durham Goode
48f7f4f934 pushrebase: don't do rebase if -f is specified
Summary:
pushrebase doesn't support pushing non-fastward heads when remotenames is on
(since --to implies both remotenames and do a rebase). Long term we want --new
and --replace to indicate bookmark movements, but for now we can use the
existing -f to imply that we don't want a rebase to happen.

Test Plan: Added a test

Reviewers: #sourcecontrol, lcharignon

Reviewed By: #sourcecontrol, lcharignon

Subscribers: lcharignon

Differential Revision: https://phabricator.fb.com/D2307585
2015-08-03 15:33:00 -07:00
Ryan McElroy
f79b8fe28c update rage to work with new bookmarks api 2015-08-03 16:25:42 -07:00
Durham Goode
17b48c71b2 fbhistedit: add more test cases for histedit
Summary:
This is testing more failing case involving command creating obsmarkers during interruption.

More corner case testing could be added, but this is a good start.

Test Plan: test crash before update of core. Properly pass with the series current in review on mercurial-devel

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2307305
2015-07-31 15:53:16 -07:00
Pierre-Yves David
2a3ff656d9 fbhistedit: adapt test to backout of 3e883e7ec57b
There is some stripping involved again. We update the test to reflect this.
2015-08-03 14:50:09 -07:00
Pierre-Yves David
397a9f095d b2xcompat: remove the extension
Summary:
This extension was a temporary hack to help people move from the experimental
bundle2 format to the final one. All user have been moved so we can put this
very hacky extension to the sword.

Test Plan: ran setup.py install --prefix /tmp/foobar, b2xcompat was no longer there.

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2298571
2015-07-30 13:10:23 -07:00
Laurent Charignon
1ed49d16a1 inhbitwarn: change date format to ISO8601
Summary: We decided to do that in https://phabricator.fb.com/D2294809

Test Plan: Added a test

Reviewers: durham, rmcelroy, pyd

Differential Revision: https://phabricator.fb.com/D2296276
2015-07-30 10:29:36 -07:00
Gregory Szorc
5c852f4e44 pushrebase: add testedwith for 3.4
It is a best practice for Mercurial extensions to contain a "testedwith"
attribute to define which Mercurial versions they are compatible with.
The tests pass with Mercurial 3.4.1 (but not 3.3.3 - there are
references to missing symbols), so mark 3.4 as the only compatible
version.
2015-06-12 16:36:51 -07:00
Gregory Szorc
4d32cb4009 pushrebase: don't use evolve in tests
Evolve isn't a part of core Mercurial nor is it part of this repository.
Make it easier to run tests for pushrebase by removing the evolve
dependency.

This does drop a workflow test that `hg evolve` after a rebased push
does the right thing. But, evolve's behavior in the presence of
specific obsolescence markers should be pretty well tested and it
shouldn't be strictly necessary to test this behavior.
2015-06-12 16:34:35 -07:00
Laurent Charignon
d051374662 pushrebase: update test to remove mistake 2015-07-30 11:14:14 -07:00
Laurent Charignon
91e77b5f87 inhibit: suggest removing directaccess for evolve users
Summary:
The reasoning here is that evolve users probably want to have the
exact same experience as before. Plus, we lack test coverage for
evolve + directaccess

Test Plan: warning message only

Reviewers: durham, pyd, rmcelroy

Differential Revision: https://phabricator.fb.com/D2294762
2015-07-29 18:11:28 -07:00
Laurent Charignon
45a067578e b2xcompat: fix missing default value for argument of wrapbundle20
Summary:
This was crashing in some situation when using push rebase, the repro
is too complicated to put in a test.

Test Plan:
Check that the crash is not here and all the tests already in place
behave as expected

Reviewers: pyd, ericsumner, durham

Differential Revision: https://phabricator.fb.com/D2292875
2015-07-29 13:30:01 -07:00
Laurent Charignon
7e55f2106e pushrebase: remove tail check
Summary:
The tail check was flagging by mistake scenarios where the push was
possible. This patch adds one of these scenario.

Test Plan: Add new test and all former tests are passing

Reviewers: ericsumner, durham

Differential Revision: https://phabricator.fb.com/D2292866
2015-07-29 13:32:51 -07:00
Laurent Charignon
4a7d8e9f70 pushrebase: fix fastfoward case
Summary:
Before this patch, pushrebase was not supporting some cases of fast
forward push. This patch fixes the issue.

Test Plan:
Added a new test. Check that the test failed before and is fixed
with the code change.

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2279800
2015-07-24 15:23:16 -07:00
Durham Goode
8fbe1e4ea1 sparse: make sparse extension work on non-sparse repos
Summary:
It's possible that the sparse extension might be loaded, even if the sparse
extension is not enabled for the particular repo (like if you're cloning from a
sparse repo to a non-sparse repo on the same machine). Previously it broke,
because we assumed all repo's had sparsematch(). Now we check for it before
using it.

Test Plan:
Added a test. The old test wasn't sufficient since it didn't have any
commits, so the dirstate was not interacted with

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2278657
2015-07-24 13:03:09 -07:00
Laurent Charignon
66fabe5549 pushrebase: update tests for new version of hg 2015-07-24 16:05:56 -07:00