D4312: New bookflow extension for bookmark-based branching

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Aug 22 06:49:30 EDT 2018


pulkit added inline comments.

INLINE COMMENTS

> bookflow.py:25
> +
> +MY_NAME = __name__[len('hgext_'):] if __name__.startswith('hgext_') else __name__
> +

can we get rid of this hack and just use 'bookflow'?

> bookflow.py:53
> +        return False
> +
> +

We also don't allow double new lines in core.

> bookflow.py:60
> +            if name in marks:
> +                raise error.Abort("Bookmark {} already exists, to move use the --rev option".format(name))
> +    return orig(repo, tr, names, rev, force, inactive)

_() missing here. Also, we don't start words with capital letters in error messages.

> bookflow.py:70
> +def commands_branch(orig, ui, repo, label=None, **opts):
> +    if label and not opts.get('clean') and not opts.get('rev'):
> +        raise error.Abort("Branching should be done using bookmarks:\nhg bookmark " + label)

please add r'' prefix to 'clean' and 'rev' for py3 compatibility.

> bookflow.py:71
> +    if label and not opts.get('clean') and not opts.get('rev'):
> +        raise error.Abort("Branching should be done using bookmarks:\nhg bookmark " + label)
> +    return orig(ui, repo, label, **opts)

_() missing here too.

> test-bookflow.t:2
> +initialize
> +  $ alias hgg="hg --config extensions.bookflow=`dirname $TESTDIR`/hgext/bookflow.py"
> +  $ make_changes() { d=`pwd`; [ ! -z $1 ] && cd $1; echo "test $(basename `pwd`)" >> test; hgg commit -Am"${2:-test}"; r=$?; cd $d; return $r; }

You can enable the extension by putting `[extensions] bookflow=` in .hgrc. Aliasing does not looks neat.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list