Merge with upstream
authorThomas Arendsen Hein <thomas@intevation.de>
Sat, 22 Apr 2006 09:19:27 +0200
changeset 2116 366e6328d10e
parent 2115 fd77b7ee4aac (current diff)
parent 2111 2f3e644decd7 (diff)
child 2118 e296dee1cd9a
child 2119 f62195054c5b
Merge with upstream
--- a/mercurial/localrepo.py	Fri Apr 21 16:09:43 2006 -0700
+++ b/mercurial/localrepo.py	Sat Apr 22 09:19:27 2006 +0200
@@ -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())
 
--- a/tests/test-bad-pull.out	Fri Apr 21 16:09:43 2006 -0700
+++ b/tests/test-bad-pull.out	Sat Apr 22 09:19:27 2006 +0200
@@ -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
--- a/tests/test-clone-failure.out	Fri Apr 21 16:09:43 2006 -0700
+++ b/tests/test-clone-failure.out	Sat Apr 22 09:19:27 2006 +0200
@@ -1,6 +1,5 @@
 abort: repository a not found!
 255
-requesting all changes
 abort: error: Connection refused
 255
 abort: repository a not found!
--- a/tests/test-push-warn.out	Fri Apr 21 16:09:43 2006 -0700
+++ b/tests/test-push-warn.out	Sat Apr 22 09:19:27 2006 +0200
@@ -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