Commit Graph

34 Commits

Author SHA1 Message Date
timeless
84c6183618 histedit: prefer edit commit, edit message, use commit
Selecting editing commits, rewording commit messages, and
selecting commits are key actions, we will prefer them more
generally in a future commit, this pulls them ahead before
that to make the diffs easier to read.

The remaining commands are left alphabetically sorted
2015-12-23 21:20:08 +00:00
timeless
c5945ca9d0 histedit: list action when intervention is required 2015-12-23 08:57:04 +00:00
timeless
303f2b32c3 histedit: handle exceptions from node.bin in fromrule 2015-12-23 23:51:29 +00:00
timeless
f32fa41604 histedit: use parse-error exception for parsing 2015-12-27 03:33:09 +00:00
Mateusz Kwapich
011f0f625e histedit: delete to drop
The default behaviour to forbid this makes a lot of sense for novice users
because it's safeguarding them from dangerous behavior but making it
configurable will be apprieciated by power users in at least one big
organization.

It allows an user to look an histedit rules from declarative perspective and
make the rules reflect the state after histedit.  If we can move lines t move
commits why can't we drop lines to drop commits?

Let's put this behind config knob and inform users about this feature the very
moment they are trying to use it so they can choose desired behaviour.
2015-12-15 13:27:09 -08:00
timeless
26fb25b6cd histedit: omit useless message from update (_histedit)
specifically:
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2015-12-14 22:37:31 +00:00
timeless
bdf1c27c7d tests: relax histedit issue4251 and issue3893 backups
I'm globbing these because some are globbed, and this pair
gets in the way of the main parts of the series.
2015-12-14 22:34:30 +00:00
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
timeless
538843243e histedit: improve missing rule suggestion
include actual suggested text
2015-12-02 07:41:35 +00: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
Matt Harbison
a8e6bbf99c tests: tolerate differences between Linux and Windows error strings
These are related to differences in how missing files and network connection
failures are displayed.  I opted to combine the strings in one line instead of
using '#if windows' blocks around entire commands in order to avoid future
changes being accidentally missed in the Windows sections.  Globbing away the
entire output seemed wrong, as it could mask other failures.

The raw messages involved are:

      Linux                               Windows

  "* not known"               <-> "getaddrinfo failed"
  "Connection refused"        <-> "No connection could be made because the
                                   target machine actively refused it"
  "No such file or directory" <-> "The system cannot find the file specified"

Issue 4941 indicates that NetBSD has yet another string for "* not known".

Also, the histedit test shows that the missing file is printed first on Windows,
last on Linux.  That is controlled in windows.py:posixfile if we care to change
it.
2015-11-09 13:12:35 -05:00
Durham Goode
6c10065cf4 histedit: make histedit prune when obsolete is enabled
Back in June we made histedit use obsolete markers to cleanup when possible.
This was rolled back as part of bb3db0db4037 (which should have only rolled back
the --abort stuff, but rolled back everything). This caused a nasty bug when
used in conjuction with the inhibit+directaccess extensions where histedit would
leave old nodes around even after they had been squashed away.

The root of the problem is that we first clean up old nodes, and then we clean
up temp nodes. In the first pass, when we obsoleted old nodes, some would become
unobsolete because they had temp nodes on top of them, thus making them stick
around even after the histedit finished.

The fix is to A) move the temp node cleanup to be before the old node cleanup
(since they are topological on top of the old nodes), and B) use obsolete
markers instead of stripping.
2015-10-17 12:32:23 -07:00
Christian Delahousse
7472064a6f histedit: delete histedit statefile on any exception during abort
When an user aborts a histedit, many things could go wrong. At a minimum, after
a histedit abort failure, their repository should be out of that state. We've
found situations where the user could not exit the histedit state without
manually deleting the histedit state file. This patch ensures that if any
exception happens during an abort, the histedit statefile will be deleted so
that users are out of the histedit state and can at least manually get the repo
back to a workable condition.
2015-10-05 16:44:45 -07:00
timeless@mozdev.org
e88cb37448 histedit: improve discoverability of edit commit message 2015-08-28 15:50:36 -04:00
Durham Goode
70caa9d8e9 histedit: fix keep during --continue
The --keep option was being serialized to the state file, but it wasn't actually
being used when running a histedit --continue. This fixes that.
2015-05-28 20:30:20 -07:00
Durham Goode
8cf27316ea histedit: allow histedit --continue when not on a descendant (BC)
Previously we would not allow --continue if the current working copy parent was
not a descendant of the commit produced by the previous histedit step. There's
nothing really blocking us from continuing the histedit in this situation, so
let's stop aborting in this case.

This is technically a BC change, but it is making things more forgiving so I
think it's ok.

In the future we will likely add an 'exec' action to histedit, which means the
user can do whatever they want during the middle of a histedit (like perhaps
calling 'hg update'), which means we'll need to support this case eventually
anyway.
2015-04-04 01:00:05 -07:00
Durham Goode
14bdd4051b histedit: allow configuring default behavior
Adds a configuration setting for allowing users to specify the default behavior
of 'hg histedit' without arguments. This saves users from having to manually
figure out the bottom commit or a complicated revset. My current revset of
choice is "only(.) & draft() - ::merge()"

The commits that histedit can work with is usually quite limited, so if this
feature ends up working well, we may want to consider making "only(.) & draft()
- ::merge()" the default behavior for everyone.
2015-02-02 16:19:35 -08:00
Kevin Bullock
6cd9563e40 merge with stable 2014-09-07 11:46:11 -05:00
Siddharth Agarwal
ca3e00a8e3 histedit: abort gracefully on --continue/--abort with no state
Previously we'd print an ugly message saying that the histedit-state file
doesn't exist in the repo.
2014-09-03 20:42:51 +02:00
Mike Edgar
fb41d0ff84 histedit: add "roll" command to fold commit data and drop message (issue4256)
This new histedit command (short for "rollup") is a variant of "fold" akin to
"hg amend" for working copy: it accumulates changes without interrupting
the user and asking for an updated commit message.
2014-08-06 16:51:41 -04:00
FUJIWARA Katsunori
9aa5fab4ec histedit: use 'util.ellipsis' to trim description of each changesets
Before this patch, trimming description of each changesets in histedit
may split at intermediate multi-byte sequence.

This patch uses 'util.ellipsis' to trim description of each changesets
instead of directly slicing byte sequence.

Even though 'util.ellipsis' adds '...' as ellipsis when specified
string is trimmed (= this changes result of trimming), this patch uses
it, because:

  - it can be used without any additional 'import', and
  - ellipsis seems to be better than just trimming, for usability
2014-07-06 02:56:41 +09:00
David Soria Parra
8c28662ef9 histedit: select the lowest rev when looking for a root in a revset (bc)
When we specify a revision or a revset we just get the last element from the
list. For revsets this can lead to unintended effects where you specify a
revset like only() but instead histedit selects the highest revision in the
set as root. Therefore we should always use the lowest revision number as
root.
2014-03-13 16:05:06 -07:00
Matt Mackall
b35d905ff6 histedit: shorten new fold message
Lots of people, like Mr. Check-Code, insist on using 80-column terminals.
2014-02-15 19:12:53 -06:00
Adrian Zgorzałek
4f40289598 histedit: clarify description of fold command
N and (N-1) didn't add any information to description of fold.
More useful is refering to the commit list as it is displayed in editor.
2014-02-13 18:05:35 -08:00
FUJIWARA Katsunori
da45f9c6a0 histedit: suggest "histedit --abort" for inconsistent histedit state
Mercurial earlier than 2.7 allows users to do anything other than
starting new histedit, even though current histedit is not finished or
aborted yet. So, unfinished (and maybe inconsistent now) histedit
states may be left and forgotten in repositories.

Before this patch, histedit extension shows the message below, when it
detects such inconsistent state:

   abort: REV is not an ancestor of working directory
   (update to REV or descendant and run "hg histedit --continue" again)

But this message is incorrect, unless old Mercurial is re-installed,
because Mercurial 2.7 or later disallows users to update the working
directory to another revision.

This patch changes the hint message to suggest "hg histedit --abort".
2013-10-01 00:35:07 +09:00
Pierre-Yves David
c044ef8de0 histedit: more precise user message when changeset is missing
Now that we explicitly detect duplicated changesets, we can explicitly
detect missing ones. We cover the same cases as before, some others
and we offer a better error message in all cases.
2013-04-18 15:27:50 +02:00
Pierre-Yves David
f340c552d8 histedit: protect against duplicated entries
Before this change one would issue rules with duplicated entries. For
this to happen some other changeset had to be missing to maintain the
rules length.
2013-04-18 15:22:24 +02:00
Pierre-Yves David
cdc5bce2e5 histedit-test: test unknown command
We had no tested for this case.
2013-04-18 13:51:27 +02:00
Pierre-Yves David
36343ee790 histedit-test: test unknown changeset
We had no tested for this case.
2013-04-18 13:50:59 +02:00
Pierre-Yves David
80cec71127 histedit-test: test malformed line
We had not tested for this case.
2013-04-18 13:49:32 +02:00
Pierre-Yves David
82353ab98e histedit-test: test that extra revisions are detected
We had not tested for this case.
2013-04-18 11:54:31 -04:00
Pierre-Yves David
74b15c1097 histedit-test: test that missing revisions are detected
We had not tested for this case.
2013-04-18 11:53:58 -04:00
Pierre-Yves David
96ebb157a6 histedit: handle multiple spaces between action and hash (issue3893)
There is some clue that the previous code intended to handle that but it was
actually not the case.

As a result action could apply to the empty string '' changeset,
leading to the use the current working directory parent in some
operations.
2013-04-18 11:52:34 -04:00
Pierre-Yves David
cc84391aeb histedit-test: rename histedit-revspec into histedit-argument
We have no testing for argument. This small file seems perfect once but needs a
rename.
2013-04-18 13:38:49 +02:00