diff --git a/hgext/convert/common.py b/hgext/convert/common.py index 2ad5b8937d0d648d2cfeb0998ed12e2ce8c2e6d9_aGdleHQvY29udmVydC9jb21tb24ucHk=..2ad4e9b44d8b7e367e4a2363e0a8ea73b7b7dd45_aGdleHQvY29udmVydC9jb21tb24ucHk= 100644 --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -11,6 +11,8 @@ from mercurial import util from mercurial.i18n import _ +propertycache = util.propertycache + def encodeargs(args): def encodearg(s): lines = base64.encodestring(s) @@ -321,8 +323,6 @@ self.checkexit(status, ''.join(output)) return output - def getargmax(self): - if '_argmax' in self.__dict__: - return self._argmax - + @propertycache + def argmax(self): # POSIX requires at least 4096 bytes for ARG_MAX @@ -328,3 +328,3 @@ # POSIX requires at least 4096 bytes for ARG_MAX - self._argmax = 4096 + argmax = 4096 try: @@ -330,5 +330,5 @@ try: - self._argmax = os.sysconf("SC_ARG_MAX") + argmax = os.sysconf("SC_ARG_MAX") except: pass @@ -339,9 +339,7 @@ # Since ARG_MAX is for command line _and_ environment, lower our limit # (and make happy Windows shells while doing this). - - self._argmax = self._argmax / 2 - 1 - return self._argmax + return argmax / 2 - 1 def limit_arglist(self, arglist, cmd, closestdin, *args, **kwargs): cmdlen = len(self._cmdline(cmd, closestdin, *args, **kwargs)) @@ -345,7 +343,7 @@ def limit_arglist(self, arglist, cmd, closestdin, *args, **kwargs): cmdlen = len(self._cmdline(cmd, closestdin, *args, **kwargs)) - limit = self.getargmax() - cmdlen + limit = self.argmax - cmdlen bytes = 0 fl = [] for fn in arglist: