# HG changeset patch # User Matt Mackall # Date 1145655023 18000 # Node ID 1b183976e007616a3c4c5dc250614e8c11b83ad0 # Parent 30c7564f6dfc12ea2637a27e72743c22e0ab3126 Revert push new heads logic This breaks push -r's new head detection but fixes the common case. For now we'll assume that someone doing push -r knows what they're doing. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1039,14 +1039,10 @@ class localrepository(object): self.ui.status(_("no changes found\n")) return 1 elif not force: - if revs is not None: - updated_heads = {} - for base in msng_cl: - for parent in self.changelog.parents(base): - if parent in remote_heads: - updated_heads[parent] = True - updated_heads = updated_heads.keys() - if len(updated_heads) < len(heads): + # FIXME we don't properly detect creation of new heads + # in the push -r case, assume the user knows what he's doing + if not revs and len(remote_heads) < len(heads) \ + and remote_heads != [nullid]: self.ui.warn(_("abort: push creates new remote branches!\n")) self.ui.status(_("(did you forget to merge?" " use push -f to force)\n")) diff --git a/tests/test-push-warn.out b/tests/test-push-warn.out --- a/tests/test-push-warn.out +++ b/tests/test-push-warn.out @@ -30,9 +30,13 @@ searching for changes no changes found pushing to ../c searching for changes -abort: push creates new remote branches! -(did you forget to merge? use push -f to force) +adding changesets +adding manifests +adding file changes +added 2 changesets with 2 changes to 1 files (+2 heads) pushing to ../c searching for changes -abort: push creates new remote branches! -(did you forget to merge? use push -f to force) +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files