Commit Graph

30 Commits

Author SHA1 Message Date
Simon Farnsworth
bb9d88ea1a githelp: don't crash when user does githelp -- git
Summary:
We didn't check for sanity when the user asked for hg githelp -- git -
oops. Fix the args test to catch you if you ask for help for git, as opposed to
(say) git commit.

Test Plan: Ran the new test cases.

Reviewers: #fbhgext, ikostia

Reviewed By: ikostia

Differential Revision: https://phab.mercurial-scm.org/D183
2017-07-26 08:51:21 -07:00
Simon Whitaker
d6b24eb1fe githelp: improve output of hg githelp -- git blame
Summary:
Adds user (-u), date (-d) and line number (-l)

If you use Phabricator, also adds Phabricator diff ID (-p)

Test Plan: run-tests.py -l test-githelp.t

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5469590

Tasks: 11078001

Signature: t1:5469590:1500633342:7be15f60e371dab7016ec44866ea369c696cb0a8
2017-07-21 12:08:18 +01:00
Jun Wu
4a936cee21 codemod: remove extpath in tests
Summary:
Previously, the following pattern is common in our tests:

```
   $ extpath=`dirname $TESTDIR`
   $ cp $extpath/hgext3rd/name.py $TESTTMP # use $TESTTMP substitution in message
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTTMP/name.py
   > EOF
```

Now, it gets simplified to:

```
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTDIR/../hgext3rd/name.py
   > EOF
```

This removes unnecessary `dirname` and `cp`.

Also fixed a regex that does not match `bytes`:

```
-  transferred 268 bytes in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
+  transferred 268 bytes in 0.3 seconds (939 bytes/sec)
```

Test Plan: arc unit

Reviewers: #mercurial, phillco

Reviewed By: phillco

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5270897

Signature: t1:5270897:1497663052:bf860a0b480c751b1e4b53cebf6526193f0f6652
2017-06-16 18:31:25 -07:00
Rodrigo Damazio Bovendorp
641bb65374 githelp: making the unknown message footer configurable
Facebook probably doesn't want external users reaching out to them directly
for support, so this should be customizable to specify other possible courses
of action (especially in cases where githelp is further extended to document
git-related company-internal commands in other companies).
2017-05-11 07:19:32 -07:00
Pascal Hartig
a7cffaf493 hgext: githelp support for commit -C
Summary:
Add support for `git commit -C <commit>`/`git commit --reuse-message <commit>`.

E.g.

```
hg githelp -- git commit -C deadbeef
hg commit -M deadbeef
```

Test Plan: Added test case for the new feature

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4258167

Signature: t1:4258167:1480674937:4f21fd43272462c8c5eee40a02d0db7014c834d4
2016-12-02 10:41:54 +00:00
Jun Wu
82b158ed59 githelp: fix crash in mergebase
Summary: `_` does not take two arguments while `ui.status` does.

Test Plan: Added a test case

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4010079

Signature: t1:4010079:1476298648:81e678fbe433aa8cca8b03c9eba50d9b78bbc9bb

Blame Revision: D2811887
2016-10-12 19:47:42 +01:00
Jun Wu
8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00
Kostia Balytskyi
b9da7b9907 githelp: change advice to log task with sourcecontrolux tag
Differential Revision: https://phabricator.intern.facebook.com/D3235024
2016-04-28 04:14:31 -07:00
Simon Farnsworth
0776320a1c Update githelp and its tests to match show
Summary: githelp had desynced from show. Update githelp and its test case to match modern show.

Test Plan: Run the upadted test case

Reviewers: rmcelroy, lcharignon, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Signature: t1:2937517:1455570702:8414a3f6f05736b9c728950f7019c602234f48fb
2016-02-16 04:00:21 -08:00
Simon Farnsworth
26167ac6dd show: Learn to do hg show REV FILES
Summary:
Make hg show closer in behaviour to git show - it's useful to restrict the files it examines, not just the revision

Also update githelp.py to match.

Test Plan: Run the updated testcases.

Reviewers: lcharignon, pyd, rmcelroy, durham

Reviewed By: durham

Subscribers: #sourcecontrol

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

Tasks: 9323445

Signature: t1:2917091:1455240831:305be81ada4b832a9685f5bf38f3c3232c47fdfb
2016-02-12 03:07:11 -08:00
Simon Farnsworth
c7f8da79d1 Recommend an alternative if people want -U on show
Summary: We've had a query about getting more context on hg show. While upstream is unlikely to respond well to requests for a new toplevel option, it is actually possible to use --config to get more context. Tell people about this with githelp.

Test Plan: Run the newly updated tests.

Reviewers: pyd, rmcelroy, durham

Reviewed By: durham

Subscribers: #sourcecontrol

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

Tasks: 9907950

Signature: t1:2916982:1455077490:8b804e09ad656a2b5a7aca8f2e4e81da6e541806
2016-02-10 02:02:37 -08:00
pjb
5ab42026c5 Added githelp -- apply functionality and associated test.
Summary: githelp --apply functionality added

Test Plan: test-githelp.t updated and checked

Reviewers: cgrigoruta, rmcelroy

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

Tasks: 9464409
2016-01-25 05:12:54 -08:00
Laurent Charignon
0ca941a08a cleanup: use backtick instead of parent to capture output of shell cmd
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass

Reviewers: #sourcecontrol, ttung, mitrandir, akushner

Reviewed By: akushner

Subscribers: mpm, akushner, mitrandir

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

Signature: t1:2811997:1452200059:9e4fca501a22f95d2d9a22d234758f55e292ea9a
2016-01-07 18:30:24 -08:00
Laurent Charignon
5ebc03718c cleanup: fix quoting patterns in tests
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: All tests pass

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811856
2016-01-07 18:30:24 -08:00
Thu Trang Pham
86db6ddc5c Remove --name from githelp for git stash drop
Summary:
Verified that the issue does occur.
Verified that using `hg shelve -d my_shelve_name` works for default and arbitrary shelve name.

Test Plan: Updated the tests for githelp

Reviewers: ericsumner, durham

Reviewed By: durham

Subscribers: de-engagement-diffs@

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

Tasks: 7632472

Signature: t1:2762983:1450289196:f25d757d158d110e8fc5503f974170c4a9892718
2015-12-16 10:19:40 -08:00
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
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
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
Nat Mote
811418bec7 Keep the githelp tests independent
Summary:
I realized that a test I wrote affects the tests later in the test suite because
it cd's into a directory and does not cd out. This fixes that.

Depends on D2171752

Test Plan: run tests

Reviewers: durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: pawelbara

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

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

Test Plan: take a look at the unit tests.

Reviewers: marcelo, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: nmote, durham, rmcelroy, owenc

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

Tasks: 6860395

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

Reviewers: owenc, marcelo

Reviewed By: marcelo

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

Tasks: 6860308

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

Test Plan: added a test

Reviewers: mitrandir, durham

Subscribers: scottf

Differential Revision: https://phabricator.fb.com/D2166551
2015-06-17 16:11:03 -07:00
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
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