Commit Graph

50 Commits

Author SHA1 Message Date
Pierre-Yves David
d625ea9d23 clfilter: drop unnecessary explicit filtering on histedit
Hidden changeset filtering is now done at repo level. The orphaned
children computation will not include any (unless you add --hidden).
2012-12-24 12:00:08 +01:00
Pierre-Yves David
febbf1f08f histedit: allow operation from non-head if obsolete is enabled
Obsolescence markers can represent this situation just fine. Rewritten
revisions are marked as precursors of the ones creates by
histedit. Unaffected descendants become "unstable".

If obsolescence is not enabled we keep the current behavior of
aborting. This new behavior only applies when obsolete is
enabled and is subject to future discussion and changes.
2012-12-31 17:46:22 -06:00
Augie Fackler
9766845689 bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.

This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
2012-11-07 16:21:39 -06:00
Pierre-Yves David
4c13968496 histedit: create obsolescence markers in deterministic order
I arbitrary use the revnum of the precursor because it sound a right order.
2012-10-16 16:56:14 +02:00
Thomas Arendsen Hein
4ab7bd04fc histedit: max(x, key=y) and min(x, key=y) are not available in python 2.4
Use sorted(x, key=y)[-1] or sorted(x, key=y)[0] instead.
2012-10-16 16:04:28 +02:00
Pierre-Yves David
e5dbcdf7b1 histedit: do not use "min" on ctx
It does not crash but does not compare revision number at all. We actually
remove any call to min because the list is already topologically sorted.
2012-10-14 23:49:28 +02:00
Pierre-Yves David
29277d440c histedit: clean abort when there is nothing to edit 2012-10-14 23:58:02 +02:00
Pierre-Yves David
c86f3a557a histedit: rename revs in ctxs inside the between function
The variable content is actually contexts, not revision numbers.
2012-10-15 00:05:16 +02:00
Pierre-Yves David
f329dd0261 histedit: refuse to edit public changeset
Public changeset are immutable. This changeset enforce that in histedit.
2012-10-12 21:41:08 +02:00
Pierre-Yves David
2237d9bd3f histedit: ignores hidden revision when checking for orphaned nodes
We do not want hidden revision to block histedit. They are already "dead"
and we do not care about dead orphans. see similar changeset 40db49347807 for
rebase.
2012-09-27 14:00:52 +02:00
Pierre-Yves David
3607c94328 histedit: simplify computation of edited set (issue3620)
This complex code can be replaced by two simple revset calls.
2012-10-10 06:27:06 +02:00
Pierre-Yves David
e4f0351734 histedit: add obsolete support
When the obsolete feature is enabled, histedit creates obsolescence marker
instead of stripping replaced changesets.

For now, we keep stripping temporary nodes created along the way.
2012-09-27 13:59:48 +02:00
Pierre-Yves David
c922450686 histedit: replace various nodes lists with replacement graph (and issue3582)
This changeset rewrites the change tracking logic of histedit to record every
operation it does. Tracked operations record the full list of "old" node that
will eventually be removed to the list of new nodes that replace it. Operations
on temporary nodes are tracked too. Dropped changesets are also recorded as an
"old" node replacement by nothing. This logic is similar to the obsolescence
marker one and will be used for this purpose in later commit.

This new logic implies a big amount of change in the histedit code base.

histedit action functions now always return a tuple of

    (new-ctx, [list of rewriting operations])

The old `created`, `replaced` and `tmpnodes` are no longer returned and stored
during histedit operation. When such information is necessary it is computed
from the replacement graph. This computation is done in the `processreplacement`
function.

The `replacemap` is also dropped. It is computed at the end of the command from the
graph.  The `bootstrapcontinue` methods are altered to compute this different kind of
information.

This new mechanism requires much less information to be written on disk.

Note:

    This changes allows a more accurate bookmark movement. bookmark on dropped
    changeset are now move of their parent (or replacement of their parent)
    instead of their children.

    This fix issue3582
2012-10-11 08:36:50 +02:00
Matt Mackall
5047212c31 merge with durin42 2012-10-12 15:52:59 -05:00
Pierre-Yves David
8b8b1a2322 histedit: update bookmark movement notice
New format is:

    histedit: moving bookmarks <bookmark> from <old> to <new>
2012-10-10 05:54:38 +02:00
Pierre-Yves David
4a01290b0d histedit: simplify computation of newchildren during --continue
We are now checking for any changesets between the previous `parentctx` and the
current working directory parent. If the current working directory parent is
inconsistent, we abort.

This change is useful as it simplifies the --continue process, easing upcoming
changes.

While working on this changeset, I spotted an unhandled corner case. This corner
case is now documented and have an appropriate issue in the tracker (issue3655).
However, the corner case is still unhandled. handling this test case would
required some additional work:

- actually decide what the proper behavior should be:
- change content of "histedit-state" to add missing data necessary to detect
  the situation
- add proper testcase,

But leaving the case unhandled is "okay":

- this is not a regression,
- this is not the purpose of the current series,
- the freeze was near and I had more critical stuff to attend to,
- this is a simple but non trivial, (see above)
2012-10-10 06:20:14 +02:00
Pierre-Yves David
2448b893df histedit: move continue logic into a dedicated function
When histedit "continue", there is several complicated logic to apply in order to
detect intermediate changeset and concluded pending operation.

This changeset extract this logic in a dedicated function to lighten the main
one. No alteration to the logic is done.
2012-09-27 13:54:47 +02:00
Pierre-Yves David
a1ed29a5c8 histedit: rename tip to topmost
I expected `tip` to be repo's tip when it was the rewritten set tip. I rename
the variable to the less ambiguous `topmost`.
2012-09-26 18:13:00 +02:00
Pierre-Yves David
b30bd4fe4d histedit: factorise node stripping logic
Create a function dedicated to stripping a group of node. All existing
duplicated code is replaced by call to this function.

This new function take care of stripping known and relevant node only.
2012-09-26 14:46:08 +02:00
Pierre-Yves David
650044fefe histedit: extract bookmark logic in a dedicated function
This lighten the main function and will help to see future changes to this
bookmark logic.
2012-09-26 14:19:19 +02:00
Pierre-Yves David
9b26a9a8ee histedit: remove all usages of hex[:12]
- `node.hex(n)[:12]` is the same as `node.short(n)`
- `ctx.hex()[:12]` is the same as `str(ctx)`
2012-09-26 12:57:23 +02:00
Pierre-Yves David
7053ba6e9e histedit: replaces patching logic by merges
The old and fragile patching logic is replaced by smart merges (as rebase and
graft do). This should prevents some conflicts and smoother human resolution.

For this purpose the "foldchanges" function is renamed to "applychanges" and
handle a single revision only.
2012-09-21 19:27:22 +02:00
Pierre-Yves David
f9a739a15f histedit: display action being processed in debug mode
This is very useful when debugging histedit.
2012-09-21 19:25:19 +02:00
Pierre-Yves David
56df9607c6 histedit: fold in memory
Update the folding code to works in memory instead of applying patches on the
working directory. This is cleaner, faster and prepare the removal of the whole
patching logic.

This new collapse function will probably move into core sooner or later. A lot
of other rewriting operation may benefit from it.
2012-09-21 19:24:31 +02:00
Pierre-Yves David
c8363dbc19 histedit: move makedesc function near other rules related function
Having it in the middle of action logic is confusing
2012-09-21 00:33:30 +02:00
Pierre-Yves David
94277b3144 histedit: move between function outside the action logic
Having this function in the middle of action and patching logic did not make
sense
2012-09-21 19:14:04 +02:00
Pierre-Yves David
cb6a116fe7 histedit document the makedest function 2012-09-21 00:30:22 +02:00
Pierre-Yves David
603772df2b histedit: documents the between function 2012-09-21 00:30:07 +02:00
Patrick Mezard
c54ad25151 histedit: fix unused variable warnings spotted by pyflakes 2012-09-05 22:01:09 +02:00
Leah Xue
b766bced84 histedit: factored out diff/patch logic
This patch is the first step towards a refactoring of the histedit
extension to use underlying graft machinery instead of diff/patch as
discussed in issue3527. Replacing diff/patch with graft is necessary
to fix, for example, issue3582.
2012-08-21 16:06:34 -07:00
Matt Mackall
b2cf3ac691 merge with i18n 2012-08-06 12:03:07 -05:00
Wagner Bruna
d09c1ff6cb histedit, i18n: warn translators about edit command names 2012-08-02 11:45:16 -03:00
Wagner Bruna
1d9183c516 histedit: sync docstring with edit comment
The docstring should probably reuse the edit comment string instead.
2012-08-02 11:28:21 -03:00
Augie Fackler
124780aa68 histedit: add proper locking around repair.strip() calls 2012-08-01 09:41:57 -05:00
FUJIWARA Katsunori
846e85b25e histedit: make comment part of the file describing rules as translatable
"i18n.gettext()" invocation for "editcomment" itself should have
little impact for whole initialization cost of histedit, because it is
already invoked for initialization of the command table entry.

'\n\n' has to be added to the text being edited separately from
"editcomment", because leading 'line feed' characters are not exported
to "hg.pot" file correctly.
2012-07-30 03:27:07 +09:00
Mads Kiilerich
ffa7814143 histedit: add trailing newline when editing commit messages
test-histedit-edit.t failed because Solaris sed strips lines not ending with
\n.
2012-07-30 03:53:38 +02:00
FUJIWARA Katsunori
9b75cb3833 histedit: remove updating statistics line from the examples describing rules
Before this patch, updating statistics line appears at the bottom of
the examples describing rules to edit history.

But such line never appear in the file describing rules while
histedit-ing, so this patch removes that line from the examples.
2012-07-29 16:19:32 +09:00
Patrick Mezard
e7c675580e histedit: fix new nodes computation with --continue (issue3534)
When running the following actions:

  pick 617f94f13c0f 1 +4
  drop 888f9082bf99 2 +5
  fold 251d831eeec5 3 +6

if the fold fails, is fixed by the user with a new changeset, --continue
will ignore the new revision when generating the fold changelog. This
was caused by --continue detecting new changesets as descendants of the
parent not descendants of changesets in the initial list. In this case,
dropped changesets must be ignored.

Even with the computation fixed, the 'newchildren' list was always
emptied by the filtering loop and passed empty to finishfold().

Note that changesets dropped and recreated identically will still be
missed. This probably cannot be solved but is unlikely to happen.

Other things, like 'newchildren' having multiple heads, should be
checked as well.
2012-07-25 16:27:26 +02:00
Patrick Mezard
3502d58447 histedit: end folding message with an LF
This is convenient when running tests dumping the editor content, it
avoids the following output line to be mixed with histedit message.
2012-07-25 11:09:51 +02:00
Sune Foldager
ffe56435bf peer: introduce peer methods to prepare for peer classes
This introduces a peer method into all repository classes, which currently
simply returns self. It also changes hg.repository so it now raises an
exception if the supplied paths does not resolve to a localrepo or descendant.

Finally, all call sites are changed to use the peer and local methods as
appropriate, where peer is used whenever the code is dealing with a remote
repository (even if it's on local disk).
2012-07-13 21:46:53 +02:00
Adrian Buehlmann
92055c96e6 histedit: use cmdutil.command decorator 2012-07-06 22:43:10 +02:00
Augie Fackler
0b10b5edb8 histedit: add extension docstring from external README
Made a couple of tweaks to try and fit better with the hg docstring
style and fix up some ReST errors in the README.
2012-07-06 12:17:53 -05:00
Augie Fackler
39b1dce60e histedit: don't crash if the result of fixing up a fold is empty 2012-07-06 11:39:02 -05:00
Augie Fackler
3b175c50a8 histedit: replace hexshort lambda with node.short 2012-07-06 11:06:57 -05:00
Mads Kiilerich
7c32277ff3 histedit: use stable iteration order for processing bookmarks
Random dict iteration order caused test failure in
test-histedit-bookmark-motion.t.
2012-06-30 03:34:41 +02:00
Augie Fackler
a0a7fde1c9 histedit: mark as a first party extension 2012-06-28 08:45:38 -05:00
Augie Fackler
99e113bc35 histedit: remove use of reduce() builtin spotted by check-code 2012-06-27 18:42:48 -05:00
Augie Fackler
8f661724bc histedit: fix most check-code violations 2012-06-27 18:35:33 -05:00
Augie Fackler
526a183684 histedit: new extension for interactive history editing 2012-06-27 17:52:54 -05:00
Mads Kiilerich
588e53b65c spelling: fix minor spell checker issues 2012-10-10 01:29:56 +02:00