Commit Graph

244 Commits

Author SHA1 Message Date
Nat Mote
74577ff929 Have githelp for checkout guess whether the first argument is a path or rev
Summary:
The command `git checkout foo` uses a heuristic to determine whether to treat
'foo' as a revision or a path. We try to mimic that behavior as best we can, but
there will still be corner cases where it does not work.

In particular, if there is a file that is present in a previous revision but not
the current one, this will incorrectly assume that it's a revision.

Test Plan:
Added tests to make sure that it behaves properly for untracked files, tracked
files, deleted files, removed files, and names which are both revisions and
files.

Reviewers: durham, sid0, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: elenapr

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

Tasks: 6751516

Signature: t1:1996393:1429306520:2f13c194a8fe2a721bac501c5479250b2afe3f9e
2015-04-17 14:25:12 -07:00
Durham Goode
599649e115 sparse: add log --sparse
Summary:
Adds a --sparse option to log that limits the output to commits that
affect the working copy.

Test Plan: Added a test.

Reviewers: sid0, lcharignon, pyd, ericsumner, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:2002484:1429299577:a66f88157acc7136be9fe3b60f7fb02f830ae447
2015-04-17 10:01:55 -07:00
Durham Goode
af69020c32 fbhistedit: switch the stop action to be a histeditaction
Summary:
Upstream histedit has moved all it's actions to classes. Let's do the same for
stop.

The hashes change because upstream changed graft to include a little more
information in the commit metadata.

Test Plan: Ran tests

Reviewers: rmcelroy, sid0, lcharignon, pyd, ericsumner

Differential Revision: https://phabricator.fb.com/D2001830
2015-04-17 08:59:23 -07:00
Ryan McElroy
9d0379fb36 fbamend: configurable user education
Test Plan: ran it locally with chef_tested devbox and D2002135

Reviewers: durham, ericsumner, mitrandir, sid0

Reviewed By: sid0

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

Signature: t1:2002175:1429295959:535d264ebd9a2d23c8e1eebefb313b1654f28196
2015-04-17 10:17:23 -07:00
Ryan McElroy
efe74ca9a4 fbamend: add addremove (-A) option
Summary: Soemone noticed that this was missing

Test Plan: updated test

Reviewers: sid0, mitrandir, durham

Reviewed By: durham

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

Tasks: 6773162

Signature: t1:1994587:1429116229:64c8d9bcca1f7de7566d5a53e5f822e1658c1758
2015-04-15 09:29:09 -07:00
Pierre-Yves David
5291c13da1 add an extension to support the HG2Y format
Summary:
This extension will let use change bundl2 in core while still supporting old
client and server for a week or two.

Test Plan: I've running it for a day, I can successfully pull and push to server using HG2Y.

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D1973281
2015-04-07 11:37:55 -07:00
Durham Goode
933f828bb1 sparse: add temporarily included files when merging
Summary:
Now that we store a list of temporarily include files, and the ability to
clean them up, we now add the logic to add them in the first place. This watches
the actions provided by calculateupdates and adds any missing files to the
sparse checkout temporarily

Mucking with the dirstate and files on disk in the middle of calculateupdates
seems a little risky, but it seems to work.

Test Plan: Added new tests that require bringing in non-sparse changes as part of the merge.  Tests both the merge and rebase scenarios, using both normal checkouts and profiles.

Reviewers: sid0, pyd, lcharignon, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:1982951:1428636508:e5bcf4e6fbd635d49ff1ce7a90e9b5e1378537c9
2015-04-09 17:17:03 -07:00
Nat Mote
c170003d67 Githelp: properly handle '--' in checkout args
Summary: Treat all arguments after -- as path arguments.

Test Plan: Several test cases added to tests/test-githelp.t

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: elenapr

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

Tasks: 6199146

Signature: t1:1988585:1428960924:02ad487b9e17fecd7e98c045eeb01d8420247d33
2015-04-13 14:57:52 -07:00
Nat Mote
aca2687a3b Handle githelp for 'git commit --amend --no-edit'
Summary:
Suggest 'hg amend' because it does not pull up an editor, whereas 'hg commit
--amend' does.

Test Plan: Added test cases to tests/test-githelp.t to test for desired behavior.

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: elenapr

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

Tasks: 6199146

Signature: t1:1987860:1428949599:cdc1d66426ea343a7b0ed1bfcc2d28cbb685810d
2015-04-13 10:47:34 -07:00
Ryan McElroy
5f9e3bb604 fbamend: keep explicitly passed message
Summary: Previously, we would discard a message with passed to hg amend.

Test Plan: added a test

Reviewers: sid0, ericsumner, durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

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

Tasks: 6705470

Signature: t1:1973794:1428457860:68075660f34eff2c757757aad9ca11fb5ae040c0
2015-04-07 13:31:44 -07:00
Durham Goode
2cc36eb05c sparse: fix rebasing new sparse profiles
Summary:
Previously, hg update would fail if your sparse profile was not present in the
destination of the update. This had the affect of preventing users from rebasing
newly created sparse profiles.  Let's allow it (with a warning). This will allow
them to perform the rebase as long as all of the files they've changed exist in
the other sparse rules they have enabled. If they have no others, the sparse
profile will revert to a full checkout.

Test Plan: Added a test

Reviewers: rmcelroy, pyd, lcharignon, sid0

Reviewed By: sid0

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

Signature: t1:1967834:1428106927:04ef3a91a0f9f57f0a917d3a48e62e5e38341264
2015-04-03 16:45:36 -07:00
Laurent Charignon
8b3d2878c1 githelp: add git rebase --skip
Summary: githelp: add git rebase --skip

Test Plan: Wrote and ran test

Reviewers: mathieubaudet, rmcelroy, sid0

Differential Revision: https://phabricator.fb.com/D1946751
2015-03-26 12:48:36 -07:00
Andi Ni
1d750a090b Githelp now throws error rather than crashes on unrecognized option packed with other options.
Summary: Bug fixed by enclosing raw array remove with try-except block.

Test Plan: Run /tests/run-tests.py . It should finish without errors.

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, sigmix

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

Tasks: 6463098

Signature: t1:1927784:1426810833:b9a549d41eaaa55c420b480018298b725cc69aaf
2015-03-19 11:05:02 -07:00
Durham Goode
3d34417493 fbhistedit: fix to match upstream apis 2015-03-13 09:33:57 -07:00
Drew Gross
d4e6c1d643 Fix a bug that prevents hg up -d from working properly with our extensions
Summary: Allows the user to specify a date and only a date on the command line, and still get to the commit they want

Test Plan: Use hg up -d in a few of the normal ways, such as hg up -d 'Jan 1', hg up -d '<Mar 1' and they should all work.

Reviewers: rmcelroy

Subscribers: nmead

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

Tasks: 6015872
2015-03-02 10:54:07 -08:00
Ryan McElroy
a16275745c merge from default 2015-02-24 11:51:16 -08:00
Ryan McElroy
01936c5c53 smartlog: fix crash with non-public branches
Summary:
Previously smartlog failed when a branch head was not public.
Fix this and add a test to prevent regression.

Test Plan: New test, ./run-tests.py

Reviewers: ericsumner, sid0, mitrandir, durham

Reviewed By: durham

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

Tasks: 6120552

Signature: t1:1866905:1424799838:51d5f8501b20dc3757f825ba8a13d38eccec0bff
2015-02-23 22:54:08 -08:00
Ryan McElroy
264dbf8ad6 smartlog: centralize master option lookup
Test Plan: ```./run-tests.py --with-hg=$(which hg) -j 8```

Reviewers: durham, daviser, davidsp, mitrandir, ericsumner, pyd, sid0

Reviewed By: sid0

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

Tasks: 6274574

Signature: t1:1859443:1424455198:eeb81ecf0bd66c975b5c39b85710b6cd419912f2
2015-02-19 16:03:41 -08:00
Ryan McElroy
693b970149 smartlog: fix master ordering
Test Plan: ```./run-tests.py --with-hg=$(which hg) -j 8```

Reviewers: daviser, davidsp, mitrandir, ericsumner, pyd, durham, sid0

Reviewed By: sid0

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

Tasks: 6274574

Signature: t1:1859437:1424455215:f6a02deb5e2ad3cb57001da2dcba7d40fe9571e4
2015-02-19 15:50:16 -08:00
Ryan McElroy
dae96ce42f smartlog: factor out master revset calculation
Test Plan:
* Updated test

```
./run-tests.py --with-hg=$(which hg) -j 8
```

Reviewers: daviser, davidsp, mitrandir, ericsumner, pyd, sid0, durham

Reviewed By: durham

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

Tasks: 6274574

Signature: t1:1859427:1424479467:27b4a2ce644c97c04265b93e79332f169f78eda0
2015-02-19 14:39:54 -08:00
Durham Goode
634cdaf0a5 histedit: fix --continue with exec
Summary:
--continue was pretty broken before, in several ways:

1) It popped the rule after the 'exec'. I'm pretty certain this meant that rule
wasn't even running (two exec's in a row definitely weren't running).

2) 'exec' as the last step of the histedit would make it unrecoverable since
bootstrapcontinue tried to pop an empty list (because it popped the entry
ahead, see #1).

3) The replacements list it built associated any new commits from the exec with
the following commit instead of the previous. I just fixed this by not creating
any replacements in the exec --continue case, since it's currently not possible
to look backwards at what the original hash was.

4) That repo lock wasn't actually being released when doing further exec's in a
continue/abort.  Upstream histedit creates a new histedit state object that
doesn't contain the actual locks, so we weren't actually unlocking it.


The fix is to most of this is to just delete all the copy/paste and make
--continue/--abort literally do nothing special when recovering from an exec.
If there are still pending changes, we just abort and tell people to fix it.

I sent a fix upstream to fix the locking issue.

Test Plan: Added tests

Reviewers: mitrandir, davidsp, sid0, rmcelroy, ericsumner

Differential Revision: https://phabricator.fb.com/D1853944
2015-02-17 20:04:40 -08:00
Eric Sumner
c81d3f9f70 [writecg2] Fix conflict with bundle2 bundlerepo work
Summary:
If bundle2 backups are turned on, don't write the nonstandard format; just
allow reading them.

Test Plan: ##run-tests##

Reviewers: durham, pyd, mpm, #sourcecontrol, sid0

Reviewed By: #sourcecontrol, sid0

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

Tasks: 6271882
2015-02-17 14:04:28 -08:00
Siddharth Agarwal
715aac06f5 [gitrevset] don't error out when there's no git node
Summary: Templates are not supposed to abort when there's no data for them. Ensure that the `{gitnode}` template has the same behavior.

Test Plan: tests, and tested by hand on a local commit in fbcode

Reviewers: davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner, durham

Reviewed By: durham

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

Tasks: 6235780

Signature: t1:1851847:1424199479:3e2d7fb7fb7b8a60f36605279f9e2a706a42dfbd
2015-02-17 10:53:25 -08:00
Ryan McElroy
adaac17406 fbamend: add text box user education message
Test Plan: udpated test

Reviewers: sid0, durham

Reviewed By: durham

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

Signature: t1:1847192:1423853563:81c064ffc591b64beb4f5b5c5b751f18f9e8d8c2
2015-02-12 21:16:58 -08:00
Ryan McElroy
5bcd0b8fc0 merge from default 2015-02-13 16:01:50 -08:00
Durham Goode
6b82267a16 Merge with default 2015-02-13 11:34:05 -08:00
Ryan McElroy
5cdf597fd6 fbamend: histedit awareness
Summary:
Previously, fbamend allowed all sorts of atrocities during histedits, literally
destroying the world. Literally. Make fbamend histedit-aware -- it will now
give correct advice and refuse to delete old commits during a histedit.

Test Plan: Updated tests

Reviewers: sid0, daviser, davidsp, ericsumner, pyd, mitrandir, durham

Reviewed By: mitrandir, durham

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

Signature: t1:1844984:1423768068:edc85af8b203aefdcdac9d7fee0425fc1f1c5281
2015-02-12 11:02:34 -08:00
Ryan McElroy
76aaf399ba fbamend: intelligently keep non-bookmarked rev preamends up to date
Summary:
Previously, without a bookmark, the preamend bookmark would get out of date
with a second hg amend. Be more intelligent here and fix up the preamend
bookmark when re-amending.

Test Plan: updated unit test

Reviewers: sid0, mitrandir, ericsumner, daviser, durham

Reviewed By: durham

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

Signature: t1:1844331:1423864952:fdc9f0c232407d5e6aa98a3030c7f4d28e6ad169
2015-02-12 20:43:29 -08:00
Ryan McElroy
6596b361b3 fbamend: factor out preamend bookmark naming
Summary: Less copypasta, more win.

Test Plan: ./run-tests.py

Reviewers: sid0, daviser, davidsp, ericsumner, mitrandir, durham

Reviewed By: durham

Subscribers: pyd

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

Signature: t1:1844329:1423764680:adce79e4d06727a0910f21afdfb80439c6bbbe8c
2015-02-12 02:16:28 -08:00
Ryan McElroy
6f8358819a fbamend: change suffix to remove parentheses
Summary:
While working with fbandroid folks working in OSX, it looked like there were
some issues with escaping parentheses in the console. Also, parens are annoying
to type even in Linux. Let's have a lighter-weight suffix to the preamend
bookmarks.

Test Plan: ./run-tests.py

Reviewers: durham, sid0, mitrandir, daviser, ericsumner

Differential Revision: https://phabricator.fb.com/D1844272
2015-02-11 20:01:03 -08:00
Ryan McElroy
b1a851bb16 fbamend: add real testing
Summary: Previously the tests didn't actually check fbamend's functionality.

Test Plan: ./run-tests.py

Reviewers: durham, sid0, mitrandir, ericsumner, daviser

Differential Revision: https://phabricator.fb.com/D1844282
2015-02-12 02:32:51 -08:00
Mateusz Kwapich
8683108d87 [pushrebase] Adjust tests to new strip backup file names
Test Plan: run tests

Reviewers: sid0, davidsp, pyd, daviser, durham

Reviewed By: durham

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

Signature: t1:1825833:1423087754:245c6460599f495fb12dafe5f76d4f6ee4826c62
2015-02-04 13:47:49 -08:00
Eric Sumner
34002e0224 hgext: fix many tests, run-tests, writecg2 for hg3.3
Summary: Still need to fix pushrebase

Test Plan: ##run-tests.py##

Reviewers: sid0, daviser, davidsp, mitrandir, akushner, rmcelroy, pyd, mpm, durham

Reviewed By: durham

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

Signature: t1:1813630:1422573745:c5ea2a8acdfda0e555d1ae56a16f4fb5e5618174
2015-01-29 15:06:06 -08:00
Eric Sumner
b1826220fd merge 2015-01-22 11:36:27 -08:00
Eric Sumner
f7fe9ba411 merge 2015-01-22 11:35:54 -08:00
Eric Sumner
a5c0bda96f merge from default 2015-01-22 11:34:42 -08:00
Eric Sumner
1c0fd006c9 smartlog: add revset function
Summary:
I wanted a way to see a commit in relation to the other smartlog entries, so
I refactored smartlog to provide a revset function for its default selections.

Test Plan: ##run-tests##

Reviewers: durham

Reviewed By: durham

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

Tasks: 6057467

Signature: t1:1794762:1421888058:9b96d26f68b9b3bac24ef43db58fe8aa0299de37
2015-01-21 12:20:33 -08:00
Durham Goode
2b4b3831c8 Fix rebase with no-op changes
The sparse checkout extension had a pretty bad flaw where rebasing across
certain no-op file changes would fail the rebase. This was due to Mercurial
adding a 'keep' action on those files and that action getting translated to a
'remove' by the sparse extension, then failing to edit the dirstate during the rebase
branchmerge.

The fix is to only issue 'remove' actions if we're not in a branchmerge
and the file in question is in the workingcopy but shouldn't be.

I also added more validation for the branchmerge scenario to make sure we aren't
losing any dirstate data.  It will basically abort if any action besides 'keep'
is performed on a file outside the sparse checkout.
2015-01-14 16:31:01 -08:00
Durham Goode
b638332657 Update sparse to match upstream
Upstream Mercurial has changed the return value of merge.calculateupdates in two
ways: 1) actions is now a file->action mapping instead of a
actiontype->list-of-files mapping, 2) it now returns actions, diverge,
renamedelete where the last two are just used for displaying to the user and can
be pretty much ignored by the sparse extension.
2015-01-06 11:38:33 -08:00
Siddharth Agarwal
394399bc7e merge with default 2014-12-17 21:09:54 -08:00
Durham Goode
6faa874013 Merge with default 2014-12-16 19:08:03 -08:00
Eric Sumner
4ba902f661 pushrebase: add node argument to changegroup hook
Summary: This is expected by the remotefilelog hook, and possibly others

Test Plan: ##run-tests.py##

Reviewers: durham, pyd, sid0

Reviewed By: sid0

Subscribers: calvinb, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham

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

Signature: t1:1743261:1418762431:4fbbc1ed800023ddc51dbf53703e58294fbc2a4c
2014-12-16 12:38:48 -08:00
Eric Sumner
a540ffa647 pushrebase: enable pushback always
Test Plan: ##run-tests.py##

Reviewers: durham, pyd, sid0

Reviewed By: sid0

Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham

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

Signature: t1:1743234:1418762853:e406ef2b4a22601596e0629e4561b2a7ca9a0df3
2014-12-16 11:44:45 -08:00
Durham Goode
acbfa0551c Fix sparse strip -r . -k
Summary:
strip -r . -k rebuilds the dirstate and was inserting filtered entries
into the dirstate. This fixes rebuild to exclude sparse files.

Test Plan: Added a test

Reviewers: sid0, pyd, davidsp, mitrandir, rmcelroy

Differential Revision: https://phabricator.fb.com/D1743331
2014-12-16 11:35:41 -08:00
Ryan McElroy
34be666d38 tweakdefaults: allow update to current rev when working copy is not clean
Summary:
https://www.facebook.com/groups/sourcecontrol/permalink/759079160808373/

Many thanks to @sid0 for guidance here.

Test Plan:
Ran this script:

  hg up master
  echo a >> README.txt
  arc feature foo

Before it failed, now it works.

Also a new test.

Reviewers: sid0

Reviewed By: sid0

Subscribers: hannesr, sid0

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

Tasks: 5810509

Signature: t1:1738821:1418669776:18cd358a99254f7552dacb9b9aa1599364b2d47d
2014-12-13 18:13:41 -08:00
Siddharth Agarwal
e152cffbcb merge with default 2014-12-12 16:49:03 -08:00
Eric Sumner
af1b675338 pushrebase: call changegroup/incoming hooks
Summary:
The rebase extension bypasses the changegroup processing hooks, so they need to
be called explicitly.

Test Plan: Added hooks to the existing test

Reviewers: pyd, durham

Reviewed By: durham

Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner

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

Signature: t1:1726408:1418241039:4e51a6dcbf3134f12d55c8e902de9ca7086883d1
2014-12-08 15:43:58 -08:00
Eric Sumner
bfd9ea6e54 Remove head/tail safety parameters; commit dummyssh into the test directory
Test Plan: ran test

Reviewers: pyd, durham

Reviewed By: durham

Subscribers: rmcelroy, daviser, mpm, davidsp, sid0, akushner

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

Signature: t1:1722193:1417813982:18951855d64d13d868ca80be92b7a3ecb631337b
2014-12-05 11:02:01 -08:00
Durham Goode
03deffb1a5 Merge with default 2015-01-14 16:40:02 -08:00
Siddharth Agarwal
f5b98a0424 add a hacky extension to write changegroup2 on strip
Summary:
Through experiments we've found that for highly interleaved histories, generating a changegroup2 can be 6-7x as slow as generating a changegroup1.

While we work this out upstream, ship an extension to write changegroup2s out to disk.

Note that we'll only write cg2s for strips (and related operations like amend) -- for regular bundles we'll continue to write changegroup1 for maximum compatibility.

Test Plan:
Ran the included tests. Also ran the full Mercurial test suite with:

```
python run-tests.py -j32 --extra-config-opt extensions.writecg2=/home/sid0/local/fb-hgext/writecg2.py
```

Finally, tried it out in fbobjc. Found a 6x gain in strip performance with this extension enabled.

Reviewers: durham, davidsp, rmcelroy, akushner, daviser, mitrandir, ericsumner, pyd

Reviewed By: pyd

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

Signature: t1:1774334:1420844207:461b830aafd7728ea3b5593fe0a02f6f66444ec3
2015-01-08 22:46:29 -08:00
Durham Goode
20c9081310 Merge with default 2015-01-06 11:42:46 -08:00
Ryan McElroy
76ff0ca413 Create simple cache for export and log
Test Plan:
 * New test
 * Ran all mercurial tests with this extension enabled. Most tests passed, and the ones that failed were due to additional output thansk to the enabled extension (eg, help screens mentioning the extenstion, and config dumps listing the extension as enabled).

Reviewers: sid0, davidsp, pyd, durham

Reviewed By: durham

Subscribers: ps

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

Tasks: 5503905

Signature: t1:1691116:1418066154:9d0950b7395038a7fa95b4ec26f9360ea2db9fc6
2014-11-19 10:10:03 -08:00
Ryan McElroy
e32d2ef5da tweakdefaults: make update --check default; override with --nocheck
Summary:
After discussion in https://www.facebook.com/groups/sourcecontrol/permalink/755390834510539/ and playing around with the behavior,
I'm convinced this is the more user-friendly option for people. It's not git's behavior, but it's safer than git's and *way* safer
than mercurial's default.

Test Plan: Updated test

Reviewers: sid0, pyd, davidsp, durham

Reviewed By: durham

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

Signature: t1:1717431:1417654306:a584a85cfe76fd03d29a3391f83892af41d26cb6
2014-12-03 15:45:53 -08:00
Durham Goode
1c9827a983 Merge with default 2014-12-02 13:46:23 -08:00
Durham Goode
08d5465b17 sparse: add sparse checkout extension
Summary:
Adds a sparse checkout extension that allows you to checkout just part of the
working copy.  This only affects the working copy, it does not affect history,
or what is pushed and pulled from the server.

The basic api is:

hg sparse --include PATTERN...  # add a pattern to the sparse checkout
hg sparse --exclude PATTERN...  # excludes files from the sparse checkout
hg sparse --delete PATTERN...   # deletes an include/exclude rule
hg sparse --enable-profile      # enables a predefined sparse profile
hg sparse --disable-profile     # disables a predefined sparse profile
hg sparse --reset               # makes the repository full again
hg sparse --refresh             # refreshes the working copy if .hg/sparse was
modified manually
hg sparse                       # show the current sparse rules

Test Plan:
Added tests. Ran them. Also deploy it to a couple users for a bit
without major issues.

Reviewers: pyd, sid0, rmcelroy, davidsp, mpm

Subscribers: mitrandir, akushner

Differential Revision: https://phabricator.fb.com/D1698824
2014-12-01 11:02:08 -08:00
Eric Sumner
9cd35a5772 [pushrebase] Send changes back over the wire
Summary: Use the bundle2 reply stream to send changes back to the client

Test Plan: Ran test

Reviewers: pyd, durham

Reviewed By: durham

Subscribers: rmcelroy, daviser, mpm, davidsp, sid0, akushner

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

Signature: t1:1689551:1416948875:987c7440298aa57d5cf46d420feab151ce9340b1
2014-11-18 16:36:46 -08:00
Eric Sumner
b33de4dbea [pushrebase] Send changes back over the wire
Summary: Use the bundle2 reply stream to send changes back to the client

Test Plan: Ran test

Reviewers: pyd, durham

Reviewed By: durham

Subscribers: rmcelroy, daviser, mpm, davidsp, sid0, akushner

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

Signature: t1:1689551:1416948875:987c7440298aa57d5cf46d420feab151ce9340b1
2014-11-18 16:36:46 -08:00
Durham Goode
7f2f4a68d6 Fix phase after reset
Unbundling during a reset left the commit as public. This fixes the unbundled
commits to be draft.
2014-11-20 13:54:13 -08:00
Eric Sumner
8ccb57bef0 [rfc] Server-side rebasing extension
Summary:
Adds a new bundle2 parttype to accept a linear changegroup and rebase it onto
the designated position on the server.

Future work:

* Issue the new parttype from ##hg push## (under what circumstances?)
* Return new revisions to client in the bundle2 response
* Write automated tests
* Support v2 changegroup packing?
* Test compatibility with the extensions we commonly use

Test Plan:
Diff includes an hg command that issues the new parttype; have used it to test
manually on a repository with 2 files.

Reviewers: akushner, sid0, davidsp, mpm, daviser, rmcelroy, pyd, durham

Reviewed By: durham

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

Signature: t1:1670811:1416335316:05c5ae8a35ba28cab87c474bab28afe91e8702d2
2014-11-07 16:27:47 -08:00
Eric Sumner
70d6902af9 [rfc] Server-side rebasing extension
Summary:
Adds a new bundle2 parttype to accept a linear changegroup and rebase it onto
the designated position on the server.

Future work:

* Issue the new parttype from ##hg push## (under what circumstances?)
* Return new revisions to client in the bundle2 response
* Write automated tests
* Support v2 changegroup packing?
* Test compatibility with the extensions we commonly use

Test Plan:
Diff includes an hg command that issues the new parttype; have used it to test
manually on a repository with 2 files.

Reviewers: akushner, sid0, davidsp, mpm, daviser, rmcelroy, pyd, durham

Reviewed By: durham

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

Signature: t1:1670811:1416335316:05c5ae8a35ba28cab87c474bab28afe91e8702d2
2014-11-07 16:27:47 -08:00
Tiina Turban
07f9a3036f commit-info flag for smartlog
Summary: `hg sl/slog/smartlog` has a new flag `--commit-info`, which shows the files changed in currently active commit.

Test Plan:
Modified & added & removed a file to in commit.
The deleted, unknown, ignored and clean are not relevant, when we are talking about a change in a commit - right?

  hg sl
  hg sl --commit-info
  hg sl -T "blaa" --commit-info
  hg slog
  hg slog --commit-info
  hg slog -T "blaa" --commit-info

Commit-info flag adds info under current commit about the added, modified & removed files.

  hg sl --commit-info --stat
This looks weird as it shows the current commit changes twice. Should I care about this?

  #in fb-hgext/tests
  ./run-tests.py  test-smartlog.t

test passes.

Reviewers: sid0, pyd, davidsp, durham

Reviewed By: durham

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

Tasks: 5418936

Signature: t1:1677101:1415833805:975ce43aaaf1ccabe6a054d09a9e5f236447340f
2014-11-10 18:45:39 -08:00
Durham Goode
b9e4876c60 Add evolve support to reset command
Summary:
When evolve is enabled, reset should use prune and touch instead of
strip and unbundle.

Test Plan: Added tests.

Reviewers: pyd, sid0

Differential Revision: https://phabricator.fb.com/D1641160
2014-10-27 10:11:48 -07:00
Siddharth Agarwal
7e95bdd9c0 [gitgetmeta] support named branches
Summary: The named branches support adds a new file called git-named-branches. Support that.

Test Plan: Ran the tests.

Reviewers: durham

Reviewed By: durham

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

Signature: t1:1655756:1415047400:14a3a082390af25c713ef4d9f8721efb05e20875
2014-11-03 12:39:16 -08:00
Ryan McElroy
f081a79415 Make empty reset command unadd files
Test Plan: updated test

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1645931
2014-10-28 22:44:17 -07:00
Durham Goode
47b86129f0 Add reset command
Summary:
This adds a 'hg reset' command that acts similar to 'git reset'. It moves your
active bookmark to the desired location, along with your working copy parent. If
no flags are specified, the working copy contents is left alone. If --clean is
specified, the working copy contents is overwritten.

By default we will attempt to recover the commit from the backup bundles if it
is not in the repository. A future commit will add support for using touch/prune
when evolve is enabled.

Test Plan: Added tests, and ran them

Reviewers: sid0, davidsp, pyd, mpm, akushner, rmcelroy

Differential Revision: https://phabricator.fb.com/D1637658
2014-10-23 18:56:24 -07:00
Siddharth Agarwal
b4c11162d8 fix smartlog for Mercurial changes
Summary:
Use `first()` instead of `[0]`.

Also fix coloring under non-ANSI terminals (required to get the test working).

Test Plan: Ran the tests. Also ran `hg sl` with this in a few of my repos.

Reviewers: durham, davidsp, akushner, daviser, rmcelroy, pyd

Reviewed By: pyd

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

Tasks: 5375006
2014-10-17 13:35:52 -07:00
David Soria Parra
9333c05d2b fbhistedit: make stop compatible with hg tip
Summary: Make stop compatible with the new hg tip

Test Plan: run tests, worked.

Reviewers: pyd, durham, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1623384
2014-10-16 13:58:47 -07:00
David Soria Parra
260cef360d fbhistedit: add x/exec command
Summary:
Add an execute command. This works similar to git's exec. However this
patch is a bit hacky but I want to get a first version out to our users. We have
to change some parts in histedit to make it easier to hook into
bootstrapcontinue and verifyrules. At the moment we can't get around copying
the implementation. Also need to add tests for obsolence.

Test Plan: Run tests, see it works.

Reviewers: pyd, sid0, durham

Reviewed By: durham

Subscribers: akushner, rmcelroy

Differential Revision: https://phabricator.fb.com/D1611838
2014-10-11 20:47:31 -07:00
Mateusz Kwapich
4f207dd263 Added phabdiff template mapping
Summary:
The phabdiff template mapping returns the phabricator diff id for the commit
(based on commit message).

for example:
$ hg log -r master --template '{phabdiff}\n'
D1485506

Test Plan:  - unit tests addded

Reviewers: sid0, durham

Reviewed By: durham

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

Tasks: 5124920
2014-10-16 17:43:58 -07:00
Siddharth Agarwal
7a87af3b49 fix smartlog for Mercurial changes
Summary:
Use `first()` instead of `[0]`.

Also fix coloring under non-ANSI terminals (required to get the test working).

Test Plan: Ran the tests. Also ran `hg sl` with this in a few of my repos.

Reviewers: durham, davidsp, akushner, daviser, rmcelroy, pyd

Reviewed By: pyd

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

Tasks: 5375006
2014-10-17 13:35:52 -07:00
Durham Goode
a5fe3b9faf Merge diverged heads 2014-10-14 17:24:06 -07:00
Durham Goode
5986c64daf Update reflog to work with upstream bookmark.write changes
Upstream no longer always uses bookmark.write to write.  Sometimes it goes
through the transaction API and uses bookmark._write. So now we wrap that
instead.

Also adds a test that would have caught this, since the existing commit/bookmark
tests did not exercise this new write path.
2014-10-14 17:23:09 -07:00
David Soria Parra
0abdf44f41 fb-histedit: Add a histedit extension that adds stop
Summary:
Add 'stop' verb to histedit. This is the version I submited to the ML
which got rejected because it doesn't preserve hashes. However as arc will
always modify the hash anyway that's save for us anyawy.

Test Plan: run tests, worked.

Reviewers: durham, sid0

Subscribers: akushner

Differential Revision: https://phabricator.fb.com/D1606075
2014-10-09 10:54:43 -07:00
Durham Goode
bd577925d9 reflog: adds a reflog extension to fb-hgext
Summary:
This adds an extension that tracks the locations of the working copy and
bookmarks over time. It's still a proof of concept, but I want to get it
deployed to start getting feedback.

Running `hg reflog` by default shows the previous locations of the working
copy (most recent first).

  ~/myrepo> hg reflog
  Previous locations of '.':
  35a5fcfee452  rebase -d master
  32eee5e2d406  up .^
  b5d6dab4f900  up foo -C

Specifying a bookmark name shows the locations of that bookmark over time.

  ~/myrepo> hg reflog foo
  Previous locations of 'foo':
  d1a696044ec0  rebase -d master
  35a5fcfee452  rebase -d master
  32eee5e2d406  book foo -f

--verbose will show more information about each entry.

  ~/myrepo> hg reflog foo -v
  Previous locations of 'foo':
  35a5fcfee452 -> d1a696044ec0 durham   2014-10-01 18:32:14  rebase -d master
  32eee5e2d406 -> 35a5fcfee452 durham   2014-10-01 17:28:54  rebase -d master
  000000000000 -> 32eee5e2d406 durham   2014-10-01 17:28:30  book foo -f

It's currently stored as a single .hg/reflog file that is append only. Each
entry can store an arbitrary number of hashes (like storing 2 hashes for a merge
state working copy), which means we could also potentially use this to track
heads in branches as well.

It also (sorta) works with '-T json' for machine readable output:

  ~/myrepo> hg reflog foo -T json
  [
   {
    "command": "up .^",
    "date": "2014-10-02 13:54:45",
    "newhashes": "474ff61d1a36",
    "oldhashes": "d1a696044ec0",
    "user": "durham  "
   },
   {
    "command": "book foo",
  ...
  ]

Test Plan: Added tests. Ran them.

Reviewers: sid0, pyd, mpm, davidsp, akushner

Differential Revision: https://phabricator.fb.com/D1592875
2014-10-02 14:04:54 -07:00
Siddharth Agarwal
883a155fdd [tweakdefaults] superpower grep
Summary:
Add a bunch of features to make `hg grep` full-featured.

- Support for basic, extended and Perl regexps.
- Support for filter patterns, including filesets.
- Support for color in the output.

Test Plan: Ran the tests, and ran `hg grep` against the repo.

Reviewers: davidsp, akushner, pyd, daviser, durham

Reviewed By: durham

Subscribers: robarnold

Differential Revision: https://phabricator.fb.com/D1578743
2014-09-25 13:50:36 -07:00
Erin Davis
51411dc368 Swapped the functionality of grep with wgrep and added histgrep
Summary: I added a grep command that does the wgrep alias. I also moved the traditional functionality of grep to histgrep. One thing missing is the help strings.

Test Plan:
I used both wgrep and my new grep on a couple queries in www. They returned the same results. I did similar things with the traditional grep and my histgrep.

I wrote tests in fb-hgext/tests/test-tweakdefaults.t and they passed.

Reviewers: pyd, davidsp, akushner, durham, sid0

Reviewed By: durham, sid0

Subscribers: akushner, micha

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

Tasks: 5162839
2014-09-24 15:11:10 -07:00
Siddharth Agarwal
db408787ea [gitrevset] also support stringsets
Summary: Allow git hashes to work with a `g` suffix, sort of like Subversion's `r`.

Test Plan: Ran the tests, and tested it out in fbandroid-hg.

Reviewers: davidsp, akushner, pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1571258
2014-09-22 18:58:36 -07:00
Siddharth Agarwal
d992bf1282 [tweakdefaults] fix rebase when destination contains a hyphen
Summary: With tweakdefaults `hg rebase` broke when the destination contained a hyphen. This made me sad :(

Test Plan: Tested rebase with hyphen, and ran tests.

Reviewers: pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1565265
2014-09-18 17:22:14 -07:00
Siddharth Agarwal
2610f6b5fe [gitlookup] fix compatibility with Mercurial 3.2
Summary: The location of `bundle2caps` changed.

Test Plan: Ran the tests, saw that they no longer failed.

Reviewers: durham, davidsp, akushner, pyd

Reviewed By: pyd

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

Tasks: 5170539
2014-09-17 16:40:37 -07:00
Siddharth Agarwal
5c8fd3cbd8 merge with default 2014-09-17 16:38:57 -07:00
Siddharth Agarwal
18687164fa fix test-fbamend.t for Mercurial 3.2 2014-09-17 16:37:11 -07:00
Siddharth Agarwal
70693db843 add some convenience features 2014-09-08 12:49:25 -07:00
Jez Ng
047c4ecd44 Add gitrevset support.
Test Plan: Extended unit tests.

Reviewers: sid0, durham

Reviewed By: durham

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

Tasks: 5049742
2014-09-08 15:36:12 -07:00
Siddharth Agarwal
bb96467321 [tweakdefaults] use hint for no-arg update message
Summary: This makes the error easier to read.

Test Plan: Ran `hg update`, saw that the error was printed across two lines.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1542591
2014-09-08 12:43:38 -07:00
Durham Goode
d1e9ad4603 Fix hg update -r 2014-09-03 08:46:45 -07:00
Durham Goode
0df0625354 Fix 'update -r' to work with the new defaults
Summary:
The tweakdefaults extension broke 'hg update -r'. This fixes it and
adds a test.

Test Plan: Added a test.

Reviewers: sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1506040
2014-08-19 11:21:45 -07:00
Durham Goode
f8b8c6a763 Tweak default update, log, and rebase behaviors
Summary:
This makes tweaks to the Mercurial defaults, to improve the user experience:

- hg update without arguments now aborts
- hg log now defaults to -f
- hg rebase without -d now aborts
- hg rebase will fast forward a bookmark if possible

Test Plan: Added a test, ran it.

Reviewers: mpm, sid0, davidsp, dschleimer, akushner

Differential Revision: https://phabricator.fb.com/D1501398
2014-07-23 09:47:35 -07:00
Pierre-Yves David
805376a3bc test: glob an explicit mercurial version in fbamend test
Silly me.
2014-06-16 14:27:45 -07:00
Pierre-Yves David
77c4dddd95 test: glob an explicit mercurial version in fbamend test
Silly me.
2014-06-16 14:27:45 -07:00
Pierre-Yves David
b49da34abc fbamend: auto-disable when evolution is enabled
fbamend is not compatible with evolution. We now detect such situation and
noisily disable fbamend in that case.
2014-06-11 22:34:21 -07:00
Pierre-Yves David
84158ce683 test: add a very basic test for fb-amend
The next changeset will make some change to fbamend. I'm introducting a
minimalist test to be able to test the change.
2014-06-12 17:53:50 -07:00
Pierre-Yves David
3d194165f5 fbamend: auto-disable when evolution is enabled
fbamend is not compatible with evolution. We now detect such situation and
noisily disable fbamend in that case.
2014-06-11 22:34:21 -07:00
Pierre-Yves David
b5902fafde test: add a very basic test for fb-amend
The next changeset will make some change to fbamend. I'm introducting a
minimalist test to be able to test the change.
2014-06-12 17:53:50 -07:00
Siddharth Agarwal
5322d7b6fe add a command and server-side support to fetch git metadata
Summary:
When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it.

This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be

- part of hg-git
- not send the entire git metadata over, just the bits that are needed based on a common/heads computation
- be dependent on bundle2
- (probably) be part of the pull operation, not a separate command
- be configurable with an option

This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack.

Test Plan:
Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592

(in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059)

    hg gitgetmeta ../fbandroid-from-git

Saw that 3 files were written out.

    hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git

Saw that 3 files were written out.

Reviewers: dschleimer, davidsp, akushner, durham, pyd

Reviewed By: pyd

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

Tasks: 3751836
2014-05-20 22:32:54 -07:00