[PATCH 2 of 5] histedit: replace various nodes lists with replacement graph (and issue3582)
Augie Fackler
raf at durin42.com
Tue Oct 9 19:03:18 CDT 2012
More comments on this one. This patch is so massive I'm done reviewing the series until the next round. I would consider applying edits myself, but I need the questions from the first patch addressed.
On Oct 2, 2012, at 4:42 AM, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1349170380 -7200
> # Node ID 2ac4884a1a22b58deb148ca0895493d03ab2bea8
> # Parent 1a8f44e303c07659197acf8f2e77904b70f06872
> 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 operation record the full list of "old" node that
Tracked operation_s_, "old" node_s_
> will eventually be removed to the list of new nodes that replace it. Operation
Operation_s_
> on temporary nodes are tracked too. Changeset dropping are recorded as "old" is
> replaced by []. 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.
>
> Now, histedit `action` only returns::
histedit action functions now always return a tuple of (new-ctx, [list of rewriting operations])
>
> (<new-ctx-to-work-on>, [list-of-rewriting-operation)
>
> The old `created`, `replaced` and `tmpnodes` are not longer returned and they
s/not longer/no longer/
> not longer exists throughout the histedit operation. We such information is
s/not longer exists/no longer exist/; s/We such/When such/
> 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 is altered to computed this different kind of
s/is/are/ ; s/computed/compute/
> 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
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
[..]
> + actfunc = actiontable[action]
> + (parentctx, replacement_) = actfunc(ui, repo, parentctx, ha, opts)
drop superfluous parens
> @@ -681,43 +646,79 @@ def verifyrules(rules, repo, ctxs):
> if action not in actiontable:
> raise util.Abort(_('unknown action "%s"') % action)
> parsed.append([action, ha])
> return parsed
>
> -def movebookmarks(ui, repo, replacemap, tmpnodes, created):
> +def processreplacement(repo, replacements):
> + """process the list of replace to return
list of replacements
> +
> + 1) the final mapping between original and created nodes
> + 2) the list of temporary node created by histedit
> + 3) the list of new commit created by histedit"""
> + allsuccs = set()
> + replaced = set()
> + fullmapping = {}
> + # initialise basic set
> + # fullmapping record all operation recorded in replacement
> + for rep in replacements:
> + allsuccs.update(rep[1])
> + replaced.add(rep[0])
[...]
> diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
> --- a/tests/test-histedit-bookmark-motion.t
> +++ b/tests/test-histedit-bookmark-motion.t
> @@ -82,21 +82,16 @@
>> pick 055a42cdd887 3 d
>> fold e860deea161a 4 e
>> pick 652413bf663e 5 f
>> EOF
> $ hg histedit 1 --commands commands.txt --verbose | grep histedit
> - histedit: Should update metadata for the following changes:
> - histedit: 055a42cdd887 to ae467701c500
> - histedit: moving bookmarks three
> - histedit: 177f92b77385 to d36c0562f908
> - histedit: moving bookmarks also-two, two
> - histedit: 652413bf663e to 0efacef7cb48
> - histedit: moving bookmarks five
> - histedit: d2ae7f538514 to cb9a9f314b8b
> - histedit: moving bookmarks will-move-backwards
> - histedit: e860deea161a to ae467701c500
> - histedit: moving bookmarks four
> + histedit: moving bookmarks two from 177f92b77385 to d36c0562f908
> + histedit: moving bookmarks three from 055a42cdd887 to ae467701c500
> + histedit: moving bookmarks four from e860deea161a to ae467701c500
> + histedit: moving bookmarks also-two from 177f92b77385 to d36c0562f908
> + histedit: moving bookmarks will-move-backwards from d2ae7f538514 to cb9a9f314b8b
> + histedit: moving bookmarks five from 652413bf663e to 0efacef7cb48
This makes me want you to change the format, THEN change the implementation (or vice-versa). I think it's equivalent, but it'd be a nice touch to not have to trust my eyes.
> saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-backup.hg (glob)
> saved backup bundle to $TESTTMP/r/.hg/strip-backup/34a9919932c1-backup.hg (glob)
> $ hg log --graph
> @ changeset: 3:0efacef7cb48
> | bookmark: five
> @@ -144,32 +139,29 @@
>> pick d36c0562f908 1 c
>> pick 0efacef7cb48 3 f
>> pick ae467701c500 2 d
>> EOF
> $ hg histedit 1 --commands commands.txt --verbose | grep histedit
> - histedit: Should update metadata for the following changes:
> - histedit: 0efacef7cb48 to 1be9c35b4cb2
> - histedit: moving bookmarks five
> - histedit: 0efacef7cb48 to 7c044e3e33a9
> - histedit: ae467701c500 to 1be9c35b4cb2
> - histedit: moving bookmarks four, three
> + histedit: moving bookmarks three from ae467701c500 to 1be9c35b4cb2
> + histedit: moving bookmarks four from ae467701c500 to 1be9c35b4cb2
> + histedit: moving bookmarks five from 0efacef7cb48 to 7c044e3e33a9
> saved backup bundle to $TESTTMP/r/.hg/strip-backup/ae467701c500-backup.hg (glob)
>
> We expect 'five' to stay at tip, since the tipmost bookmark is most
> likely the useful signal.
>
> $ hg log --graph
> @ changeset: 3:1be9c35b4cb2
> - | bookmark: five
> | bookmark: four
> | bookmark: three
> | tag: tip
> | user: test
> | date: Thu Jan 01 00:00:00 1970 +0000
> | summary: d
> |
> o changeset: 2:7c044e3e33a9
> + | bookmark: five
> | user: test
> | date: Thu Jan 01 00:00:00 1970 +0000
> | summary: f
> |
> o changeset: 1:d36c0562f908
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list