changeset 2118:e296dee1cd9a

merge with crew.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 25 Apr 2006 08:38:15 -0700
parents 760339ccc799 (current diff) 366e6328d10e (diff)
children 150208e0d94b
files
diffstat 4 files changed, 25 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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())
 
--- 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
--- 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!
--- 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