Mercurial > hg
changeset 15181:0cc7f23c2208 stable
merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 30 Sep 2011 15:10:50 -0500 |
parents | f4bc0b9e03a4 (diff) 978358ce722d (current diff) |
children | de496752d936 351a9292e430 |
files | |
diffstat | 7 files changed, 25 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/setup3k.py Tue Sep 27 03:33:26 2011 +0900 +++ b/contrib/setup3k.py Fri Sep 30 15:10:50 2011 -0500 @@ -309,7 +309,7 @@ else: extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) -if sys.platform == 'linux2' and os.uname()[2] > '2.6': +if sys.platform.startswith('linux') and os.uname()[2] > '2.6': # The inotify extension is only usable with Linux 2.6 kernels. # You also need a reasonably recent C library. # In any case, if it fails to build the error will be skipped ('optional').
--- a/hgext/inotify/server.py Tue Sep 27 03:33:26 2011 +0900 +++ b/hgext/inotify/server.py Fri Sep 30 15:10:50 2011 -0500 @@ -443,7 +443,7 @@ if err.args[0] != errno.EPIPE: raise -if sys.platform == 'linux2': +if sys.platform.startswith('linux'): import linuxserver as _server else: raise ImportError
--- a/mercurial/httpconnection.py Tue Sep 27 03:33:26 2011 +0900 +++ b/mercurial/httpconnection.py Fri Sep 30 15:10:50 2011 -0500 @@ -22,8 +22,9 @@ class httpsendfile(object): """This is a wrapper around the objects returned by python's "open". - Its purpose is to send file-like objects via HTTP and, to do so, it - defines a __len__ attribute to feed the Content-Length header. + Its purpose is to send file-like objects via HTTP. + It do however not define a __len__ attribute because the length + might be more than Py_ssize_t can handle. """ def __init__(self, ui, *args, **kwargs): @@ -35,9 +36,9 @@ self.seek = self._data.seek self.close = self._data.close self.write = self._data.write - self._len = os.fstat(self._data.fileno()).st_size + self.length = os.fstat(self._data.fileno()).st_size self._pos = 0 - self._total = self._len / 1024 * 2 + self._total = self.length / 1024 * 2 def read(self, *args, **kwargs): try: @@ -54,9 +55,6 @@ unit=_('kb'), total=self._total) return ret - def __len__(self): - return self._len - # moved here from url.py to avoid a cycle def readauthforuri(ui, uri, user): # Read configuration
--- a/mercurial/httprepo.py Tue Sep 27 03:33:26 2011 +0900 +++ b/mercurial/httprepo.py Fri Sep 30 15:10:50 2011 -0500 @@ -74,9 +74,14 @@ if cmd == 'pushkey': args['data'] = '' data = args.pop('data', None) + size = 0 + if util.safehasattr(data, 'length'): + size = data.length + elif data is not None: + size = len(data) headers = args.pop('headers', {}) - if data and self.ui.configbool('ui', 'usehttp2', False): + if size and self.ui.configbool('ui', 'usehttp2', False): headers['Expect'] = '100-Continue' headers['X-HgHttp2'] = '1' @@ -105,9 +110,6 @@ cu = "%s%s" % (self._url, qs) req = urllib2.Request(cu, data, headers) if data is not None: - # len(data) is broken if data doesn't fit into Py_ssize_t - # add the header ourself to avoid OverflowError - size = data.__len__() self.ui.debug("sending %s bytes\n" % size) req.add_unredirected_header('Content-Length', '%d' % size) try:
--- a/mercurial/patch.py Tue Sep 27 03:33:26 2011 +0900 +++ b/mercurial/patch.py Fri Sep 30 15:10:50 2011 -0500 @@ -188,7 +188,7 @@ pend = subject.find(']') if pend >= 0: subject = subject[pend + 1:].lstrip() - subject = subject.replace('\n\t', ' ') + subject = re.sub(r'\n[ \t]+', ' ', subject) ui.debug('Subject: %s\n' % subject) if user: ui.debug('From: %s\n' % user)
--- a/mercurial/util.py Tue Sep 27 03:33:26 2011 +0900 +++ b/mercurial/util.py Fri Sep 30 15:10:50 2011 -0500 @@ -24,6 +24,10 @@ def sha1(s): return _fastsha1(s) +_notset = object() +def safehasattr(thing, attr): + return getattr(thing, attr, _notset) is not _notset + def _fastsha1(s): # This function will import sha1 from hashlib or sha (whichever is # available) and overwrite itself with it on the first call. @@ -887,7 +891,12 @@ minutes = abs(tz) // 60 format = format.replace("%1", "%c%02d" % (sign, minutes // 60)) format = format.replace("%2", "%02d" % (minutes % 60)) - s = time.strftime(format, time.gmtime(float(t) - tz)) + try: + t = time.gmtime(float(t) - tz) + except ValueError: + # time was out of range + t = time.gmtime(sys.maxint) + s = time.strftime(format, t) return s def shortdate(date=None):
--- a/setup.py Tue Sep 27 03:33:26 2011 +0900 +++ b/setup.py Fri Sep 30 15:10:50 2011 -0500 @@ -366,7 +366,7 @@ extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'], extra_link_args=osutil_ldflags)) -if sys.platform == 'linux2' and os.uname()[2] > '2.6': +if sys.platform.startswith('linux') and os.uname()[2] > '2.6': # The inotify extension is only usable with Linux 2.6 kernels. # You also need a reasonably recent C library. # In any case, if it fails to build the error will be skipped ('optional').