Cleaned up the code path for bundle handling in hg incoming, updated comments.
authorThomas Arendsen Hein <thomas@intevation.de>
Sat, 18 Mar 2006 11:24:19 +0100
changeset 1973 9103902a5a8d
parent 1972 ce127cb4ee6e
child 1974 0d54675cd566
Cleaned up the code path for bundle handling in hg incoming, updated comments.
mercurial/commands.py
--- 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]