D3754: graft: introduce --abort flag to abort interrupted graft

Yuya Nishihara yuya at tcha.org
Mon Jun 25 11:06:43 EDT 2018


> +    # changeset from which graft operation was started
> +    startctx = None
> +    if len(newnodes) > 0:
> +        startctx = repo[newnodes[0]].p1()

This can be moved under `if newnodes:`

> +    else:
> +        startctx = repo['.']
> +    # whether to strip or not
> +    cleanup = False
> +    if newnodes:
> +        newnodes = [repo[r].rev() for r in newnodes]

...

> +    if not cleanup:
> +        # we don't update to the startnode if we can't strip
> +        startctx = repo['.']

since startctx is re-initialized here.

> +        hg.updaterepo(repo, startctx.node(), True)


More information about the Mercurial-devel mailing list