def httpsendfile(ui, filename): try: # Mercurial >= 1.9 sendfile = httpconnection.httpsendfile(ui, filename, "rb") if getattr(sendfile, "__len__", None) is None: # Mercurial 1.9.3 removes httpsendfile's __len__. Hack it back in. setattr(sendfile.__class__, "__len__", lambda self: self.length) return sendfile except ImportError: if "ui" in inspect.getargspec(url_.httpsendfile.__init__)[0]: # Mercurial == 1.8 return url_.httpsendfile(ui, filename, "rb") else: # Mercurial <= 1.7 return url_.httpsendfile(filename, "rb")
def httpsendfile(ui, filename): return httpconnection.httpsendfile(ui, filename, 'rb')