Commit Graph

40 Commits

Author SHA1 Message Date
Jun Wu
3884602d28 check-code: enfore checking before using common foreign extensions
Summary:
It's a common mistake that our tests require foreign extensions (namely evolve
and remotenames) without checking them first.

This diff adds checks to catch these mistakes, adds missing checks, and unifies
our checking logic using `require-ext.sh`, which is aware of `hgext3rd` and
prints skip message.

This affects `arc lint` so hopefully our new testing code would be free of this
kind of mistakes.

Test Plan: `arc lint` would catch errors

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3550977:1468455857:e849dfd9e3cbc446cc6e6c662050ee88a3366e6c
2016-07-12 20:39:34 +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
Adam Simpkins
a25e35bc50 [tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../".  This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.

This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns.  Now you explicitly have to say
"glob:<pattern>" to get glob matching.  However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.

Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.

Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters

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

Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-21 20:44:06 -07:00
Kostia Balytskyi
36e90d0fed tweakdefaults: make rebaseskipobsolete behave in a more expected way
Differential Revision: https://phabricator.intern.facebook.com/D3341324
2016-06-11 15:25:13 -07:00
Kostia Balytskyi
187e5d4408 tweakdefaults: remove "head -n0" from test-tweakdefaults.t
Summary:
BSD version of head does not support -n0 and it looks like the only purpose of
using it here is to hide stdout output (and leave stderr).

Test Plan:
Ran test-tweakdefaults.t on both Linux and OSX, made sure that this particular
part of the test does not fail anymore.
That said, test-tweakdefaults.t still fails on OSX, but that requires more
investigation and my 5-minute look did not reveal the reason.

Reviewers: simonfar

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3378544
2016-06-02 04:14:28 -07:00
Ryan McElroy
639ac03252 tweakdefaults: abort when combining --root-relative with patterns
Summary:
When people combine --root-relative with a file pattern, they would probably
expect the output to be relative to the root -- but it's not! In this case, it
would fall back to the default file pattern behavior, which is cwd-relative.

Instead of confusing the user with apprarently errorneous output, let's abort
explicitly and provide a helptful hint.

Test Plan: added a new test, existing tests still pass

Reviewers: #mercurial, simpkins, ttung, quark

Reviewed By: quark

Subscribers: quark, net-systems-diffs@, mjpieters

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

Signature: t1:3319366:1463610688:3f129c97f68f43ac85d2b31b55fac5c859e85c04
2016-05-19 09:35:59 -07:00
Kyle Lippincott
70d306b13d tweakdefaults: support pull --rebase -d <dest> without remotenames 2016-02-05 10:02:41 -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
Laurent Charignon
a5b8b12669 tweakdefaults: update test with latest core
A warning was there because core was using a deprecated API for writing
bookmarks. Now that the issue is fixed in core, this test has to be updated to
remove the warning.
2015-12-29 11:30:13 -08:00
Pierre-Yves David
584ef5f66e remove devel-warning from expected test-output
Summary:
Devel warnings are pointing at issues in the code that need to be fixed. The
right way to get the tests to pass is to fix the warning cause, not to the
warning to the tests.

This practically backout an handful of test that added such warning output in
the test.

Test Plan:
  Well, test are now broken to match the state of the borken code.

Reviewers: lcharignon

Differential Revision: https://phabricator.fb.com/D2760523
2015-12-15 11:08:20 -08:00
Ryan McElroy
59ee01fd63 update extensions and tests for latest mercurial
Test Plan: ran against latest mercurial

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

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

Tasks: 9130498

Signature: t1:2667332:1447811419:24f642f3a4faa410b7aa9fdd650c1dc3a743d653
2015-11-17 17:54:31 -08:00
Durham Goode
6dc8b53ecc tweakdefaults: fix tests
The no-date-rewrite-on-rebase test had output that assumed date rewriting. It
should be outputting the first commit which has a recent date (commit 7) instead
of the current commit (commit 12) which did not have it's date rewritten.
2015-11-13 11:07:03 -08:00
Stanislau Hlebik
a6281fff9e Make rebase set current date by default
Summary:
Previously rebase retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.rebasekeepdate' to save original date in graft.

Test Plan: ./run-tests.py test-tweakdefaults.t

Reviewers: rmcelroy

Reviewed By: rmcelroy

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

Tasks: 8770194

Signature: t1:2646736:1447368541:e9735f75b394a25b72d1a5cc4cd26454c2231c91
2015-11-12 01:36:21 -08:00
stash
26e3ddbdb0 Make commit --amend and amend set current date by default
Summary:
Previously commit --amend and amend retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.amendkeepdate' to save original date in graft.

Test Plan:
1) ./run-tests.py test-tweakdefaults.t

2) Add the following to ~/.hgrc


  [extensions]
  tweakdefaults = PATH_TO_tweakdefaults.py
  fbamend = PATH_TO_fbamend.py


Create repo



  hg init

Make a commit with date 0


  echo 1 >> test.txt && hg add test.txt && hg commit -d "0 0" -m "initial commit"


Amend a commit via "amend" command and check the date.




  echo 1 >> test.txt && hg amend && hg log -l 1


Do the same for "commit --amend" command


3) Add the following to ~/.hgrc



  [tweakdefaults]
  amendkeepdate = True

and repeat actions from step 2) (both for "commit --amend" and "amend"). Date should stay the same.

Reviewers: rmcelroy, #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham, balazsbalazs

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

Tasks: 8770194

Signature: t1:2570763:1445539148:66b8b00ed51d486d39203dad830f4a50cdc8060d
2015-10-22 15:50:59 -07:00
James Mills
fabaaca807 tweakdefaults: Set default nooprebase behavior and fix config checks
Summary: Makes the default behavior of nooprebase true.

Test Plan: ~/hg/tests/run-tests.py test-tweakdefaults.t

Reviewers: rmcelroy, durham

Reviewed By: durham

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

Signature: t1:2570362:1445538341:f62d29530fe5516d666fd496107dd314cdd9fae7
2015-10-22 08:04:15 -07:00
stash
d5c12360a4 Make graft set current date by default
Summary:
Previously graft retained the commit date from the original. Now it uses current time.
Added config option 'tweakdefaults.graftkeepdate' to save original date in graft.

Test Plan:
1) ./run-tests.py test-tweakdefaults.t

2)
Add the following to ~/.hgrc


  [extensions]
  tweakdefaults = PATH_TO_tweakdefaults.py



Create two bookmarks: test_1 and test_2, pointing to different commits

Graft commit from test_2 to test_1

  hg up test_1 && hg graft test_2

Check the date in the log - it should be different from the date of test_2 commit


  hg log -l 1


Add the following to ~/.hgrc



  [tweakdefaults]
  graftkeepdate = True



Strip latest test_1 commit



  hg strip test_1


Again do the graft



  hg up test_1 && hg graft test_2


and verify the commit date: should be the same as in test_2 commit

Reviewers: #sourcecontrol, rmcelroy, durham

Reviewed By: durham

Subscribers: balazsbalazs

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

Tasks: 8770194

Signature: t1:2566177:1445539026:2cd0b6b5b04247c17942f787d8921215def8e3fe
2015-10-21 14:26:15 -07:00
Christian Delahousse
987103cf0b tweakdefaults: reuse commit message flag
Summary: Added the --reuse-message/-M flag to `hg commit` via tweak defaults

Test Plan: See the tests

Reviewers: #sourcecontrol, durham, rmcelroy

Reviewed By: rmcelroy

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

Tasks: 8721257

Signature: t1:2559541:1445364124:db69a1b08defc0a84f314019ce1a01174e7006d3
2015-10-19 23:55:23 -07:00
James Mills
e1da7805e4 tweakdefaults: Setup a nooprebase behaviour for the rebase ext
Summary:
Adds configuration to .hgrc such that setting nooprebase = True
in the tweakdefaults section changes the behaviour of a noop
rebase such that the exit status is 0 (instead of 1).

Test Plan: See: https://phabricator.fb.com/P20083985

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: dancol

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

Tasks: 8694501

Signature: t1:2557089:1445447745:fc35600d53f797d7242c2fcff9fac42867d7b651
2015-10-19 14:05:38 -07:00
Cecile Berillon
50d5a2d718 Moved merge comment to hint
Summary: Moved merge comment to hint in Abort

Test Plan: test output

Reviewers: rmcelroy

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

Tasks: 8593074
2015-10-08 11:32:39 -07:00
Cecile Berillon
89beed4ce9 Disabling rollback in tweakdefaults
Summary: Disabling rollback in tweakdefaults to replace the hook

Test Plan: testing the message

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8578898
2015-10-06 16:10:24 -07:00
Cecile Berillon
0272f0d7ec Disabling merge in tweakdefaults
Summary: Disabling merge in tweakdefaults to replace the hook

Test Plan: enable, disabled, disabled and meaasge modified

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8593074
2015-10-06 16:39:18 -07:00
Cecile Berillon
388e56c896 Adding config to allow disabling the branch command
Summary: Adding config to disable the branch command and still forcing users to pass --new if it's enabled

Test Plan: Testing branch alone, branch when it's disabled and when it's enabled (with the --new options in both cases)

Reviewers: #sourcecontrol, rmcelroy

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

Tasks: 8500803
2015-09-24 13:09:47 -07:00
Cecile Berillon
412d5aaec9 Changing tag disabled by default to tag enabled by default
Summary: Changing tag disabled by default to tag enabled by default

Test Plan: tag default policy, tag when disabled with or without default message

Reviewers: rmcelroy

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

Tasks: 8500389
2015-09-28 14:39:56 -07:00
Cecile Berillon
c521ae86f6 Adding tag tweak
Summary: Adding tag tweak and warning on the tags command

Test Plan:
Testing the tag command if allowed, not allowed with default message and not allowed with custom message
Testing if the default warning message or custom message prints when tags is called

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: #sourcecontrol, rmcelroy

Subscribers: cdelahousse, durham

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

Tasks: 8500389
2015-09-24 11:29:41 -07:00
Ryan McElroy
3724810d00 make status relative
Test Plan:
updated test; made sure to include `HGPLAIN`

ran `arc diff` from repo root and from subdir; both worked

In `fbsource/fbobjc` I ran `arc lint` and there were no warnings but it did fail to find `/usr/bin/xcrun` (which is the same behavior as before).
I repeated this in `fbsource/fbobjc/Configurations` to check for path issues; same result.

In `www` I ran `arc lint` and there were no warnings. I repeated this in `www/flib` and got the same result.

Reviewers: durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: durham, akushner

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

Tasks: 8432204

Signature: t1:2457648:1442622676:611ad3072d11b91feb947c0eb7eb25b621c61eb1
2015-09-18 10:20:49 -07:00
Christian Delahousse
f90fce8d84 Fixed test-tweakdefaults.t on hg up failure
Summary:
Commit 865f9f0d3df0 modifying the `hg up` command broke the tests. I updated
the test.

Test Plan:
    $ ./run-tests.py test-tweakdefaults.t
    warning: Testing with unexpected mercurial lib: /usr/lib64/python2.6/site-packages/mercurial
            (expected /tmp/hgtests.PK6gU9/install/lib/python/mercurial)
    .
    warning: Tested with unexpected mercurial lib: /usr/lib64/python2.6/site-packages/mercurial
            (expected /tmp/hgtests.PK6gU9/install/lib/python/mercurial)
    # Ran 1 tests, 0 skipped, 0 warned, 0 failed.

Task: #8105963

Reviewers: durham, ericsumner

Reviewed By: ericsumner

Subscribers: thm, joesavona

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

Tasks: 8105963

Signature: t1:2373449:1440439161:44e57904fbd32a4d92cc7ebae94aecde4671542e
2015-08-23 00:08:06 -07:00
Durham Goode
d7d95c9b9c update fbhistedit and tweakdefaults tests to match new upstream hg 2015-07-22 15:58:02 -07:00
Ryan McElroy
6eede86d5d tweakdefaults: stop accidental branch command usage
Summary:
In the vast majority of cases, our workflows should not use branches.
Let's make sure people know what they're doing when they create a branch by
failing by default.

Test Plan: added a new test

Reviewers: durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2213677
2015-07-02 11:11:56 -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
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
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
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
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
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
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