Commit Graph

41 Commits

Author SHA1 Message Date
Martijn Pieters
e6534bdce7 githelp: Handle the "git branch -m new" case correctly
Summary:
"git branch -m new" renames the *current* branch. Add a shell command to read
the current bookmark when omitted from the git branch -m command line.

Test Plan:
Run tests with:

  cd tests && python run-tests.py test-githelp.t

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: rmcelroy, durham

Subscribers: mitrandir

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

Tasks: 8905356

Signature: t1:2679470:1448062781:d877b60bc2d675efac8d4814f9f89713e1c2630d
2015-11-21 18:02:15 +00:00
Artur Beznosyuk
85f5b6680f Added difftool command to githelp.
Summary: Added translation for 'git difftool' command. There is no direct command enabled by default, but the user could use extdiff extension, so I added basic info about enabling it.

Test Plan: run 'hg githelp -- git difftool'. For testing on local machine follow the instructions here https://our.intern.facebook.com/intern/wiki/Mercurial/ContributingToInternalHg/

Reviewers: #sourcecontrol, rmcelroy, cdelahousse

Reviewed By: rmcelroy

Subscribers: donhusa

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

Tasks: 7942323

Signature: t1:2542230:1444863661:edea8d760c4a8e828966bf79a9addacc932b38d0
2015-10-14 12:25:14 -07:00
Christian Delahousse
bcaf93b996 Added git checkout -f without args to githelp
Summary:
`githelp` supported `git checkout -f xyz` but not the same command with out a
path or a rev. Added support for it and wrote a test.

Test Plan:
Added tests and ran them.

Task: #7499727

Reviewers: ericsumner, durham

Reviewed By: durham

Subscribers: joesavona

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

Signature: t1:2372309:1440530832:cb32553b2ef7f7ff0e09cb80ff6449a8c26c2caf
2015-08-21 16:32:43 -07:00
Durham Goode
868dc4af4b githelp: improve rebase -i message 2015-08-12 17:05:21 -07:00
Josh Braegger
5576d9be8d githelp: Add 'deprecated' message for 'git whatchanged'
Summary: Just in case someone trys to use 'git whatchanged', at least tell them why it's not supported

Test Plan: added a test

Reviewers: rmcelroy

Reviewed By: rmcelroy

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

Tasks: 7966012

Signature: t1:2329289:1439242809:56fb56704e1110dc95a6366ee9c3eb948e1bf415
2015-08-10 14:00:23 -07:00
Ryan McElroy
54c9d29495 fix some failing tests 2015-07-06 19:17:17 -07:00
Nivedita Chopra
17971958a7 Githelp for 'git checkout -p'
Summary: Implemented hg githelp for 'git checkout -p'

Test Plan:
```
% hg --config extensions.githelp=~/fb-hgext/githelp.py githelp -- git checkout -p xyz
hg revert -i xyz

% hg --config extensions.githelp=~/fb-hgext/githelp.py githelp -- git checkout --patch xyz
hg revert -i xyz
```

Reviewers: akushner, durham

Reviewed By: durham

Subscribers: kowshik

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

Tasks: 6562030

Signature: t1:2209388:1435801909:64db532cd3eeeea05f17c43988958f3fa0dcaae2
2015-07-01 11:38:40 -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
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
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
Nat Mote
49854411f8 Githelp grep improvements
Summary:
Since hg grep and git grep are similar for basic usage (pattern first and then
paths), just copy all the git arguments to the suggested hg command.

Test Plan: Test added to test-githelp.t

Reviewers: rmcelroy, durham

Reviewed By: durham

Subscribers: elenapr

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

Tasks: 6524222

Signature: t1:2009460:1429647852:2bfaf32b8c7849e948e5da03989fad32c1b06780
2015-04-21 10:21:17 -07:00
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
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
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
Mateusz Kwapich
fd872ab219 [githelp] Add reflog to githelp
Test Plan: .

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: #sourcecontrol, rmcelroy

Subscribers: rmcelroy

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

Tasks: 6579083
2015-03-23 20:44:52 -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
Ryan McElroy
f19c04580a Merge fbonly into default
Summary:
A ton of tests in the 'default' branch are broken, yet they all work in 'fbonly' (because that's what we test and push).

Let's give the world all of our goodness. Bleeding edge is where it's at.

Top of hg sl now looks like:

```
@    386a20  rmcelroy
|\   merge fbonly into default
| |
o |  a284c7  rmcelroy  D1880107  remote/@
| |  githelp: add: mention that record and crecord make commits
| |
| o  f4870a  sid0  remote/fbtip  fbonly
| |  crecord: update to latest default
```

Test Plan: run-tests.py actually works now

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

Reviewed By: durham

Subscribers: lcharignon, mpm, ps

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

Signature: t1:1883891:1425613263:8c199f339596384aa7d089154ef99eb982ecff87
2015-03-08 12:22:25 -07:00
Ryan McElroy
6f163f4e19 githelp: add: mention that record and crecord make commits
Test Plan: inspection

Reviewers: sid0

Reviewed By: sid0

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

Signature: t1:1880107:1425330619:fff59776e78c2b082e3618a07eb09e8f2bb6f04b

Blame Revision: D1782964
2015-02-27 21:57:51 -08:00
Ryan McElroy
3816687569 githelp: pull changes from fbonly branch 2015-02-27 21:53:59 -08:00
Ryan McElroy
1b69c516cc merge from default 2015-02-24 23:17:46 -08:00
Mateusz Kwapich
4dc1293e89 [githelp] Fix crashes in branch
Summary: githelp was crashing when git branch -D was provided

Test Plan: .

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

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

Tasks: 6061141
2015-02-24 18:47:25 -08:00
Mateusz Kwapich
96af3ce054 [githelp] Add mergetool git command
Summary: git mergetool ~ hg resolve

Test Plan:
$ hg githelp -- git mergetool a b
hg resolve a b

Reviewers: sid0, durham

Reviewed By: durham

Subscribers: #sourcecontrol

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

Tasks: 6148855

Signature: t1:1831922:1423258373:915476235d4837b859584f4040dbfa2ad9970513
2015-02-06 13:26:43 -08:00
Ryan McElroy
484b5b6cc5 Make githelp aware of hg reset
Test Plan:
  $ hg githelp -- reset abc123f
  hg reset abc123f
  $ hg githelp -- reset --hard HEAD^
  hg reset --clean .^
  $ hg githelp -- reset --hard HEAD
  hg reset --clean .
  $ hg githelp -- reset --mixed foo
  NOTE: There is no staging area (index) in mercurial, so --mixed has no meaning

  hg reset foo

Reviewers: daviser, sid0, davidsp, durham

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

Tasks: 5782321
2015-01-14 19:16:59 -08:00
Ryan McElroy
3561fabfe3 Added add -p to githelp
Test Plan:
  $ hg githelp -- add -p
  note: hg crecord provides a more powerful UI for recording changes

  hg record
  $ hg githelp -- add --patch
  note: hg crecord provides a more powerful UI for recording changes

  hg record
  $ hg githelp -- add --all
  note: use hg addremove to remove files that have been deleted.

  hg add
  $ hg githelp -- add
  hg add
  $ hg githelp -- add -A
  note: use hg addremove to remove files that have been deleted.

  hg add

Reviewers: daviser, sid0, davidsp, durham

Reviewed By: durham

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

Signature: t1:1782964:1421281556:89fb60618b5a7078273a36e9cf58641fc0ddef4c
2014-11-19 10:12:40 -08:00
Ryan McElroy
7a7ec956e4 Make githelp revert work without args
Test Plan:
  $ hg githelp -- revert
  hg backout
  $ hg githelp -- revert a
  hg backout a

Reviewers: daviser, sid0, davidsp, durham

Reviewed By: durham

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

Tasks: 5694469

Signature: t1:1782953:1421281569:0527230f4b6149004e6b34669decc509936111e8
2015-01-14 15:28:21 -08:00
Ryan McElroy
9831c3b95b Add merge-base to githelp
Test Plan:
  $ hg githelp -- merge-base
  NOTE: ancestors() is part of the revset language.
  Learn more about revsets with 'hg help revsets'

  hg log -T '{node}\n' -r 'ancestor(A,B)'
  $ hg githelp -- merge-base HEAD HEAD~100
  NOTE: ancestors() is part of the revset language.
  Learn more about revsets with 'hg help revsets'

  hg log -T '{node}\n' -r 'ancestor(.,.~100)'

Reviewers: daviser, sid0, davidsp, durham

Reviewed By: durham

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

Tasks: 5781871

Signature: t1:1782895:1421281621:0ef1da186ce353aa0a0516e8ce70b906e816f46c
2015-01-14 15:24:28 -08:00
Siddharth Agarwal
30f7e251d4 [githelp] fix reset against parent and self
Summary: This became `first()` and `last()` a few weeks ago, I think.

Test Plan: Ran `hg githelp -- git reset HEAD^` and `hg githelp -- git reset HEAD`

Reviewers: durham

Reviewed By: durham

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

Signature: t1:1726213:1418080693:d2000153091f9bdafa28d2600253d545f6922bfe
2014-12-08 15:13:47 -08:00
Siddharth Agarwal
7d2edf6a09 [githelp] support rev-parse
Summary: Some basic stuff -- `show-cdup` and `show-toplevel`.

Test Plan:
Ran

```
hg git -- git rev-parse
hg git -- git rev-parse --show-cdup
hg git -- git rev-parse --show-toplevel
```

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

Reviewed By: durham

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

Tasks: 5515241

Signature: t1:1660519:1415208854:1b36e9ab6de809b2c4306df3a9ef7f75981b144f
2014-11-04 22:47:33 -08:00
Siddharth Agarwal
f71b7ff7aa [githelp] git log = hg log -v
Test Plan: `hg git -- git log`

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

Reviewed By: durham

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

Tasks: 5542300

Signature: t1:1660502:1415208784:faa6722c2dbc3282eeb792862729141fce60174d
2014-11-04 22:34:27 -08:00
David Soria Parra
cddc80fd98 fb-hgext: add docstrings for extensions
Summary:
Most of our internal extensions don't have any docstringa causing hg help
to show nothing. I think this is confusing, as we teach people to use hg help.
In particular for our extensions they won't find anything on the internet
but hg help won't help either. So let's add rudimentary help texts.

Also ensure that gitnode is properly documented in hg help revset.

Test Plan:
added extensions, checked hg help and hg help extension. Also
checked hg help revset for gitnode.

Reviewers: rmcelroy, durham, sid0, akushner

Differential Revision: https://phabricator.fb.com/D1645964
2014-10-28 23:06:11 -07:00
Siddharth Agarwal
30f6859ed1 [githelp] add ls-files
Summary:
A couple of people requested this.

Also add `git` as an alias and fix the function name.

Test Plan:
Kicked the tires a bit.

```
hg git -- git ls-files
hg git -- git ls-files '**/*.py'
hg git -- git ls-files -m '**/.py'
hg git -- git ls-files -z '**/.py'
```

Reviewers: daviser, davidsp, akushner, pyd, durham

Reviewed By: durham

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

Tasks: 4515847
2014-10-09 19:26:29 -07:00
Siddharth Agarwal
51e00c416b [githelp] add ls-files
Summary:
A couple of people requested this.

Also add `git` as an alias and fix the function name.

Test Plan:
Kicked the tires a bit.

```
hg git -- git ls-files
hg git -- git ls-files '**/*.py'
hg git -- git ls-files -m '**/.py'
hg git -- git ls-files -z '**/.py'
```

Reviewers: daviser, davidsp, akushner, pyd, durham

Reviewed By: durham

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

Tasks: 4515847
2014-10-09 19:26:29 -07:00
Erin Davis
266fba185b Updated the githelp command to reflect wgrep and grep swap
Summary: The hg equivalent of git grep is hg grep now.

Test Plan: I used the extension and called hg githelp -- git grep and it said hg grep

Reviewers: sid0, durham

Reviewed By: durham

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

Tasks: 5162839
2014-09-24 16:29:04 -07:00
Igor Pozgaj
0b3afb8ca4 Add entry for git blame
Summary: hg githelp blame didn't work

Test Plan: not sure how to test this

Reviewers: pyd, davidsp, durham

Reviewed By: durham

Subscribers: sameen

Differential Revision: https://phabricator.fb.com/D1411080
2014-06-30 11:17:41 -07:00
Durham Goode
7321a5e343 Initial commit with extensions and readme 2014-06-02 12:54:54 -07:00
Pierre-Yves David
fbd8c16dac githelp: properly abort on unknown command
Summary: We previously aborted with a KeyError traceback.

Test Plan: Run that thing with an unknown command, got a clear abort

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1299542
2014-04-28 12:51:23 -07:00
Durham Goode
c030cd9d54 Fix hg githelp without args 2014-03-10 16:02:24 -07:00
Durham Goode
9d03f3b36c Add 'hg githelp' command
Summary:
Adds an 'hg githelp' command that translates git commands into Mercurial
commands.

Test Plan:
$ hg githelp -- rebase origin/master
hg rebase -d master

$ hg githelp -- checkout -B foo
hg bookmark foo

$ hg git -- checkout -B foo master
hg update master && hg bookmark foo

$ hg git -- reset --soft HEAD^
note: hg strip -k will delete the commit, but keep the changes in your working copy.

hg strip -k -r .

Reviewers: mpm, dschleimer, sid0, pyd, davidsp

CC: akushner

Differential Revision: https://phabricator.fb.com/D1184289
2014-02-20 20:54:17 -08:00