Commit Graph

683 Commits

Author SHA1 Message Date
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
Laurent Charignon
d2bc198c5e pushrebase: record copies, exec and link properly
Summary:
Before this patch we were not recording all the information for file
copy, executable bit and link. This patch fixes the issue.

Test Plan: Add a new test with a copy

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2277575
2015-07-24 09:38:01 -07:00
Laurent Charignon
8f43bce88c pushrebase: fix bug for changesets that remove file
Summary:
I saw this error when using pushrebase with fbsource on a commit
that deleted a file. We were trying to access it even if it was not in the
manifest.

Test Plan:
Modified the test
Before the code fix the new test fails with:
    remote: abort: b@46a2df24e272: not found in manifest!

Reviewers: durham, ericsumner, pyd

Differential Revision: https://phabricator.fb.com/D2274792
2015-07-23 14:11:58 -07:00
Durham Goode
27729358a1 Fix pushvars with remotenames
Summary:
The old order fix was not quite right, since it modified a local copy of _order
instead of the extension modules copy.

Test Plan:
Added a test that verifies the hooks can see a pushvar even through
remotenames

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2275767
2015-07-17 15:47:30 -07:00
Durham Goode
d7d95c9b9c update fbhistedit and tweakdefaults tests to match new upstream hg 2015-07-22 15:58:02 -07:00
Durham Goode
b804c11020 smartlog: hide public heads when remote bookmarks are enabled
Summary:
If the user is using remote bookmarks, let's hide the public heads from the
smartlog output. This allows the server to do a non-fastward bookmark move,
without having the old heads cluttering the user's smartlog output.

Test Plan: Added a test

Reviewers: mitrandir, rmcelroy, ericsumner, lcharignon

Reviewed By: lcharignon

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

Signature: t1:2264878:1437505970:664348ed91ba8d8b1018299e282ed4308bfbdbc0
2015-07-21 11:32:27 -07:00
Tony Tung
858f3babb5 changed the port the unit test runs on.
Summary: as per @ericsumner's comment, changed the port from 8000.

Test Plan: passed unit test

Reviewers: ericsumner, durham, rmcelroy

Subscribers: mitrandir, ericsumner

Differential Revision: https://phabricator.fb.com/D2247429
2015-07-15 14:50:46 -07:00
Tony Tung
db22778620 support for multiple backing repos.
Summary:
# added a backingrepo list configuration variable that enumerates the backing repos.
# wrote a bunch of unit tests to cover this functionality.

Test Plan: passed unit tests.

Reviewers: rmcelroy, durham, ericsumner

Subscribers: mitrandir

Differential Revision: https://phabricator.fb.com/D2247419
2015-07-15 14:48:57 -07:00
Durham Goode
2bc2c1723e merge divergent heads 2015-07-16 11:10:46 -07:00
Tony Tung
eb5fb6bbe3 test more fbconduit functionality.
Summary: Test mirrornode and gitnode as a rev selector.

Test Plan: passed unit tests.  D2246978 is required for these tests to pass.

Reviewers: lcharignon, rmcelroy, durham, ericsumner

Reviewed By: ericsumner

Subscribers: mitrandir

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

Signature: t1:2246986:1436993629:3098c741aabaeeccb81e4e9c03c36c6435c3ccf0
2015-07-15 13:45:27 -07:00
Tony Tung
6d89af0509 fix small bugs in fbconduit
Summary:
# mapping['repo'] doesn't exist.  looks like it was copypasta from `mirrornode()`.
# the error message is not particularly helpful (it's basically the server return message without any context).  changed that.
# repo[hash] runs into a mercurial bug where passing in a hash string triggers some unicode error messages (https://phabricator.fb.com/P19919583).  work around this by querying with the binary string representation.

Test Plan: passed fbconduit unit test.

Reviewers: lcharignon, rmcelroy, durham, ericsumner

Reviewed By: ericsumner

Subscribers: mitrandir

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

Signature: t1:2246978:1436993587:31857064ce810c604ce1c071bfed484b96150b37
2015-07-15 13:40:08 -07:00