Mercurial > hg-stable
changeset 14525:826a13720fbc
prepush: print short hash of first new head in abort message
and don't mention the branch if it's the default branch.
OLD:
$ hg push ../a
pushing to ../a
searching for changes
abort: push creates new remote heads on branch 'default'!
(you should pull and merge or use push -f to force)
NEW:
$ hg push ../a
pushing to ../a
searching for changes
abort: push creates new remote head 1e108cc5548c!
(you should pull and merge or use push -f to force)
This helps to identify which local head is causing troubles.
See also change 91cb08a9e7fb.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 03 Jun 2011 12:16:17 +0200 |
parents | 97d2259af787 |
children | 4276e3202585 |
files | mercurial/discovery.py tests/test-push-warn.t tests/test-subrepo.t |
diffstat | 3 files changed, 21 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/discovery.py Fri Jun 03 11:26:43 2011 +0200 +++ b/mercurial/discovery.py Fri Jun 03 12:16:17 2011 +0200 @@ -159,9 +159,14 @@ newhs = set(newmap[branch]) oldhs = set(oldmap[branch]) if len(newhs) > len(oldhs): + dhs = list(newhs - oldhs) if error is None: - error = _("push creates new remote heads " - "on branch '%s'!") % branch + if branch != 'default': + error = _("push creates new remote head %s " + "on branch '%s'!") % (short(dhs[0]), branch) + else: + error = _("push creates new remote head %s!" + ) % short(dhs[0]) if branch in unsynced: hint = _("you should pull and merge or " "use push -f to force") @@ -169,7 +174,7 @@ hint = _("did you forget to merge? " "use push -f to force") repo.ui.debug("new remote heads on branch '%s'\n" % branch) - for h in (newhs - oldhs): + for h in dhs: repo.ui.debug("new remote head %s\n" % short(h)) if error: raise util.Abort(error, hint=hint)
--- a/tests/test-push-warn.t Fri Jun 03 11:26:43 2011 +0200 +++ b/tests/test-push-warn.t Fri Jun 03 12:16:17 2011 +0200 @@ -25,7 +25,7 @@ $ hg push ../a pushing to ../a searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 1e108cc5548c! (you should pull and merge or use push -f to force) [255] @@ -39,7 +39,7 @@ 2 total queries new remote heads on branch 'default' new remote head 1e108cc5548c - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 1e108cc5548c! (you should pull and merge or use push -f to force) [255] @@ -55,7 +55,7 @@ $ hg push ../a pushing to ../a searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 1e108cc5548c! (did you forget to merge? use push -f to force) [255] @@ -108,7 +108,7 @@ $ hg push ../c pushing to ../c searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 6346d66eb9f5! (did you forget to merge? use push -f to force) [255] @@ -120,14 +120,14 @@ $ hg push -r 3 ../c pushing to ../c searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head a5dda829a167! (did you forget to merge? use push -f to force) [255] $ hg push -r 3 -r 4 ../c pushing to ../c searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head a5dda829a167! (did you forget to merge? use push -f to force) [255] @@ -256,7 +256,7 @@ $ hg push -r 4 -r 7 ../f pushing to ../f searching for changes - abort: push creates new remote heads on branch 'a'! + abort: push creates new remote head 0b715ef6ff8f on branch 'a'! (did you forget to merge? use push -f to force) [255] @@ -379,7 +379,7 @@ $ hg -R i push h pushing to h searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 97bd0c84d346! (you should pull and merge or use push -f to force) [255] @@ -449,7 +449,7 @@ $ hg push ../l -b b pushing to ../l searching for changes - abort: push creates new remote heads on branch 'a'! + abort: push creates new remote head e7e31d71180f on branch 'a'! (did you forget to merge? use push -f to force) [255] @@ -696,14 +696,14 @@ $ hg push inner pushing to inner searching for changes - abort: push creates new remote heads on branch 'A'! + abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! (did you forget to merge? use push -f to force) [255] $ hg push inner -r4 -r5 pushing to inner searching for changes - abort: push creates new remote heads on branch 'A'! + abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! (did you forget to merge? use push -f to force) [255]
--- a/tests/test-subrepo.t Fri Jun 03 11:26:43 2011 +0200 +++ b/tests/test-subrepo.t Fri Jun 03 12:16:17 2011 +0200 @@ -289,7 +289,7 @@ no changes found pushing subrepo s to $TESTTMP/sub/t/s searching for changes - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 12a213df6fa9! (did you forget to merge? use push -f to force) [255] $ hg push -f @@ -562,7 +562,7 @@ $ hg -R repo2 ci -m3 committing subrepository s $ hg -q -R repo2 push - abort: push creates new remote heads on branch 'default'! + abort: push creates new remote head 9d66565e64e1! (did you forget to merge? use push -f to force) [255] $ hg -R repo update