# HG changeset patch # User Thomas Arendsen Hein # Date 1162477845 -3600 # Node ID fd7a018b7db72252cefee4f3eaa8be2f60f47ff4 # Parent cbf352b9a3cdeaf3753fa7899dd1b73d1a140318 Try hgweb unbundle methods in the order presented by the server. If no common bundle format is found, push is aborted. diff -r cbf352b9a3cd -r fd7a018b7db7 mercurial/httprepo.py --- a/mercurial/httprepo.py Thu Nov 02 14:58:55 2006 +0100 +++ b/mercurial/httprepo.py Thu Nov 02 15:30:45 2006 +0100 @@ -350,14 +350,25 @@ except AttributeError: unbundleversions = [""] - if "HG10GZ" in unbundleversions: - header = "HG10GZ" - z = zlib.compressobj() - else: - self.ui.note(_("server has no compression support, " - "sending uncompressed")) - header = "" - z = nocompress() + while unbundleversions: + header = unbundleversions[0] + if header == "HG10GZ": + self.ui.note(_("using zlib compression\n")) + z = zlib.compressobj() + break + elif header == "HG10UN": + self.ui.note(_("using no compression\n")) + z = nocompress() + break + elif header == "": + self.ui.note(_("old server without compression support," + " sending uncompressed\n")) + z = nocompress() + break + unbundleversions.pop(0) + if not unbundleversions: + raise util.Abort(_("The server doesn't accept any bundle format" + " method we know.")) fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') fp = os.fdopen(fd, 'wb+')