Commit Graph

29 Commits

Author SHA1 Message Date
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
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