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
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
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
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
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
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
Summary: githelp: add git rebase --skip
Test Plan: Wrote and ran test
Reviewers: mathieubaudet, rmcelroy, sid0
Differential Revision: https://phabricator.fb.com/D1946751
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
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
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
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
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
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
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
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
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
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.
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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