# HG changeset patch # User Vadim Gelfer # Date 1145979495 25200 # Node ID e296dee1cd9abc6a23a61a68f5b773be88c01c8a # Parent 760339ccc7999d231848c5a23c4e46284466f341# Parent 366e6328d10eabd5689ea19ef08c8b3a90b236e0 merge with crew. diff -r 760339ccc799 -r e296dee1cd9a mercurial/localrepo.py --- a/mercurial/localrepo.py Tue Apr 25 08:37:05 2006 -0700 +++ b/mercurial/localrepo.py Tue Apr 25 08:38:15 2006 -0700 @@ -831,13 +831,18 @@ if base == None: base = {} + if not heads: + heads = remote.heads() + + if self.changelog.tip() == nullid: + if heads != [nullid]: + return [nullid] + return [] + # assume we're closer to the tip than the root # and start by examining the heads self.ui.status(_("searching for changes\n")) - if not heads: - heads = remote.heads() - unknown = [] for h in heads: if h not in m: @@ -998,12 +1003,9 @@ def pull(self, remote, heads=None, force=False): l = self.lock() - # if we have an empty repo, fetch everything - if self.changelog.tip() == nullid: + fetch = self.findincoming(remote, force=force) + if fetch == [nullid]: self.ui.status(_("requesting all changes\n")) - fetch = [nullid] - else: - fetch = self.findincoming(remote, force=force) if not fetch: self.ui.status(_("no changes found\n")) @@ -1037,14 +1039,10 @@ 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")) @@ -1386,7 +1384,9 @@ yield chnk yield changegroup.closechunk() - self.hook('outgoing', node=hex(nodes[0]), source=source) + + if nodes: + self.hook('outgoing', node=hex(nodes[0]), source=source) return util.chunkbuffer(gengroup()) diff -r 760339ccc799 -r e296dee1cd9a tests/test-bad-pull.out --- a/tests/test-bad-pull.out Tue Apr 25 08:37:05 2006 -0700 +++ b/tests/test-bad-pull.out Tue Apr 25 08:38:15 2006 -0700 @@ -1,7 +1,5 @@ -requesting all changes abort: error: Connection refused 255 copy: No such file or directory -requesting all changes abort: HTTP Error 404: File not found 255 diff -r 760339ccc799 -r e296dee1cd9a tests/test-clone-failure.out --- a/tests/test-clone-failure.out Tue Apr 25 08:37:05 2006 -0700 +++ b/tests/test-clone-failure.out Tue Apr 25 08:38:15 2006 -0700 @@ -1,6 +1,5 @@ abort: repository a not found! 255 -requesting all changes abort: error: Connection refused 255 abort: repository a not found! diff -r 760339ccc799 -r e296dee1cd9a tests/test-push-warn.out --- a/tests/test-push-warn.out Tue Apr 25 08:37:05 2006 -0700 +++ b/tests/test-push-warn.out Tue Apr 25 08:38:15 2006 -0700 @@ -30,9 +30,13 @@ 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