Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 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 |
comparison
equal
deleted
inserted
replaced
1972:ce127cb4ee6e | 1973:9103902a5a8d |
---|---|
1780 incoming = repo.findincoming(other, force=opts["force"]) | 1780 incoming = repo.findincoming(other, force=opts["force"]) |
1781 if not incoming: | 1781 if not incoming: |
1782 return | 1782 return |
1783 | 1783 |
1784 cleanup = None | 1784 cleanup = None |
1785 if not other.local() or opts["bundle"]: | 1785 fname = opts["bundle"] |
1786 # create an uncompressed bundle | 1786 if fname: |
1787 if not opts["bundle"]: | 1787 # create a bundle (uncompressed if other repo is not local) |
1788 # create a temporary bundle | 1788 f = open(fname, "wb") |
1789 fd, fname = tempfile.mkstemp(suffix=".hg", | 1789 elif not other.local(): |
1790 prefix="tmp-hg-incoming") | 1790 # create an uncompressed temporary bundle |
1791 f = os.fdopen(fd, "wb") | 1791 fd, fname = tempfile.mkstemp(suffix=".hg", prefix="hg-incoming-") |
1792 cleanup = fname | 1792 f = os.fdopen(fd, "wb") |
1793 else: | 1793 cleanup = fname |
1794 fname = opts["bundle"] | 1794 |
1795 f = open(fname, "wb") | 1795 if fname: |
1796 | |
1797 cg = other.changegroup(incoming, "incoming") | 1796 cg = other.changegroup(incoming, "incoming") |
1798 write_bundle(cg, fname, compress=other.local(), fh=f) | 1797 write_bundle(cg, fname, compress=other.local(), fh=f) |
1799 # write_bundle closed f for us. | 1798 # write_bundle closed f for us. |
1800 if not other.local(): | 1799 if not other.local(): |
1801 # use a bundlerepo | 1800 # use the created uncompressed bundlerepo |
1802 other = bundlerepo.bundlerepository(ui, repo.root, fname) | 1801 other = bundlerepo.bundlerepository(ui, repo.root, fname) |
1803 | 1802 |
1804 o = other.changelog.nodesbetween(incoming)[0] | 1803 o = other.changelog.nodesbetween(incoming)[0] |
1805 if opts['newest_first']: | 1804 if opts['newest_first']: |
1806 o.reverse() | 1805 o.reverse() |