Commit Graph

308 Commits

Author SHA1 Message Date
Nat Mote
811418bec7 Keep the githelp tests independent
Summary:
I realized that a test I wrote affects the tests later in the test suite because
it cd's into a directory and does not cd out. This fixes that.

Depends on D2171752

Test Plan: run tests

Reviewers: durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: pawelbara

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

Signature: t1:2172941:1434735023:70a829cf4eede8e5aa909d10995bfd5d823b9cb6
2015-06-19 09:21:29 -07:00
Pawel Bara
64c081b92c githelp show: better handling of path arguments
Summary:
'git show' now corresponds to 'git diff -r .^' for paths.
For everything else it still resolves to 'git export'.

Test Plan: take a look at the unit tests.

Reviewers: marcelo, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: nmote, durham, rmcelroy, owenc

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

Tasks: 6860395

Signature: t1:2171752:1434682344:cf1af959e0da788efa0a526459ee64590b09a00e
2015-06-18 18:04:42 -07:00
Yibo Cai
95f4827866 Update mercurial githelp extenstion to support --shwo-status option
Test Plan: Unit test

Reviewers: owenc, marcelo

Reviewed By: marcelo

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

Tasks: 6860308

Signature: t1:2169664:1434664955:139b9020b3102a7385e1954efeb0afc48b766487
2015-06-18 11:58:59 -07:00
Laurent Charignon
9ae26181cd githelp: revspec ending in "~" in git becomes "~1" in mercurial
Summary:
Before this patch: hg githelp -- reset HEAD~ returned hg reset .~ which was
wrong. With this patch it retuns hg reset .~1.

Test Plan: added a test

Reviewers: mitrandir, durham

Subscribers: scottf

Differential Revision: https://phabricator.fb.com/D2166551
2015-06-17 16:11:03 -07:00
Laurent Charignon
a2baee7984 inhibitwarn: only show one warning per command
Summary:
Before this patch, we were displaying one directaccess warning per repo.
With this patch we display only one warning for the lifetime of the hg process.

Test Plan: checked manually

Reviewers: pyd, mitrandir, durham

Reviewed By: durham

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

Tasks: 7403121

Signature: t1:2165815:1434578693:fc471d67aa0f567fa234b020827a68673364d870
2015-06-17 16:14:05 -07:00
Laurent Charignon
66eee49d7c reset: use scmutil.revsingle instead of reading rev number as is
Summary:
Reset didn't use scmutil to parse revision number given on the command line.
Inhibits plugs in the scmutil logic to enable direct access and therefore reset
was not benefiting from it. This caused the revive logic in reset to create
a new commit instead of reusing the old one.

Test Plan: Added test

Reviewers: durham, pyd

Reviewed By: pyd

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

Tasks: 6696106

Signature: t1:2032910:1430339529:47e2c7d7c2ea76e4ab1114e7215e8517ee9f4356
2015-06-17 14:38:03 -07:00
Durham Goode
86f7770eb5 reset: fix test globbing 2015-06-17 13:10:22 -07:00
Durham Goode
5b01596008 sparse: move hgwatchman integration test to test-sparse-extensions.t
We now have a test file explicitly for extension integrations. So let's move the
hgwatchman test.  Includes some minor changes to make it work.
2015-06-15 17:44:39 -07:00
Durham Goode
59fcb5efbe sparse: add caching around sparse profile reading
Summary:
Previously we would have to decompress the entire manifest to check if each
sparse profile existed. This slowed hg status down by 500ms (2x).

This patch adds caching when simplecache is enabled.

Test Plan:
Added a test.  Also tried it in fbsource. Verified repeated hg
status's did not parse the manifest

Reviewers: rmcelroy, ericsumner, lcharignon, akushner, mitrandir

Differential Revision: https://phabricator.fb.com/D2158178
2015-06-15 17:20:53 -07:00
Durham Goode
1b3926c13d simplecache: move memcache prefix to mcget/set
Summary:
1) moves the memcache prefix part of the key into mcget and mcset, so callers
don't have to care about it.
2) added a stringserializer for storing simple strings
3) removes _ from _memoize so it can be used by other extensions
4) moves key version into memoize function

Test Plan: Ran the tests

Reviewers: rmcelroy, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2158102
2015-06-15 17:19:08 -07:00
Laurent Charignon
2dfb60c118 inhibit: fix plan for evolve users
Summary:
inhibit: fix plan for evolve users
As @sid0 pointed out, this was missing from the help message

Test Plan: N/A

Reviewers: durham, sid0, pyd

Subscribers: sid0

Differential Revision: https://phabricator.fb.com/D2160236
2015-06-16 11:27:29 -07:00
Durham Goode
97e498b39a sparse: fix multiple wrapping of dirstate
Summary:
The dirstate wrapping functions were being run as part of reposetup, which
caused them to be wrapped multiple times, resulting in it exceeding the stack
size in some cases.

This moves the dirstate wrapping to be at extsetup time.

Test Plan:
histedit in facebook-hg-rpms used to break with stack overflow
errors. Now it doesn't. It seems the issues is more likely in repos with lots of
subrepos.

Reviewers: rmcelroy, ericsumner, lcharignon, pyd

Differential Revision: https://phabricator.fb.com/D2152047
2015-06-12 12:45:14 -07:00
Durham Goode
8dbd058742 simplecache: add local caching
Summary:
Having a simple on disk cache is useful in some cases, like when it can prevent
us from having to read a full manifest. Let's add local caching support to
simplecache.

Test Plan:
Added a test

Perf numbers for a basic export
no cache=0.7s
local only=0.46s
memcache only=0.48s
memcache+local=0.48s
local+memcache=0.46s

Reviewers: ericsumner, lcharignon, sid0, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:2149605:1434139712:c8a524ece9bdd91dca122e1305e81aa02912a8d9
2015-06-11 15:29:43 -07:00
Durham Goode
fa50ce426e sparse: change missing profile warning to be debug
Missing profiles are more common than previously expected (for instance when
reading old commits for a rebase).  Let's move this warning to debug.
2015-06-11 14:39:40 -07:00
Laurent Charignon
7d5b2f89fb inhibitwarn: fix a typo in the error message 2015-06-12 13:47:25 -07:00
Durham Goode
b34a9af1d5 Fix repo's where sparse is present but not enabled
Summary:
There can be situations where the sparse extension has run uisetup, but the repo
object doesn't have sparse enabled so it doesn't run reposetup. We need to make
sure all the work uisetup does can condition on whether reposetup has done it's
work or not.

Test Plan: Added a test

Reviewers: lcharignon, pyd, ericsumner, sid0, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:2129966:1433522840:90029011ac8bbb2e1efbaf9fb317c1e55aa18737
2015-06-04 16:50:18 -07:00
Durham Goode
483fff949e Fix reset invalidating the entire dirstate
Summary:
Previously, if you did 'hg reset .' it would invalidate the entire dirstate,
making every entry 'lookup' so it had to read the entire working copy on the
next run. This fixes that.

Technically this is a bug in core mercurial since rebuilddirstate() should
invalidate anything if an empty list is passed.

Test Plan: Added a test

Reviewers: pyd, lcharignon, sid0, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:2129095:1433520638:e05ee86dedcc9f87d5c3fd65e3e2374ecbac5dfb
2015-06-04 15:27:46 -07:00
Durham Goode
2608f65165 Update to match upstream
Upstream has changed there api's slightly. Let's update to match them.
2015-05-27 17:37:19 -07:00
Laurent Charignon
7b6673c2b7 inhibit: add extension to warn evolve beta users
Summary: inhibit: add extension to warn evolve beta users

Test Plan:
Checked with and without cutoff date set in hgrc that the message
is displayed when it has to.

Reviewers: durham, pyd

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

Tasks: 6634899
2015-05-18 11:38:11 -07:00
Laurent Charignon
8eb2003bbd fbamend: use strip.strip instead of repair.strip
Summary:
fbamend: use strip.strip instead of repair.strip
This allows fbamend to work better with evolve as evolve overrides the command
strip.strip to prune.

Test Plan: Changed test and ran it.

Reviewers: durham, pyd

Differential Revision: https://phabricator.fb.com/D2082137
2015-05-18 16:28:40 -07:00
Laurent Charignon
25d0314a5b backups: make hg backups evolve aware
Summary:
backups: make hg backups evolve aware
With this patch: hg backups urges evolve user to look at hg reflog to recover
hidden commits. This is because evolve's commands are using obsolescence
markers to hide commits instead of stripping them.

Test Plan: Cross repo dependency, not sure how to make an automated test

Reviewers: durham, pyd

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

Tasks: 6534705
2015-05-20 12:29:09 -07:00
Eric Sumner
7e1147b62d [fbconduit] support gitnode template and revset
Summary:
This copies a bunch of logic from ##gitrevset.py## which should allow the
##fbconduit## extension to be a complete replacement for ##gitrevset##.
Overall, execution times are comparable for the revset and will be much
better for the template (assuming >20% cache hit rate)

Test Plan:
  hg log -r 'gitnode("32cb236d579acb48668f8575205c0611b859e883")' -T '{node}\n'
  hg log -r 'g32cb236d579acb48668f8575205c0611b859e883' -T '{node}\n'
  hg log -r 'master~50::master' -T '{gitnode}\n'

Reviewers: #sourcecontrol, sid0

Reviewed By: #sourcecontrol, sid0

Subscribers: sid0

Differential Revision: https://phabricator.fb.com/D2074214
2015-05-15 13:36:16 -07:00
Durham Goode
72e331f593 sparse: fix temporary includes that are not in working copy
Summary:
There was a bug where rebasing a commit that contained a file that was not
currently in the working copy would cause an exception. This is because the
'temporarily include a file' logic tries to bring the file back to life
immediately, regardless of if the file actually exists yet or not (it may be an
incoming file from the upcoming merge, so it doesn't exist yet).

Test Plan: Added a test

Reviewers: sid0, rmcelroy, pyd, lcharignon

Reviewed By: lcharignon

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

Signature: t1:2083802:1432075849:7a90c94a97322ca619d481477fcc8812e7a26e93
2015-05-19 10:18:50 -07:00
Aaron Kushner
f9db07b833 Added pushvars to configs 2015-05-19 15:24:37 -07:00
Durham Goode
ddcf826f81 smartlog: fix masterrev supporting funky bookmark names
Summary:
The master revset config was not using scmutil.revrange/revsingle so it wasn't
able to handle bookmark names like 'foo-bar'. Let's use them.

Test Plan: Added a test

Reviewers: rmcelroy, sid0, lcharignon, ericsumner

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

Tasks: 7116971
2015-05-18 17:36:21 -07:00
Eric Sumner
d71ae7ebe1 Add fbconduit to setup.py 2015-05-14 13:04:08 -07:00
Eric Sumner
cc30c1fd65 fbconduit extension
Summary: Adds a template method to fetch hash translations from scmquery

Test Plan:
  [ericsumner@dev2048 ~/fbcode] time hg log -T '{node} {mirrornode("git")}\n' --config extensions.conduit=~/fb-hgext/fbconduit.py -r 'master~5::master' --config fbconduit.reponame=fbcode
  744def84d4821ae847ca9e2c31147ec495b0ff2a e498cef35914c5a7a8de648888e47b0d6c452044
  86d589bbed310cac765d1d2822f350c66f55ee30 a49473c0f0a0eaa532f0f25f8e632015dc57de87
  74e5eddf18a9e911b561d2f2f79c433971e36234 608e41cd9c4e8a0ba8dcd3f53162fed656354db0
  95a4cce9686558864af97631142a23eee1ffd1b0 228cbfc779da14306ae43002317bf59be9b3844d
  9ec5dfd21c5360bcff66ddd3db4747742da9bd56 115df93aa18a5003323f5419bbd135a9a08d96b9
  721fd7f98313aec4513bf86817bf98e01238ebdc 170cde24839d9213efa11f4f965402fd5e13cc9b

  real  0m0.407s
  user  0m0.229s
  sys 0m0.080s
  [ericsumner@dev2048 ~/fbcode] time hg log -T '{node} {mirrornode("git")}\n' --config extensions.conduit=~/fb-hgext/fbconduit.py -r 'ancestor(.,master)::master' --config fbconduit.reponame=fbcode | wc -l
  157

  real  0m2.718s
  user  0m0.504s
  sys 0m0.066s

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Subscribers: sid0, durham, lcharignon

Differential Revision: https://phabricator.fb.com/D2070465
2015-05-13 16:24:51 -07:00
Ryan McElroy
6653644dc8 add scm-prompt.sh 2015-05-13 10:49:24 -07:00
Ryan McElroy
e4914e56d3 add hg-new-workdir 2015-05-13 13:15:59 -07:00
Laurent Charignon
8f0e47e826 phrevset: fix because of changes in core
Summary:
phrevset: fix because of changes in core
Core changed the definition of stringset, it broke git and phabricator revset
that we define in fb-hgext. This is the same fix than the one we did for
the git revset.

Test Plan: N/A

Reviewers: durham, mitrandir

Differential Revision: https://phabricator.fb.com/D2065005
2015-05-12 11:14:44 -07:00
Nat Mote
d658ddc7f5 [githelp] keep rebase -i from blowing up when it is not given any arguments
Test Plan:
hg githelp -- rebase -i

does not throw an exception

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: elenapr

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

Tasks: 5816415

Signature: t1:2059248:1431424345:90189c30334194ddb78760811f98662785f1b13b
2015-05-08 19:31:59 -07:00
Ryan McElroy
d4dc8ae3cd fb-hgext: update for bookmarks api compatibility
Summary:
Bookmarks apis are changing in core, need to update these extensions to not
break across that change.

Test Plan: ran tests against current and latest hg with bookmarks patches applied.

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2059856
2015-05-09 20:22:31 -07:00
Laurent Charignon
d2f483b037 gitrevset: fix broken test caused by core's commit 48d6be2f1632
Summary:
We changed the way stringset work in core and we need to update our wrapping
in gitrevset. All the tests pass with this patch.

Test Plan: All tests are passing now

Reviewed By: pyd

Reviewers: durham, pyd

Differential Revision: https://phabricator.fb.com/D2055557
2015-05-07 17:46:30 -07:00
Durham Goode
9b0613badc fbhistedit: wrap the loaded histedit
Summary:
Instead of wrapping the system histedit, lets wrap the one that was loaded by
mercurial. This makes it easier to test fbhistedit against development versions
of histedit.

Test Plan:
Ran a histedit with --config extensions.fbhistedit=/data/... --config
extensions.histedit=/data/... and verified fbhistedit wrapped the custom
histedit. Also ran the tests.

Reviewers: davidsp, rmcelroy, sid0, lcharignon, pyd

Differential Revision: https://phabricator.fb.com/D2040653
2015-05-01 15:06:09 -07:00
Nat Mote
4bff2b7407 [githelp] prevent githelp clone from crashing
Test Plan:
hg githelp -- clone
hg githelp -- clone repo
hg githelp -- clone repo name

none crash

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: elenapr

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

Tasks: 6332308

Signature: t1:2042865:1430764240:af0dd592dfd2e19b863d5684a601572c3b6ec96c
2015-05-04 09:47:49 -07:00
Aaron Kushner
215c96605c Add extension to push shell variables to server side hg
Summary:
Create an extension that allows shell variables to be passed to the
server via command line option. When pushing with the following command:

 hg push --pushvars "DEBUG=1"

will make HG_SCM_DEBUG=1 available to the hooks. Note the prepending of HG_SCM_

Test Plan: Run run_tests

Reviewers: pyd, rmcelroy, durham

Reviewed By: durham

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

Tasks: 4841351

Signature: t1:1991994:1430417209:9a05fb11f9ecdeab3a1d89cf331014dafe7d959f
2015-04-14 16:43:51 -04:00
Durham Goode
d4caf4168e sparse: allow passing None as a rev to sparsematch
The remotefilelog extension just passes the ctx.rev() it was given down to
sparse. Sometimes this value is None. In this situation we would previously puke
(we expected calls to be repo.sparsematch() instead of repo.sparsematch(None)).
This change fixes that by allowing repo.sparsematch(None).
2015-04-30 09:55:35 -07:00
Durham Goode
9496b24f94 Add commitextras to setup.py 2015-04-30 10:14:52 -07:00
Durham Goode
e6b221f9d6 extras: add commitextras extension
Summary:
This adds an extension which will allow a user to specify commit 'extras' from
the command line. This will allow our repo sync script to include extra metadata
in the commits.

For instance, this is required in order to not lose git's committer info when
syncing into mercurial (which is required in order to make sure two commits with
the same content but different committers will produce a different hash in
Mercurial).

Test Plan: Added a simple test

Reviewers: pyd, lcharignon, mpm, sid0, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:2027341:1430255572:6866d0ba5564ca977c8fce41e55988883e15ce5b
2015-04-27 20:20:48 -07:00
Durham Goode
6b99e31175 fbamend: move evolve warning to be inside the amend command
Summary:
With the new evolve+inhibit ecosystem, we want to allow amend and amend --rebase
to continue working even when evolve is on. Let's move the evolve check to be
inside the amend command, and only complain when we see the evolve commands
enabled.

Test Plan: Added a test

Reviewers: lcharignon, pyd

Reviewed By: pyd

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

Signature: t1:2033649:1430346833:3116b704e49f634709a6fea32e217b94e731b96f
2015-04-07 13:52:59 -07:00
Durham Goode
62867737b2 smartlog: move changelog caching to be after revset
Summary:
When using evolve with the inhibit extension, calling a revset can change the
changelog (since which revs are filtered can change). This affects smartlog
because it tries to cache the changelog functions early on, and there operates
on an old changelog.

Fix this by caching the changelog functions after we've performed the revset.

Test Plan: hg sl -r '<hidden commit> + .'

Reviewers: lcharignon, pyd

Reviewed By: pyd

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

Signature: t1:2033643:1430357541:21c7a8c07ea8d145af4db40b835a3309239bbe6a
2015-04-07 13:52:11 -07:00
Durham Goode
be069ac108 smartlog: switch to using scmutil.revrange
Summary:
The smartlog rev option wasn't resolving names right because it used
the wrong internal api. Fixes that.

Test Plan: Adds a test

Reviewers: lcharignon, pyd

Reviewed By: pyd

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

Signature: t1:2033646:1430346864:be69cfb5fe3892f51340546b1fbb341fabfffe14
2015-04-29 15:00:31 -07:00
Ryan McElroy
099010405c sparse: alphabetize sparse config for test stability
Test Plan: Updated tests, ran tests many times with no more failures

Reviewers: ttung, durham, mitrandir, #sourcecontrol

Reviewed By: durham, mitrandir, #sourcecontrol

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

Signature: t1:2003040:1430327993:b5b439becb928f45a7594fb727b1335f95f992d0
2015-04-17 14:32:04 -07:00
Ryan McElroy
949908801c sparse: introduce flag on 'hg add' to update sparse config
Summary:
We want to be able to more seamlessly update sparse profiles when adding files.
This patch adds a `--sparse` flag to `hg add` that ensures the directory of the
added file is included in the sparse profile.

Test Plan: updated test

Reviewers: ttung, durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

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

Tasks: 6733090

Signature: t1:2003039:1430327770:295f1ac9960ca9dcb4ce84f76458faad68106272
2015-04-17 14:29:23 -07:00
Ryan McElroy
f5584b0c0f sparse: factor out config editing for reuse
Summary: this will be used in an upcoming diff

Test Plan: ran tests

Reviewers: ttung, #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2003035
2015-04-17 13:40:48 -07:00
Durham Goode
37f3fa1f19 gitlookup: change back to b2x
Summary:
My migration of gitlookup to not use b2x was too aggressive. Since the
servers still only respond to b2x, let's keep them as b2x where applicable.

Test Plan:
Ran the tests with the new mercurial (and in some cases with the old
as well).

Reviewers: pyd, sid0, rmcelroy, lcharignon, ericsumner

Differential Revision: https://phabricator.fb.com/D2016082
2015-04-22 14:49:20 -07:00
Durham Goode
be7516e6bc sparse: integrate with hgwatchman's ignore hash
Summary:
hgwatchman keeps a hash of the ignore matcher. Since we wrap the ignore
matcher to simulate a sparse checkout, we need to provide a hash that changes
as well.

Test Plan:
Adds a test. Verified the test failed without the change, and passed
with it.

Reviewers: rmcelroy, lcharignon, ericsumner, sid0

Reviewed By: sid0

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

Signature: t1:2022219:1429912457:51bf4677e1894ecca6da47a9fa6c4110f132c937
2015-04-24 12:29:31 -07:00
Durham Goode
68671bc1ff sparse: add matcher hash
Summary:
The hgwatchman extension relies on being able to compute a hash for the ignore
matcher.  Let's add hash functions to all our matcher wrappers. Once the
upstream code freeze is over we'll move some of this up into mercurial core.

Test Plan: This gets exercised by a test in a future patch

Reviewers: rmcelroy, mitrandir, lcharignon, ericsumner, sid0

Reviewed By: sid0

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

Signature: t1:2022211:1429912406:0be0dc280c8b3f465006eb79fb596c0c9b833342
2015-04-24 11:32:14 -07:00
Durham Goode
f3d08c9e4f sparse: make ignore matcher a real matcher
Summary:
Previously we replaced dirstate.ignore with a function that acted like a
matcher. It turns out that the hgwatchman extension relies on dirstate.ignore
being a matcher for computing hashes.

This changes our wrapping to use a matcher instead. In a future patch we'll add
a hash function to allow hgwatchman to continue to work.

Test Plan: This gets exercised by a test in a later diff.

Reviewers: rmcelroy, mitrandir, lcharignon, ericsumner, sid0

Reviewed By: sid0

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

Signature: t1:2022208:1429912354:588071e4930c81b36789bc84e9e00de788eaeda7
2015-04-24 11:31:07 -07:00
Durham Goode
5cd2a69ed5 Fix status on files in included subdirs
Summary:
There was a bug where if you included 'dir1/dir2/' in your sparse checkout, then
status would not show newly added files in that directory. The problem is that
dir1 is considered ignored, so the status walker would not walk down dir1.

The fix is to explicitly match subdirectories of specified include patterns.

Test Plan: Added a test

Reviewers: pyd, rmcelroy, lcharignon, sid0

Reviewed By: sid0

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

Tasks: 6773875

Signature: t1:2021037:1429899282:3e305afa9ed395473dbe11d80abc43becb9eaa4a
2015-04-24 09:52:00 -07:00