D1074: branch: add a --rev flag to change branch name of given revisions

dlax (Denis Laxalde) phabricator at mercurial-scm.org
Mon Oct 16 03:59:14 EDT 2017


dlax requested changes to this revision.
dlax added a comment.
This revision now requires changes to proceed.


  This looks correct to me overall.
  I use this feature with topics a lot and find it pretty convenient so I guess it might make sense for named branches in some workflows.

INLINE COMMENTS

> cmdutil.py:752
> +
> +            ui.debug("changing branch of '%s' from '%s' to '%s'"
> +                     % (hex(ctx.node()), oldbranch, label))

This message is not tested, maybe add a `--debug` call to one of the tests?

> cmdutil.py:774
> +                                branch=label)
> +            # phase handling
> +            commitphase = ctx.phase()

That comment isn't really helpful as is. Maybe explain how you handle phase instead?

> cmdutil.py:782
> +            ui.debug('new node id is %s\n' % hex(newnode))
> +            rewrote += 1
> +

Isn't `rewrote == len(replacements)`?

> commands.py:997
> +    ('C', 'clean', None, _('reset branch name to parent branch name')),
> +    ('r', 'rev', [], _('change branches of the given revs (EXPERIMENTAL)'))],
>      _('[-fC] [NAME]'))

Nit: could you move the closing `]` on the next line and add a `,` at the end of the new line? This way next time we add an option, there will be only a one-line `+` diff.

> commands.py:1035
> +        if revs:
> +            raise error.Abort("no branch name specified for the revisions")
>          ui.write("%s\n" % repo.dirstate.branch())

Maybe `_()`.

> test-branch-change.t:41
> +Try without passing a new branch name
> +-----------------------------------------
> +

Not sure why, but many titles' underlines are either too long or too short. Could you make these consistent?

> test-branch-change.t:67
> +
> +Change in between the stack (linear commits)
> +------------------------------------------------------

"in the middle of the stack"

> test-branch-change.t:255
> +
> +Changing branch on mutliple heads at once
> +-----------------------------------------

typo: mutliple

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1074

To: pulkit, #hg-reviewers, dlax
Cc: dlax, mercurial-devel


More information about the Mercurial-devel mailing list