Commit Graph

44 Commits

Author SHA1 Message Date
Durham Goode
bc36a8000c lint: fix simple lint errors 2016-06-29 12:56:45 -07:00
Kostia Balytskyi
1d18a2690a fbamend: abort if preamend bookmark points to the current commit
Differential Revision: https://phabricator.intern.facebook.com/D3436696
2016-06-17 05:25:32 -07:00
Kostia Balytskyi
fe1d9ce31e fbamend: fix some bugs & style issues in unamend implementation
Differential Revision: https://phabricator.fb.com/D3218920
2016-04-26 04:58:59 -07:00
Tony Tung
10899ff617 fix check-code violations
Summary:
1) trailing ws.
2) D3204578 removed files

Test Plan: pass check-code

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Signature: t1:3208944:1461366677:f1f312e17ab37d70fecfa43ce31261f3eb42814b
2016-04-25 12:01:35 -07:00
Tony Tung
731145a0be [fbamend] catch the specific exception for failure to load extension
Summary: check-code prohibits catch-alls.

Test Plan: pass test-fbamend.t

Reviewers: #sourcecontrol, ikostia

Reviewed By: ikostia

Subscribers: ikostia, mitrandir, mjpieters

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

Signature: t1:3208934:1461273513:c7881f6f374d9db22a3062c9330cc659dab3d92a
2016-04-21 14:37:14 -07:00
ikostia@fb.com
2d8c5ce689 fbamend: add the unamend command
Differential Revision: https://phabricator.fb.com/D3202478
2016-04-21 17:17:07 +01:00
Durham Goode
6112a4e50c fbamend: fix fbamend not passing a rebase destination
Summary:
fbamend was not passing a rebase destination if you did not have an active
bookmark (it would just rebase onto the named branch tip). This broke when
upstream Mercurial started requiring you specify a rebase destination when it
was ambiguous.

The fix is to rebase onto the current commit (which is always the correct
behavior, since amend --rebase will have left you on that commit after the
amend, and amend --fixup discovers what needs rebasing by looking at your
current commit).

Test Plan: Added a test

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

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

Tasks: 10366715
2016-03-09 17:53:11 -08:00
Martijn Pieters
864de92728 Make fbamend responsible for supporting automv.
Summary:
This facilitates moving automv out of this repository to Mercurial proper.
Use extensions.afterloaded() to avoid relying on module load order.

Test Plan: Run the test suite with ../../hg/tests/run-tests.py

Reviewers: rmcelroy, durham

Differential Revision: https://phabricator.fb.com/D2896456
2016-02-04 11:03:31 +00:00
Laurent Charignon
a27b0abfb8 cleanup: make all the code compliant with the i18n rules for ui strings
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/D2811887
2016-01-11 10:19:22 -08:00
Laurent Charignon
cc97eef022 cleanup: fix spacing (2 vs 4 spaces)
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/D2811933
2016-01-07 18:30:24 -08:00
Laurent Charignon
b36541de7d cleanup: replace all the calls to util.Abort to error.Abort
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass like before

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811837
2016-01-07 18:30:24 -08:00
Laurent Charignon
0001b13276 fbamend: fix transaction issue with inhibit
Summary:
Before this patch, fbamend with inhibit was leaving commits behind
when using --fixup. This was because we had two separates transaction, one for
the bookmarks and one for the markers. This patchs makes the marker creation
happen in the same transaction as the bookmark move.

Test Plan: check hg amend --fixup and hg amend --rebase
https://phabricator.fb.com/P56056980

Reviewers: ericsumner, durham

Differential Revision: https://phabricator.fb.com/D2771188
2015-12-18 14:22:10 -08:00
Laurent Charignon
695e2fdfcd fbamend: use bookmarks.recordchange instead of bookmarks.write
Summary: bookmarks.write is deprecated

Test Plan: the test is still passing

Reviewers: ericsumner, pyd, durham

Reviewed By: durham

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

Signature: t1:2747002:1449794465:a6ded4ed8f5249812c97cea13d9d6ce809109bd2
2015-12-14 11:30:33 -08:00
Christian Delahousse
6c94249d6f fbamend: fix --logfile for hg amend
Summary:
Fbamend broke logfile. fbamend tends to write state to opts['message'] even
if -m or --message was not used at the cmdline. If you inputted a logfile
cmd arg, cmdutil.logmessage would see both opts['message'] and opts['logfile']
as populated and throw an abort exception. This is a workaround.

Test Plan: See test.

Reviewers: rmcelroy

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

Tasks: 7434543
2015-10-27 14:37:20 -07:00
Christian Delahousse
9f711482fb fbamend: prevent hg commit --rebase/--fixup without --amend
Summary: Nuff said

Test Plan: Test.

Reviewers: durham, #sourcecontrol

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

Tasks: 8854516
2015-10-26 16:19:40 -07:00
Christian Delahousse
60dabbf5ef fbamend: enable interactive mode
Summary: fbamend did not enable interactive mode for hg commit --amend -i and hg amend -i.

Test Plan: See the tests.

Reviewers: #sourcecontrol, rmcelroy, durham

Reviewed By: durham

Subscribers: durham, rmcelroy

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

Tasks: 7695310

Signature: t1:2578231:1445894542:4b633377b0b2157cc4e5244dc07c0785ccca73c1
2015-10-23 17:00:56 -07: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
Durham Goode
64ed8a8d62 fbamend: fix to use loaded rebase, instead of system rebase
fbamend was using the python system rebase instead of the one loaded by
Mercurial. This broke the tests when the installed rebase differed from the
version of Mercurial we were running the tests with.
2015-09-24 19:46:12 -07:00
Gulshan Singh
03004ac2ef fbamend: return 0 on amend/commit with nothing changed
Summary: return 0 on amend/commit with nothing changed

Test Plan:
Make or checkout a mercurial repository and make a commit. Run the following commands and make sure the output is the same:

$ hg ci; echo $?
nothing changed
0
$ hg amend; echo $?
nothing changed
0

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

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

Tasks: 8313450
2015-09-09 14:43:16 -07:00
Laurent Charignon
062fc29b9d fbamend: take a lock for the whole fbamend process
Summary:
Before this patch we were not taking a lock when dealing with bookmarks.
Which means that any process running while fbamend was running would lead to
corruption / loss of bookmark. This patch makes sure that we have a lock for
the whole duration of the fbamend run and avoids corruption.

Test Plan:
Tests are passing and this fixes an issue that we have
been seeing with inhibit where inhibit would take a lock on bookmark write
and overwrite the .preamend bookmark

The following repro does not show the issue anymore:

    mkcommit a ; mkcommit b ; hg book b ; hg up .^ ; hg book a ; echo "OO" > r ; hg commit --amend --rebase -Am 'oo'

Reviewers: durham, pyd

Reviewed By: pyd

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

Signature: t1:2303299:1438623825:e8160001600449cf5f505cc55a078d30c1e75a14
2015-08-04 09:10:50 -07:00
Laurent Charignon
115c10d796 fbamend: fix bug with inhibit where old changeset would still be visible
Inhibit wraps transactions to lift obsolescence of visible changesets.
Before this patch, inhibit was lifting the obsolescence marker right after
creating it because the commit before the amend was kept visible by the
hacky bookmark and because it was the parent of the working copy.

There are two ways of fixing this:
1) shuffle the code to remove the bookmark and update first, then add the
marker
2) put all the code in a transaction so that the transaction wrapping runs only
in the end of everything
This patch implements the 2) option because it minimizes the chances of
changing
the behavior of fbamend like 1) does.

Test Plan:
Checked @durham's suggestion:
hg init tactac ;
cd tactac ;
mkcommit a ;
mkcommit b ;
mkcommit c ;
hg up .^ ;
echo "oooo" > b ;
hg amend --rebase ;
hg sl
After the patch it works as expected and
the old commit is hidden
2015-07-08 10:33:04 -07:00
Laurent Charignon
7cb3fbaf9d fbamend: when inhibit is not enabled, don't mark obsolescence twice
Before this patch, when inhibit was not enabled, we were marking the
obsolescence twice (once with amend and once with obsolete.createmarkers
directly). This patch removes this issue.
2015-07-10 15:32:41 -07:00
Laurent Charignon
8eb2003bbd fbamend: use strip.strip instead of repair.strip
Summary:
fbamend: use strip.strip instead of repair.strip
This allows fbamend to work better with evolve as evolve overrides the command
strip.strip to prune.

Test Plan: Changed test and ran it.

Reviewers: durham, pyd

Differential Revision: https://phabricator.fb.com/D2082137
2015-05-18 16:28:40 -07:00
Ryan McElroy
d4dc8ae3cd fb-hgext: update for bookmarks api compatibility
Summary:
Bookmarks apis are changing in core, need to update these extensions to not
break across that change.

Test Plan: ran tests against current and latest hg with bookmarks patches applied.

Reviewers: #sourcecontrol, durham

Reviewed By: #sourcecontrol, durham

Differential Revision: https://phabricator.fb.com/D2059856
2015-05-09 20:22:31 -07:00
Durham Goode
6b99e31175 fbamend: move evolve warning to be inside the amend command
Summary:
With the new evolve+inhibit ecosystem, we want to allow amend and amend --rebase
to continue working even when evolve is on. Let's move the evolve check to be
inside the amend command, and only complain when we see the evolve commands
enabled.

Test Plan: Added a test

Reviewers: lcharignon, pyd

Reviewed By: pyd

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

Signature: t1:2033649:1430346833:3116b704e49f634709a6fea32e217b94e731b96f
2015-04-07 13:52:59 -07:00
Ryan McElroy
9d0379fb36 fbamend: configurable user education
Test Plan: ran it locally with chef_tested devbox and D2002135

Reviewers: durham, ericsumner, mitrandir, sid0

Reviewed By: sid0

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

Signature: t1:2002175:1429295959:535d264ebd9a2d23c8e1eebefb313b1654f28196
2015-04-17 10:17:23 -07:00
Ryan McElroy
efe74ca9a4 fbamend: add addremove (-A) option
Summary: Soemone noticed that this was missing

Test Plan: updated test

Reviewers: sid0, mitrandir, durham

Reviewed By: durham

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

Tasks: 6773162

Signature: t1:1994587:1429116229:64c8d9bcca1f7de7566d5a53e5f822e1658c1758
2015-04-15 09:29:09 -07:00
Ryan McElroy
5f9e3bb604 fbamend: keep explicitly passed message
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
2015-04-07 13:31:44 -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
adaac17406 fbamend: add text box user education message
Test Plan: udpated test

Reviewers: sid0, durham

Reviewed By: durham

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

Signature: t1:1847192:1423853563:81c064ffc591b64beb4f5b5c5b751f18f9e8d8c2
2015-02-12 21:16:58 -08:00
Ryan McElroy
5bcd0b8fc0 merge from default 2015-02-13 16:01:50 -08:00
Durham Goode
6b82267a16 Merge with default 2015-02-13 11:34:05 -08:00
Ryan McElroy
5cdf597fd6 fbamend: histedit awareness
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
2015-02-12 11:02:34 -08:00
Ryan McElroy
76aaf399ba fbamend: intelligently keep non-bookmarked rev preamends up to date
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
2015-02-12 20:43:29 -08:00
Ryan McElroy
6596b361b3 fbamend: factor out preamend bookmark naming
Summary: Less copypasta, more win.

Test Plan: ./run-tests.py

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

Reviewed By: durham

Subscribers: pyd

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

Signature: t1:1844329:1423764680:adce79e4d06727a0910f21afdfb80439c6bbbe8c
2015-02-12 02:16:28 -08:00
Ryan McElroy
9e16f90f02 fbamend: allow verbose user education
Summary:
I want to turn on fbamend by default, but in order to do that, we need to point
people in a super-obvious way at the documentation when they first run fbamend.
This provides a stub for user education.

Test Plan:
 * ./run-tests.py
 * Added a message and played around with it in my www-hg

Reviewers: durham, sid0, ericsumner, mitrandir, daviser

Differential Revision: https://phabricator.fb.com/D1844274
2015-02-12 01:26:20 -08:00
Ryan McElroy
6f8358819a fbamend: change suffix to remove parentheses
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
2015-02-11 20:01:03 -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
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
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
Durham Goode
7321a5e343 Initial commit with extensions and readme 2014-06-02 12:54:54 -07:00
Durham Goode
02033526d4 Fix hg commit -l when using fbamend
A change in core mercurial added --edit to the commit options. This conflicted
with the fbamend --edit, which caused hg commit --amend -l foo.txt to actually
open the editor. Breaking arc diff.
2014-04-25 17:13:13 -07:00
Durham Goode
034fd17869 Fix --fixup when the children are already fixed 2013-09-10 19:26:13 -07:00
Durham Goode
f39da261ad Install to site-packages/ instead of site-packages/hgext 2013-06-20 14:56:01 -07:00