[PATCH 1 of 5] histedit: simplify computation of `newchildren` during --continue

Kevin Bullock kbullock+mercurial at ringworld.org
Fri Oct 5 10:04:37 CDT 2012


On 5 Oct 2012, at 9:10 AM, Pierre-Yves David wrote:

> On Fri, Oct 05, 2012 at 08:42:44AM -0500, Augie Fackler wrote:
>> 
>> 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 1348786765 -7200
>>> # Node ID 1a8f44e303c07659197acf8f2e77904b70f06872
>>> # Parent  fa714f3ed2989aff64c267c9935251d9fc4f31ee
>>> 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 simplify the --continue process, easing upcoming
>>> changes.
>>> 
>>> diff --git a/hgext/histedit.py b/hgext/histedit.py
>>> --- a/hgext/histedit.py
>>> +++ b/hgext/histedit.py
>>> @@ -548,25 +548,23 @@ def histedit(ui, repo, *parent, **opts):
>>>       os.unlink(repo.sjoin('undo'))
>>> 
>>> 
>>> def bootstrapcontinue(ui, repo, parentctx, existing, replacemap, rules,
>>>                     tmpnodes, created, replaced, opts):
>>> -    currentparent, wantnull = repo.dirstate.parents()
>>> -    # existing is the list of revisions initially considered by
>>> -    # histedit. Here we use it to list new changesets, descendants
>>> -    # of parentctx without an 'existing' changeset in-between. We
>>> -    # also have to exclude 'existing' changesets which were
>>> -    # previously dropped.
>>> -    descendants = set(c.node() for c in
>>> -            repo.set('(%d::) - %d', parentctx, parentctx))
>>> -    notdropped = set(n for n in existing if n in descendants and
>>> -            (n not in replacemap or replacemap[n] in descendants))
>>> -    # Discover any nodes the user has added in the interim. We can
>>> -    # miss changesets which were dropped and recreated the same.
>>> -    newchildren = list(c.node() for c in repo.set(
>>> -        'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped))
>>>   action, currentnode = rules.pop(0)
>>> +    # is there any new commit between the expected parent and "."
>>> +    # XXX does not take non linear new change in account (but previous
>>> +    # XXX implementation didn't used them anyway
>>> +    newchildren = [c.node() for c in repo.set('(%d::.)', parentctx)]
>>> +    if not newchildren:
>>> +        # `parentctxnode` should match but no result. This means that
>>> +        # currentnode is not a descendant from parentctxnode.
>>> +        msg = _('working directory parent is not a descendant of %s')
>>> +        hint = _('update to proper revision and run "hg histedit '
>>> +                 '--continue" again')
>> 
>> Is there a reason to not say parentctx in the int instead of "proper revision"?
> 
> Yes. user may want to update to a descendant of parent ctx (in the split
> case). The definition of proper revision is defined in the main abort
> message. I think it's clear enough.

I disagree. It would be clearer to say something like:

working directory is not a descendant of [REV]
(update to [REV] or its descendant and run "hg histedit --continue" again)

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121005/7d4477ad/attachment.html>


More information about the Mercurial-devel mailing list