changeset 1973:9103902a5a8d

Cleaned up the code path for bundle handling in hg incoming, updated comments.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 18 Mar 2006 11:24:19 +0100
parents ce127cb4ee6e
children 0d54675cd566
files mercurial/commands.py
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Mar 18 10:45:21 2006 +0100
+++ b/mercurial/commands.py	Sat Mar 18 11:24:19 2006 +0100
@@ -1782,23 +1782,22 @@
         return
 
     cleanup = None
-    if not other.local() or opts["bundle"]:
-        # create an uncompressed bundle
-        if not opts["bundle"]:
-            # create a temporary bundle
-            fd, fname = tempfile.mkstemp(suffix=".hg",
-                                         prefix="tmp-hg-incoming")
-            f = os.fdopen(fd, "wb")
-            cleanup = fname
-        else:
-            fname = opts["bundle"]
-            f = open(fname, "wb")
-
+    fname = opts["bundle"]
+    if fname:
+        # create a bundle (uncompressed if other repo is not local)
+        f = open(fname, "wb")
+    elif not other.local():
+        # create an uncompressed temporary bundle
+        fd, fname = tempfile.mkstemp(suffix=".hg", prefix="hg-incoming-")
+        f = os.fdopen(fd, "wb")
+        cleanup = fname
+
+    if fname:
         cg = other.changegroup(incoming, "incoming")
         write_bundle(cg, fname, compress=other.local(), fh=f)
         # write_bundle closed f for us.
         if not other.local():
-            # use a bundlerepo
+            # use the created uncompressed bundlerepo
             other = bundlerepo.bundlerepository(ui, repo.root, fname)
 
     o = other.changelog.nodesbetween(incoming)[0]