Commit Graph

324 Commits

Author SHA1 Message Date
Pierre-Yves David
a1d4a95c88 histedit: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:51:43 -08:00
Ben Schmidt
20f9183d45 histedit: modify rollup to discard date from the rollup commit (issue4820)
This change adjusts and documents the new behaviour of 'roll'. It now fits nicely
with the behaviour of 'commit --amend' and the 'edit' action, by discarding the
date as well as the commit message of the second commit. Previously it used the
later date, like 'fold', but this often wasn't desirable, for example, in the
common use case of using 'roll' to add forgotten changes to a changeset
(because 'hg add' was previously forgotten or not all changes were identified
while using 'hg record').
2017-02-18 21:30:28 +11:00
Ben Schmidt
a0e44b6af4 histedit: improve documentation and behaviour of dates
This clarifies in the histedit documentation that the 'edit' action preserves
the date and that the 'fold' action uses the later date. The documentation was
previously silent on this issue which left users in doubt.
2017-02-18 21:30:28 +11:00
Simon Farnsworth
2d5b62ae12 histedit: log the time taken to read in the commands list
If we're being fed an external command list from stdin (histedit --commands -),
then the time spent reading stdin is outside our control. Log it.
2017-02-15 13:34:06 -08:00
Sean Farley
e145fc2df7 ui: rename tmpdir parameter to more specific repopath
This was requested by Augie and I agree that repopath is more
descriptive.
2017-01-18 18:25:51 -08:00
Sean Farley
df48d2115f histedit: add tmpdir parameter to ui.edit call 2017-01-16 21:15:57 -08:00
Mads Kiilerich
38cb771268 spelling: fixes of non-dictionary words 2016-10-17 23:16:55 +02:00
Yuya Nishihara
db11160c56 histedit: use ui.fin to read commands from stdin
stdin is wrapped by channeledinput in command-server session.
2016-03-18 17:15:06 -07:00
Martin von Zweigbergk
cb58483f81 histedit: avoid converting nodeid to context and back again
It looks like this became unnecessary in 8166e7073157 (histedit: fix
preventing strips during histedit, 2015-04-04).
2016-09-27 22:09:28 -07:00
timeless
04798f0fb8 histedit: use single quotes in use warning 2016-09-20 23:45:25 +00:00
Augie Fackler
24579e9893 histedit: correct output of error when 'base' is from the edit list
This was made more obvious by marmoute's recent rearrangement of this code.
2016-08-30 13:13:50 -04:00
Pierre-Yves David
b9ebcea85e histedit: remove now unused 'constraints' related code
Now that the one action that need different logic handle that using inheritance
and overriding, we can remove that code.
2016-08-26 21:06:31 +02:00
Pierre-Yves David
d2bccef0ce histedt: use inheritance to override the constraints in 'base'
All actions but one actually have the same constraints when it comes to validate
the 'action.node' value. So we actually just add this code to a method that can
be overwritten in the one action where it matters.

The now unused 'contraints' related enum and class attribute will be cleaned up
in the next changeset.
2016-08-26 21:00:33 +02:00
Pierre-Yves David
e83d8435c9 histedit: move constraint verification to the 'action.verify' method
Action has a method dedicated to verifying its validity. So we move code
related to constrains into that method. This requires a bit more context to the
'verify' method in the same fashion we were passing the 'prev' argument.

This is an extra step before we can simplify the constraint handling code
further.
2016-08-26 20:54:52 +02:00
Pierre-Yves David
c056fb41dc histedit: directly use node in 'verifyactions'
It does not seem useful to convert to hex: it is an extra step and they are
longer strings. So we stick to node for the logic. We only convert to short hex
for error when needed. As a nice side effect this remove the explicit constant
usage in'[12:]'. This will also help moving the code around later as we just
have to access action.node.
2016-08-26 20:54:32 +02:00
Pierre-Yves David
58fa162d21 histedit: temporarily shorten name of 'constraints' variable
An upcoming changeset will make the line where this variable is used
slightly too long. Other later changesets will clean that up further and makes
the variable unnecessary, so this is only temporary and it does seems useful to
put anything more complicate in place.
2016-08-26 20:42:18 +02:00
Pierre-Yves David
5dfe266b33 histedit: drop the 'nodetoverify' local variable
We can just use 'action.node'.
2016-08-26 20:38:37 +02:00
Pierre-Yves David
f113c210a5 histedit: make 'constraints' a class attribute instead of a method
There does not seem to be a reason for this to be a method. So we initialise
the class attribute once and for all at creation time and drop the instance
method.
2016-08-26 20:34:58 +02:00
Pierre-Yves David
d390c8d401 histedit: drop the 'nodetoverify' method
That method is just returning self.node and is never overridden. We just use
the attribute directly instead and get rid of the method.

This is the beginning of series to simplify and unify verification of constraints
for actions.
2016-08-26 20:31:33 +02:00
Augie Fackler
4e1c384d0a extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
2016-08-23 11:26:08 -04:00
Hannes Oldenburg
f878dbe267 histedit: use samefile function from cmdutil
Replace usage of inefficient samefile function in collapse with a call to
cmdutil.samefile().
2016-08-21 08:03:22 +00:00
Sean Farley
bae0386e22 histedit: move autoverb rule to the commit it matches
Inspired by how 'git rebase -i' works, we move the autoverb to the
commit line summary that it matches. We do this by iterating over all
rules and inserting each non-autoverb line into a key in an ordered
dictionary. If we find an autoverb line later, we then search for the
matching key and append it to the list (which is the value of each key
in the dictionary). If we can't find a previous line to move to, then we
leave the rule in the same spot.

Tests have been updated but the diff looks a little messy because we
need to change one of the summary lines so that it will actually move to
a new spot. On top of that, we added -q flags to future some of the
output and needed to change the file it modified so that it wouldn't
cause a conflict.
2016-06-21 14:58:49 -07:00
Sean Farley
f5c99064dd histedit: use _getsummary in ruleeditor
This patch uses our common method instead of duplicating logic.
2016-05-27 14:03:00 -07:00
Sean Farley
0aadad3fdc histedit: use _getsummary in torule
This patch uses our common method instead of duplicating logic.
2016-05-27 14:02:36 -07:00
Sean Farley
2a852d9312 histedit: extract common summary code into method
We're going to need to use this code in our autoverb logic so let's
extract it now and save ourselves from code duplication.
2016-05-27 14:00:12 -07:00
Sean Farley
a8452be140 histedit: remove unneeded initial parameter
Now that the autoverb logic no longer acts on an individual rule line,
we don't need this parameter since we apply our logic just once at the
time of initialization.
2016-05-26 15:43:00 -07:00
Sean Farley
60d7ad0f37 histedit: move autoverb logic from torule to ruleeditor
This is needed for an upcoming change that will automatically rearrange the
rules based on the commit message. Before this patch, the autoverb logic only
applied to one rule at a time. This moves that logic one step up so that it can
iterate over all the rules and rearrange as needed.
2016-05-26 16:46:10 -07:00
Pulkit Goyal
5f52c722cf py3: conditionalize cPickle import by adding in util
The cPickle is renamed to _pickle in python3 and this C extension is available
 in pickle which was not included in earlier versions. So imports are conditionalized
 to import cPickle in py2 and pickle in py3. Moreover the use of pickle in py2 is
 switched to cPickle as the C extension is faster. The hack is added in util.py and
the modules import util.pickle
2016-06-04 14:38:00 +05:30
Sean Farley
a69dcd1771 histedit: add experimental config for using the first word of the commit
This allows users to start a commit with "verb! ..." so that when this is
opened in histedit, the default action will be "verb". For example, "roll! foo"
will default to the action "roll". Currently, we'll allow any known verb to be
used but this is experimental.
2016-05-06 18:12:36 -07:00
Sean Farley
6348f9426e histedit: add optional parameter for determining intial editor line
A simple refactor to allow us to change the default verb for the initial editor
display.
2016-05-06 18:00:03 -07:00
Yuya Nishihara
a5c934df3c py3: move up symbol imports to enforce import-checker rules
Since (b) is banned, we should do the same for (a) for consistency.

 a) from mercurial import hg
    from mercurial.i18n import _

 b) from . import hg
    from .i18n import _
2016-05-14 14:03:12 +09:00
Pulkit Goyal
8d03cfe483 py3: make hgext/hisedit.py use absolute_import 2016-05-06 21:52:26 +05:30
Mateusz Kwapich
36f23adcb5 histedit: add a hint about enabled dropmissing to histedit edit comment
Adds a hint to histedit comment reminding user about enabled dropmissing.
This will make the enabled dropmissing more visible. The example comment:

# Edit history between 5abd0a5c28d1 and b54649a8a63f
#
# Commits are listed from least to most recent
#
# You can reorder changesets by reordering the lines
#
# Commands:
#
#  e, edit = use commit, but stop for amending
#  m, mess = edit commit message without changing commit content
#  p, pick = use commit
#  b, base = checkout changeset and apply further changesets from there
#  d, drop = remove commit from history
#  f, fold = use commit, but combine it with the one above
#  r, roll = like fold, but discard this commit's description
#
# Deleting a changeset from the list will DISCARD it from the edited history!
2016-03-19 11:39:13 -07:00
Jun Wu
745b527cb7 histedit: do not close stdin
Closing stdin is unexpected by chgserver and is not a good idea generally.
This patch refactors related code a bit and make sure stdin is not closed.
It will make chg much happier on test-histedit*.t.
2016-03-15 00:42:33 +00:00
Mateusz Kwapich
812fb817e3 histedit: have dropmissing abort on empty plan
We noticed that many users have the intuition of laving the editor empty when
they want to abort the operation. The fact that dropmissing allows user to
delete all edited commits is not intuitive even for users that asked for it.

Let's prevent people from this footgun.
2016-03-13 16:46:49 -07:00
liscju
7a7ee3b559 histedit: adds hint how to reorder changesets at editor (issue3766) 2016-03-08 21:59:06 +01:00
timeless
6b7ebe1ed5 histedit: reword message when a changeset produces no changes
There are various ways to use histedit such that an item in
the list of things to perform will not result in a change
relative to the previous repository state.

When that happens, histedit does not keep the commit/message.

This changes the note to try to explain to the user that it
will not be present in their history.
2016-03-02 22:39:03 +00:00
liscju
7a22f98665 histedit: improve error when run on nodes with children (issue5056) 2016-02-29 15:12:26 +01:00
Pierre-Yves David
7d58576c3b histedit: also handle locally missing nodes when reading obsolescence
The previous version of the code was interpreting markers to a missing
node as a prune in all cases. The expected way to handle such
situation is to keep reading markers, only turning successors into
"prune" if they are at the end of a chain.

We update the code and add a test for this.
2016-02-24 16:58:07 +01:00
Kostia Balytskyi
4b4261dc2f histedit: make histedit aware of obsolescense not stored in state (issue4800)
Before this change, when histedit exited to interactive session (during edit
command for example), user could introduce obsolescence markers that would not
be known to histedit. For example, user could've amended one of the commits.
The fact of this amendment would not be stored in histedit's state file
and later, when histedit would try to process all the replacements,
one of the final successors (in histedit's opinion) would turn out to be hidden.
This behavior is described in issue4800. This commit fixes it.
2016-02-23 21:38:36 +00:00
Kostia Balytskyi
7b6b233a86 histedit: unifying the way replacements are computed for abort and success
This is a part of a bigger refactoring effort with the ultimate goal of
better understanding of how histedit works and fixing issue4800.
2016-02-16 14:49:29 +00:00
Kostia Balytskyi
f0666adeb0 histedit: renaming parts to which _histedit was split
I recently broke _histedit into multiple functions, each of which
had 'action' in its name. This is a little bit confusing since 'action'
is the word for an individual histedit plan item (such as edit or pick).
To avoid this confusion, these functions are now renamed to contain
'histedit' as part of their names.
2016-02-15 14:57:06 +00:00
Kostia Balytskyi
6f752dbaad histedit: break _histedit into smaller pieces (add _finishaction)
This is a part of a bigger effort to refactor histedit with ultimate
goal of understanding it.
2016-02-15 12:07:33 +00:00
Kostia Balytskyi
a41792ba9d histedit: change string literals to constants in goal naming
This is a part of bigger effort to refactor histedit with ultimate
goal of understanding it.
2016-02-15 10:48:36 +00:00
Kostia Balytskyi
41ac3675d5 histedit: break _histedit function into smaller pieces
We add _getgoal, _validateargs.

This is a part of bigger effort to refactor histedit. Initial steps are to
break _histedit function into smaller pieces which will supposedly be more
understandable. After this is done, I will have a better understanding
of how histedit works and apply that to fix issue4800.
2016-02-14 21:15:59 +00:00
Kostia Balytskyi
c6f4a6c3fa histedit: break _histedit function into smaller pieces (add _continueaction)
This is a part of bigger effort to refactor histedit. Initial steps are to
break _histedit function into smaller pieces which will supposedly be more
understandable. After this is done, I will have a better understanding
of how histedit works and apply that to fix issue4800.
2016-02-14 21:00:05 +00:00
Kostia Balytskyi
7860d98cbb histedit: break _histedit function into smaller pieces (add _newaction)
This is a part of bigger effort to refactor histedit. Initial steps are to
break _histedit function into smaller pieces which will supposedly be more
understandable. After this is done, I will have a better understanding
of how histedit works and apply that to fix issue4800.
2016-02-01 17:20:51 +00:00
Kostia Balytskyi
2691d2b5da histedit: break _histedit function into smaller pieces (add _editplanaction)
This is a part of bigger effort to refactor histedit. Initial steps are to
break _histedit function into smaller pieces which will supposedly be more
understandable. After this is done, I will have a better understanding
of how histedit works and apply that to fix issue4800.
2016-02-01 14:12:38 +00:00
Kostia Balytskyi
94524de837 histedit: break _histedit function into smaller pieces (add _abortaction)
This is a part of bigger effort to refactor histedit. Initial steps are to
break _histedit function into smaller pieces which will supposedly be more
understandable. After this is done, I will have a better understanding
of how histedit works and apply that to fix issue4800.
2016-02-01 12:51:20 +00:00
timeless
8f5f0dd31d histedit: suggest the correct tool to continue (not histedit)
Suggest committing (or whatever the current activity is), via
wrongtooltocontinue which uses howtocontinue.
2016-02-04 03:47:00 +00:00