[PATCH 4 of 7] histedit: replaces `create`, `replaced`, `tmpnodes` lists with replacement graph

Augie Fackler raf at durin42.com
Mon Oct 1 13:41:09 CDT 2012


On Sep 27, 2012, at 6:07 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1348786830 -7200
> # Node ID b59b582c76bea319a9871d72776555dd77f1fbb6
> # Parent  b7ecc3e190f5d9488ab15861d99f8d53bf56b30c
> histedit: replaces `create`, `replaced`, `tmpnodes` lists with replacement graph

s/replaces/replace/

> 
> 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
> will eventually be removed to the list of new nodes that replace it. Operation
> 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::
> 
>    (<new-ctx-to-work-on>, [list-of-rewriting-operation)
> 
> The old `created`, `replaced` and `tmpnodes` are not longer returned and they
> not longer exists throughout the histedit operation. We such information is

s/We/When/?

> necessary it is computed from the replacement graph. This computation is done in
> the `processreplacement` function.
> 
> The `replacemap` is also dropped. It's is computed at the end of the command from the

s/is//

> graph.  The `bootstrapcontinue` methods is altered to computed 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.

reference the issue?

> 
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -272,7 +272,7 @@
> 
> +        (parentctx, replacement_) = actfunc(ui, repo, parentctx, ha, opts)
> +        replacements.extend(replacement_)
> 
>     hg.update(repo, parentctx.node())
> 
> +    mapping, tmpnodes, __ = processreplacement(repo, replacements)

What's the __ here?

> +    if mapping:
> +        for prec, succs in mapping.iteritems():
> +            if not succs:
> +                ui.debug('histedit: %s is dropped\n' % node.short(prec))
> +            else:




> -def writestate(repo, parentctxnode, created, replaced,
> -               tmpnodes, existing, rules, keep, topmost, replacemap):
> +def writestate(repo, parentnode, rules, keep, topmost, replacements):
>     fp = open(os.path.join(repo.path, 'histedit-state'), 'w')
> -    pickle.dump((parentctxnode, created, replaced,
> -                 tmpnodes, existing, rules, keep, topmost, replacemap),
> -                fp)
> +    pickle.dump((parentnode, rules, keep, topmost, replacements), fp)

If we're updating the format, can we stop using pickle?

>     fp.close()
> 
> def readstate(repo):
>> 



>   $ 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 to 1be9c35b4cb2
> +  histedit: moving bookmarks four to 1be9c35b4cb2
> +  histedit: moving bookmarks five to 7c044e3e33a9

can you record "moving bookmarks $mark from $old to $new"? That feels like a better debug statement.

>   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
> @@ -159,7 +151,6 @@
> 
>   $ hg log --graph
>   @  changeset:   3:1be9c35b4cb2
> -  |  bookmark:    five
>   |  bookmark:    four
>   |  bookmark:    three
>   |  tag:         tip
> @@ -168,6 +159,7 @@
>   |  summary:     d
>   |
>   o  changeset:   2:7c044e3e33a9
> +  |  bookmark:    five
>   |  user:        test
>   |  date:        Thu Jan 01 00:00:00 1970 +0000
>   |  summary:     f



More information about the Mercurial-devel mailing list