# HG changeset patch # User Thomas Arendsen Hein # Date 1142677459 -3600 # Node ID 9103902a5a8d5ce77533705fd96da88c96b988d7 # Parent ce127cb4ee6edeea55dab9db6fd7529d935aaaa5 Cleaned up the code path for bundle handling in hg incoming, updated comments. diff -r ce127cb4ee6e -r 9103902a5a8d 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]