D6038: push: added clear warning message when pushing closed branches(issue6080)
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Mar 16 19:10:27 EDT 2019
pulkit added a comment.
Nice work, I have left some inline comments. Can you also add a test where we pushing multiple branches and not every branch is a closed branch?
INLINE COMMENTS
> discovery.py:348
> + # Makes a list of closed branches
> + closedbranches = []
> + for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
How about having this as a set so that we don't need to convert it later.
> discovery.py:350
> + for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
> + if isclosed == True:
> + closedbranches.append((tag))
`if isclosed` will work.
> discovery.py:352
> + closedbranches.append((tag))
> + closedbranches = list(set(closedbranches) & set(newbranches))
> # 1. Check for new branches on the remote.
No need to convert `closedbranches` back to list.
> discovery.py:356
> branchnames = ', '.join(sorted(newbranches))
> - raise error.Abort(_("push creates new remote branches: %s!")
> - % branchnames,
> - hint=_("use 'hg push --new-branch' to create"
> - " new remote branches"))
> + if len(closedbranches) > 0:
> + errmsg = (_("push creates new remote branches: %s (%d closed)!")
`if closedbranches` will work here.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6038
To: taapas1128, #hg-reviewers
Cc: pulkit, mharbison72, mercurial-devel
More information about the Mercurial-devel
mailing list