Commit Graph

5199 Commits

Author SHA1 Message Date
Gregory Szorc
0c976d1ad3 histedit: pick an appropriate base changeset by default (BC)
Previously, `hg histedit` required a revision argument specifying which
revision to use as the base for the current histedit operation. There
was an undocumented and experimental "histedit.defaultrev" option that
supported defining a single revision to be used if no argument is
passed.

Mercurial knows what changesets can be edited. And in most scenarios,
people want to edit this history of everything on the current head that
is rewritable. Making histedit do this by default and not require
an explicit argument or additional configuration is a major usability
win and will enable more people to use histedit.

This patch changes the behavior of the experimental and undocumented
"histedit.defaultrev" config option to select an appropriate base
revision by default. Comprehensive tests exercising the edge cases
in the new, somewhat complicated default revset have been added.
Surprisingly, no tests broke. I guess we were never testing the
behavior with no ANCESTOR argument (it used to fail with
"abort: histedit requires exactly one ancestor revision"). The new
behavior is much more user friendly.

The functionality for choosing the default base revision has been
moved to destutil.py, where it can easily be modified by extensions.
2015-10-24 19:56:39 +01:00
Yuya Nishihara
a588ddbc95 rebase: remove extra "if" from check of collapsing named branches 2015-12-05 23:50:13 +09:00
Yuya Nishihara
d1c7989b16 rebase: drop redundant functions to keep branch and graft source explicitly
All entries in extra dict are propagated by default since 5293d4f88aef.
2015-12-05 23:48:22 +09:00
Yuya Nishihara
2298c7a029 color: drop useless override of ui.popbuffer()
Because labels are applied at write() time since ce03e7329682,
colorui.popbuffer() is useless and it doesn't update _bufferapplylabels
correctly. Removing it should fix the problem.
2015-12-05 23:41:11 +09:00
Laurent Charignon
c7dc44265f rebase: only clear rebase status after the rebase transaction has completed
In 6e6b18aab8b2, I made the mistake of moving the step "clearing the status
after a rebase" to inside the rebase transaction.
This was wrong, since we don't want to clear the status (and the rebase state)
if something went wrong during the transaction: if something goes wrong we
want to keep the rebase state to be able to abort.
It broke rebase with evolve + inhibit.
2015-12-03 08:31:20 -08:00
timeless
538843243e histedit: improve missing rule suggestion
include actual suggested text
2015-12-02 07:41:35 +00:00
Mateusz Kwapich
0016ccb3cd histedit: get rid of state.rules
Now we are using state.actions instead of state.rules everywhere.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
eb6e47fe5e histedit: change state.rules uses to state.actions
This change is replacing most of state.rules uses with state.actions
uses. The next change will change histeditstate class to actually
uses state actions.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
45bd81cd16 histedit: add tostate method to histedit action
the format of rules that we store in state file format is different from the rule
format that we present to users. We need a way of dumping action to state file.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
5cf03a9c5a histedit: remove makedesc
It's a dead code now.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
574ed39bd6 histedit: use torule instead of makedesc in ruleeditor 2015-12-02 12:19:01 -08:00
Mateusz Kwapich
644cc338bd histedit: add torule method to histedit action objects
To make histedit action objects responsible for understanding
the format of their action lines we are adding a torule method
which for a histedit action will return a string which can be
saved in histedit state or shown in text editor when editing the
plan.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
278e9a38b4 histedit: add verify() to histeditaction
This commits splits the parsing of the histedit rule from its semantic analysis.
It's necessary because sometimes we want to do first without doing the former (reading the
histedit state).
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
29346eb944 histedit: add addhisteditaction decorator
This decorator will is allowing us to move the registering the action
in actiontable closer to the action code. Also it is storing the
verb inside histedit action so the action is aware of the verb
needed to trigger it.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
122e188cce histedit: add actions property to histedit state
I want to refactor histedit to use action objects instead of (verb, rest)
pairs whenever possible. At the end of this series I want the rules to
be translated into action objects when reading state and translated back
when writing state. All histedit internals should use action objects instead
of state rules.

To migrate histedti internals sequentially I'm introducing the state.actions
property to translate rules on the fly so we can use both state.actions and
state.rules until refactoring is done.
2015-12-02 12:19:01 -08:00
FUJIWARA Katsunori
fc6772c5fc shelve: execute checkunfinished inside wlock scope
Before this patch, "hg shelve" of shelve extension executes
'cmdutil.checkunfinished()' before acquisition of wlock.

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch executes 'cmdutil.checkunfinished()'
inside wlock scope of "hg shelve".

This also fixes issue4957, because now 'cmdutil.checkunfinished()'
isn't invoked at "hg shelve" with options below:

  --cleanup
  --delete
  --list
  --patch
  --stat
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
157a86fc91 shelve: widen wlock scope of shelve for consistency while processing
Before this patch, "hg shelve" of shelve extension executes/refers
below before acquisition of wlock:

  - 'repo.dirstate.parents()' via 'repo[None].parents()'
  - 'repo._activebookmark'

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch widens wlock scope of "hg shelve" of shelve extension for
consistency while processing.
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
f05ee67a9f gpg: make sign acquire wlock before processing
Before this patch, "hg sign" of gpg extension executes/evaluates below
without acquisition of wlock.

  - repo.dirstate.parents()
  - '.hgsigs' not in repo.dirstate

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch makes "hg sign" of gpg extension
acquire wlock before processing.
2015-12-02 03:12:08 +09:00
Augie Fackler
c6a7c82c31 bookmarks: hoist getbkfile out of bmstore class
It's totally fine that this hook exists, but I don't see a need for it
to live inside the bmstore class.
2015-11-11 20:45:38 -05:00
timeless
787afdd271 histedit: mention histedit-last-edit.txt on abort
Users may spend a lot of effort writing histedit rules,
getting an abort without being told they can recover their work
is very frustrating.

Avoid that by telling them where to find their work.
2015-12-02 08:07:36 +00:00
timeless
40357ef4f4 histedit: add missing raise keyword to statement 2015-12-02 07:40:42 +00:00
timeless
139b830297 histedit: improve grammar for _histedit comment 2015-12-02 07:39:49 +00:00
Augie Fackler
840125d439 commands: inline definition of localrepo.parents() and drop the method (API)
localrepo.parents() has relatively few users, and most of those were
actually implicitly looking at the wctx, which is now made explicit
via repo[None].
2015-11-11 20:07:15 -05:00
Mykola Nikishov
0ee9a8cf79 histedit: edit with custom filename
For instance, Emacs allows to open file with special features enabled
(AKA mode) based on the path/name of the file [1]. For such cases, use
'hg-histedit-XXX.txt' as filename pattern.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
2015-11-21 17:40:26 +02:00
timeless
9b00c9388a patchbomb: rename email function
I see no reason for the function not to be email ...
2015-11-29 06:51:23 +00:00
timeless
dfb7d692a0 graphlog: rename glog function
I see no reason for the function not to be glog ...
2015-11-29 06:51:23 +00:00
Mike Edgar
8d4be9cc8f rebase: propagate extra dict from rebase source changeset
This corrects extra propagation for the rebase command and the shelve command.
2015-11-28 04:11:14 -05:00
Mathias De Maré
bbe157b7e0 histedit: add examples 2015-11-25 18:26:48 +01:00
timeless
e4b7c3bfda pager: improve help for --pager=
try to clarify how to enable/disable the pager
2015-11-30 18:47:33 +00:00
timeless
0ab681f781 gpg: rename sigcheck function
I see no reason for the function not to be sigcheck ...
2015-11-25 06:10:54 +00:00
Augie Fackler
dafe189e47 extensions: properly mark progress as part of core
This should have been done as part of or as an immediate follow-up to
01b01d59e33f, but presumably this feature of extensions.py was
forgotten at that time.
2015-11-24 18:40:16 -05:00
Gregory Szorc
d84af347c4 ui: avoid needless casting to a str
In many cases, we don't need to cast to a str because the object will
be cast when it is eventually written.

As part of testing this, I added some code to raise exceptions when a
non-str was passed in and wasn't able to trigger it. i.e. we're already
passing str into this function everywhere, so the casting isn't
necessary.
2015-11-22 14:44:55 -08:00
Gregory Szorc
b184853d7f ui: remove labeled argument from popbuffer
It was moved to pushbuffer and currently does nothing.
2015-11-24 11:23:10 -08:00
Gregory Szorc
d3425fdff9 color: evaluate labels at write time
Previously, we stored 2-tuples of text and label in a list and then
evaluated the labels when the buffer was popped. After this patch,
we evaluate the labels at write time and do a simple join when the
buffer is popped.

This patch appears to have no impact on performance, despite creating
fewer 2-tuples and having fewer strings hanging around in memory.
2015-11-22 14:18:42 -08:00
Siddharth Agarwal
51f583c35b shelve: use colon instead of quotes in 'changes to' description
If detailed conflict markers are enabled and the closing quote gets truncated,
editors will often screw syntax highlighting up from that point because they'll
see an opening quote and think it's the beginning of a string.

In tests, the hashes change because the commit messages of the shelved bundles
also change.
2015-11-22 21:40:23 -08:00
Augie Fackler
18e5d950ee histedit: constant-ify the constraints list
Used a class as a namespace, and then wired up a classmethod to return
all known constraints. I'm mostly happy with this, even though it's
kind of weird for hg.
2015-11-23 10:13:05 -05:00
Mateusz Kwapich
60093bd539 histedit: add an experimental base action
This is a first (very simple) version of the histedit base action.
It works well in common usecases like rebasing the whole stack and
spliting the stack.

I don't see any obvious edge cases - but probably there is more than one.
That's why I want to keep it behind experimental.histeditng config knob
for now. I think on knob for all new histedit behaviors is better because
we will test all of them together and testers will need to turn it on only
once to get all new nice things.
2015-11-17 15:04:31 -08:00
Mateusz Kwapich
0e2838b3e0 histedit: add abortdirty function
Small helper function for aborting histedit when left with dirty working
directory.
2015-11-17 17:53:52 -08:00
Mateusz Kwapich
0cd6ba356d histedit: add forceother constraint
For the future 'base' action in histedit we need a verification
constraint which will not allow using this action with changes
that are currently edited.
2015-11-12 16:40:33 -08:00
Mateusz Kwapich
45af8348f7 histedit: make verification configurable
Before we can add a 'base' action to histedit need to change verification
so that action can specify which steps of verification should run for it.

Also it's everything we need for the exec and stop actions implementation.

I thought about baking verification into each histedit action (so each
of them is responsible for verifying its constraints) but it felt wrong
because:
 - every action would need to know its context (eg. the list of all other
   actions)
 - a lot of duplicated work will be added - each action will iterate through
   all others
 - the steps of the verification would need to be extracted and named anyway
   in order to be reused

The verifyrules function grows too big now. I plan to refator it in one of
the next series.
2015-11-17 16:37:26 -08:00
Laurent Charignon
b6a3739c99 rebase: use bookmarks.recordchange instead of bookmarks.write
Before this patch we were using the old api bookmarks.write instead of
bookmarks.recordchange at the end of rebase operations.
We move clearstatus within the transaction to make it easier for extensions
that wrap transactions operations.
2015-11-20 14:06:31 -08:00
Laurent Charignon
bd889a16a7 rebase: indentation change to make the next patch more legible
We put the code to be indented in the next patch in a "if True:" block to make
it easier to review.
2015-11-20 11:36:05 -08:00
Laurent Charignon
d3b83d4e8c strip: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, strip was using repo._bookmarks.write.
This patch replaces this code with the recommended way of saving bookmarks
changes: repo._bookmarks.recordchange.
2015-11-20 13:46:36 -08:00
Laurent Charignon
8ace80e21d histedit: make use of bookmarks.recordchange instead of bookmarks.write
Before this patch we were using the old api bookmarks.write, this patches
replaces its usage by bookmarks.recordchange, the new api to record bookmark
changes.
2015-11-20 13:23:47 -08:00
Siddharth Agarwal
f5d6c8e713 largefiles: fall back to the original for change/delete conflicts
The largefiles merge code (currently) does not handle change/delete conflicts.
So fall back to regular filemerge in that case.

Making this code handle change/delete conflicts is left as an exercise for the
future.
2015-11-18 17:40:13 -08:00
Siddharth Agarwal
4904ded295 filemerge: return whether the file was deleted
This is required for change/delete conflict resolution -- see previous patches
for more details.
2015-11-18 14:22:52 -08:00
Shubhanshu Agrawal
caf17cd48e strip: changing bookmark argument to be a list
Currently strip works with a single bookmark,
the changes in this patch modifies the strip
extension to accept a list of bookmarks
2015-11-19 12:50:10 +05:30
Shubhanshu Agrawal
64e100e7aa strip: strip a list of bookmarks
Currently strip works with a single bookmark,
the changes in this patch modifies the strip module
to work with a list of bookmarks

Building on this we can take a list of bookmarks as input
and remove all of them in a single go
2015-11-15 21:03:44 +05:30
Siddharth Agarwal
ad963d1bec unshelve: add support for custom merge tools
For parity with merge --tool, rebase --tool etc.

rebase.rebase overwrites the tool in repo.ui, so we need to explicitly pass it
down there too.
2015-11-18 15:11:23 -08:00
Siddharth Agarwal
4f4370437e unshelve: shed spurious space 2015-11-18 15:18:16 -08:00