[PATCH 2 of 2] discovery: list new remote heads in prepush() on --debug
Patrick Mézard
pmezard at gmail.com
Thu Nov 11 11:54:26 CST 2010
Le 11/11/10 17:55, Adrian Buehlmann a écrit :
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1289487080 -3600
> # Node ID 1172eb4fa053db239e8c6f4b978ccb327a11f8d3
> # Parent 6101a7c2efd2c03762d65eb8219fcca83be36195
> discovery: list new remote heads in prepush() on --debug
[...]
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -278,20 +278,31 @@ def prepush(repo, remote, force, revs, n
>
> # 5. Check for new heads.
> # If there are more heads after the push than before, a suitable
> - # warning, depending on unsynced status, is displayed.
> + # error message, depending on unsynced status, is displayed.
> + error = None
> for branch in branches:
> - if len(newmap[branch]) > len(oldmap[branch]):
> + newhs = newmap[branch]
> + oldhs = oldmap[branch]
> + if len(newhs) > len(oldhs):
> + if error is None:
> + if branch:
> + error = _("push creates new remote heads "
> + "on branch '%s'!") % branch
> + else:
> + error = _("push creates new remote heads!")
> + if branch in unsynced:
> + hint = _("you should pull and merge or "
> + "use push -f to force")
> + else:
> + hint = _("did you forget to merge? "
> + "use push -f to force")
> if branch:
> - msg = _("push creates new remote heads "
> - "on branch '%s'!") % branch
> - else:
> - msg = _("push creates new remote heads!")
> -
> - if branch in unsynced:
> - hint = _("you should pull and merge or use push -f to force")
> - else:
> - hint = _("did you forget to merge? use push -f to force")
> - raise util.Abort(msg, hint=hint)
> + repo.ui.debug("new remote heads on branch '%s'\n" % branch)
> + for h in newhs:
> + if h not in oldhs:
You can do:
for h in (newhs - oldhs):
> + repo.ui.debug("new remote head %s\n" % short(h))
> + if error:
> + raise util.Abort(error, hint=hint)
>
> # 6. Check for unsynced changes on involved branches.
> if unsynced:
+1 for both patches (tests passed on top of 609edbc7853f)
--
Patrick Mézard
More information about the Mercurial-devel
mailing list