Show More
@@ -281,10 +281,10 b' for i in [0, 1]:' | |||
|
281 | 281 | for tp in testpats[i]: |
|
282 | 282 | p = tp[0] |
|
283 | 283 | m = tp[1] |
|
284 |
if p.startswith( |
|
|
285 |
p = |
|
|
284 | if p.startswith('^'): | |
|
285 | p = "^ [$>] (%s)" % p[1:] | |
|
286 | 286 | else: |
|
287 |
p = |
|
|
287 | p = "^ [$>] .*(%s)" % p | |
|
288 | 288 | utestpats[i].append((p, m) + tp[2:]) |
|
289 | 289 | |
|
290 | 290 | # don't transform the following rules: |
@@ -1658,7 +1658,7 b' def perfstartup(ui, repo, **opts):' | |||
|
1658 | 1658 | ) |
|
1659 | 1659 | else: |
|
1660 | 1660 | os.environ[r'HGRCPATH'] = r' ' |
|
1661 |
os.system( |
|
|
1661 | os.system("%s version -q > NUL" % sys.argv[0]) | |
|
1662 | 1662 | |
|
1663 | 1663 | timer(d) |
|
1664 | 1664 | fm.end() |
@@ -22,7 +22,7 b' except ImportError:' | |||
|
22 | 22 | # available. Relax C module requirements. |
|
23 | 23 | os.environ[r'HGMODULEPOLICY'] = r'allow' |
|
24 | 24 | # import from the live mercurial repo |
|
25 |
sys.path.insert(0, |
|
|
25 | sys.path.insert(0, "..") | |
|
26 | 26 | from mercurial import demandimport |
|
27 | 27 | |
|
28 | 28 | demandimport.enable() |
@@ -70,9 +70,9 b' class _demandmod(object):' | |||
|
70 | 70 | head = name |
|
71 | 71 | after = [] |
|
72 | 72 | object.__setattr__( |
|
73 |
self, |
|
|
73 | self, "_data", (head, globals, locals, after, level, set()) | |
|
74 | 74 | ) |
|
75 |
object.__setattr__(self, |
|
|
75 | object.__setattr__(self, "_module", None) | |
|
76 | 76 | |
|
77 | 77 | def _extend(self, name): |
|
78 | 78 | """add to the list of submodules to load""" |
@@ -143,7 +143,7 b' class _demandmod(object):' | |||
|
143 | 143 | if modref and getattr(modref, head, None) is self: |
|
144 | 144 | setattr(modref, head, mod) |
|
145 | 145 | |
|
146 |
object.__setattr__(self, |
|
|
146 | object.__setattr__(self, "_module", mod) | |
|
147 | 147 | |
|
148 | 148 | def __repr__(self): |
|
149 | 149 | if self._module: |
@@ -493,7 +493,7 b' class commandline(object):' | |||
|
493 | 493 | # POSIX requires at least 4096 bytes for ARG_MAX |
|
494 | 494 | argmax = 4096 |
|
495 | 495 | try: |
|
496 |
argmax = os.sysconf( |
|
|
496 | argmax = os.sysconf("SC_ARG_MAX") | |
|
497 | 497 | except (AttributeError, ValueError): |
|
498 | 498 | pass |
|
499 | 499 |
@@ -54,10 +54,8 b' class logentry(object):' | |||
|
54 | 54 | self.__dict__.update(entries) |
|
55 | 55 | |
|
56 | 56 | def __repr__(self): |
|
57 | items = ( | |
|
58 | r"%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__) | |
|
59 | ) | |
|
60 | return r"%s(%s)" % (type(self).__name__, r", ".join(items)) | |
|
57 | items = ("%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__)) | |
|
58 | return "%s(%s)" % (type(self).__name__, ", ".join(items)) | |
|
61 | 59 | |
|
62 | 60 | |
|
63 | 61 | class logerror(Exception): |
@@ -90,7 +90,7 b' def parseoptions(ui, cmdoptions, args):' | |||
|
90 | 90 | args = fancyopts.fancyopts(list(args), cmdoptions, opts, True) |
|
91 | 91 | break |
|
92 | 92 | except getopt.GetoptError as ex: |
|
93 |
if |
|
|
93 | if "requires argument" in ex.msg: | |
|
94 | 94 | raise |
|
95 | 95 | if (r'--' + ex.opt) in ex.msg: |
|
96 | 96 | flag = b'--' + pycompat.bytestr(ex.opt) |
@@ -249,7 +249,7 b' def _batchresponseobjects(req, objects, ' | |||
|
249 | 249 | if not exists: |
|
250 | 250 | rsp[r'error'] = { |
|
251 | 251 | r'code': 404, |
|
252 |
r'message': |
|
|
252 | r'message': "The object does not exist", | |
|
253 | 253 | } |
|
254 | 254 | yield rsp |
|
255 | 255 | continue |
@@ -257,7 +257,7 b' def _batchresponseobjects(req, objects, ' | |||
|
257 | 257 | elif not verifies: |
|
258 | 258 | rsp[r'error'] = { |
|
259 | 259 | r'code': 422, # XXX: is this the right code? |
|
260 |
r'message': |
|
|
260 | r'message': "The object is corrupt", | |
|
261 | 261 | } |
|
262 | 262 | yield rsp |
|
263 | 263 | continue |
@@ -287,7 +287,7 b' def _batchresponseobjects(req, objects, ' | |||
|
287 | 287 | b'%s%s/.hg/lfs/objects/%s' % (req.baseurl, req.apppath, oid) |
|
288 | 288 | ), |
|
289 | 289 | # datetime.isoformat() doesn't include the 'Z' suffix |
|
290 |
|
|
|
290 | "expires_at": expiresat.strftime(r'%Y-%m-%dT%H:%M:%SZ'), | |
|
291 | 291 | r'header': _buildheader(), |
|
292 | 292 | } |
|
293 | 293 | } |
@@ -33,8 +33,8 b' def reposetup(repo):' | |||
|
33 | 33 | # TODO: don't blindly add include/exclude wireproto |
|
34 | 34 | # arguments to unbundle. |
|
35 | 35 | include, exclude = repo.narrowpats |
|
36 |
kwargs[ |
|
|
37 |
kwargs[ |
|
|
36 | kwargs["includepats"] = b','.join(include) | |
|
37 | kwargs["excludepats"] = b','.join(exclude) | |
|
38 | 38 | return orig(cmd, *args, **kwargs) |
|
39 | 39 | |
|
40 | 40 | extensions.wrapfunction(peer, b'_calltwowaystream', wrapped) |
@@ -72,7 +72,7 b' def record(ui, repo, *pats, **opts):' | |||
|
72 | 72 | _(b'running non-interactively, use %s instead') % b'commit' |
|
73 | 73 | ) |
|
74 | 74 | |
|
75 |
opts[ |
|
|
75 | opts["interactive"] = True | |
|
76 | 76 | overrides = {(b'experimental', b'crecord'): False} |
|
77 | 77 | with ui.configoverride(overrides, b'record'): |
|
78 | 78 | return commands.commit(ui, repo, *pats, **opts) |
@@ -260,9 +260,9 b' def parsesizeflags(raw):' | |||
|
260 | 260 | # v0, str(int(size)) is the header |
|
261 | 261 | size = int(header) |
|
262 | 262 | except ValueError: |
|
263 |
raise RuntimeError( |
|
|
263 | raise RuntimeError("unexpected remotefilelog header: illegal format") | |
|
264 | 264 | if size is None: |
|
265 |
raise RuntimeError( |
|
|
265 | raise RuntimeError("unexpected remotefilelog header: no size found") | |
|
266 | 266 | return index + 1, size, flags |
|
267 | 267 | |
|
268 | 268 |
@@ -95,7 +95,7 b' def publish(name, desc, path, port):' | |||
|
95 | 95 | |
|
96 | 96 | hostname = socket.gethostname().split(r'.')[0] |
|
97 | 97 | host = hostname + r".local" |
|
98 |
name = |
|
|
98 | name = "%s-%s" % (hostname, name) | |
|
99 | 99 | |
|
100 | 100 | # advertise to browsers |
|
101 | 101 | svc = Zeroconf.ServiceInfo( |
@@ -180,10 +180,10 b' def getzcpaths():' | |||
|
180 | 180 | server.close() |
|
181 | 181 | for value in l.found.values(): |
|
182 | 182 | name = value.name[: value.name.index(b'.')] |
|
183 |
url = |
|
|
183 | url = "http://%s:%s%s" % ( | |
|
184 | 184 | socket.inet_ntoa(value.address), |
|
185 | 185 | value.port, |
|
186 |
value.properties.get( |
|
|
186 | value.properties.get("path", "/"), | |
|
187 | 187 | ) |
|
188 | 188 | yield b"zc-" + name, pycompat.bytestr(url) |
|
189 | 189 |
@@ -85,7 +85,7 b' def writechunks(ui, chunks, filename, vf' | |||
|
85 | 85 | fh = open(filename, b"wb", 131072) |
|
86 | 86 | else: |
|
87 | 87 | fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg") |
|
88 |
fh = os.fdopen(fd, |
|
|
88 | fh = os.fdopen(fd, "wb") | |
|
89 | 89 | cleanup = filename |
|
90 | 90 | for c in chunks: |
|
91 | 91 | fh.write(c) |
@@ -71,7 +71,7 b' class basectx(object):' | |||
|
71 | 71 | __str__ = encoding.strmethod(__bytes__) |
|
72 | 72 | |
|
73 | 73 | def __repr__(self): |
|
74 |
return |
|
|
74 | return "<%s %s>" % (type(self).__name__, str(self)) | |
|
75 | 75 | |
|
76 | 76 | def __eq__(self, other): |
|
77 | 77 | try: |
@@ -789,7 +789,7 b' class basefilectx(object):' | |||
|
789 | 789 | __str__ = encoding.strmethod(__bytes__) |
|
790 | 790 | |
|
791 | 791 | def __repr__(self): |
|
792 |
return |
|
|
792 | return "<%s %s>" % (type(self).__name__, str(self)) | |
|
793 | 793 | |
|
794 | 794 | def __hash__(self): |
|
795 | 795 | try: |
@@ -651,7 +651,7 b' def debugdata(ui, repo, file_, rev=None,' | |||
|
651 | 651 | ) |
|
652 | 652 | def debugdate(ui, date, range=None, **opts): |
|
653 | 653 | """parse and display a date""" |
|
654 |
if opts[ |
|
|
654 | if opts["extended"]: | |
|
655 | 655 | d = dateutil.parsedate(date, util.extendeddateformats) |
|
656 | 656 | else: |
|
657 | 657 | d = dateutil.parsedate(date) |
@@ -877,7 +877,7 b' def debugstate(ui, repo, **opts):' | |||
|
877 | 877 | timestr = b'set ' |
|
878 | 878 | else: |
|
879 | 879 | timestr = time.strftime( |
|
880 |
|
|
|
880 | "%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]) | |
|
881 | 881 | ) |
|
882 | 882 | timestr = encoding.strtolocal(timestr) |
|
883 | 883 | if ent[1] & 0o20000: |
@@ -368,7 +368,7 b' class dirstate(object):' | |||
|
368 | 368 | rereads the dirstate. Use localrepo.invalidatedirstate() if you want to |
|
369 | 369 | check whether the dirstate has changed before rereading it.''' |
|
370 | 370 | |
|
371 |
for a in ( |
|
|
371 | for a in ("_map", "_branch", "_ignore"): | |
|
372 | 372 | if a in self.__dict__: |
|
373 | 373 | delattr(self, a) |
|
374 | 374 | self._lastnormaltime = 0 |
@@ -1399,9 +1399,9 b' class dirstatemap(object):' | |||
|
1399 | 1399 | |
|
1400 | 1400 | def addfile(self, f, oldstate, state, mode, size, mtime): |
|
1401 | 1401 | """Add a tracked file to the dirstate.""" |
|
1402 |
if oldstate in b"?r" and |
|
|
1402 | if oldstate in b"?r" and "_dirs" in self.__dict__: | |
|
1403 | 1403 | self._dirs.addpath(f) |
|
1404 |
if oldstate == b"?" and |
|
|
1404 | if oldstate == b"?" and "_alldirs" in self.__dict__: | |
|
1405 | 1405 | self._alldirs.addpath(f) |
|
1406 | 1406 | self._map[f] = dirstatetuple(state, mode, size, mtime) |
|
1407 | 1407 | if state != b'n' or mtime == -1: |
@@ -1417,11 +1417,11 b' class dirstatemap(object):' | |||
|
1417 | 1417 | the file's previous state. In the future, we should refactor this |
|
1418 | 1418 | to be more explicit about what that state is. |
|
1419 | 1419 | """ |
|
1420 |
if oldstate not in b"?r" and |
|
|
1420 | if oldstate not in b"?r" and "_dirs" in self.__dict__: | |
|
1421 | 1421 | self._dirs.delpath(f) |
|
1422 |
if oldstate == b"?" and |
|
|
1422 | if oldstate == b"?" and "_alldirs" in self.__dict__: | |
|
1423 | 1423 | self._alldirs.addpath(f) |
|
1424 |
if |
|
|
1424 | if "filefoldmap" in self.__dict__: | |
|
1425 | 1425 | normed = util.normcase(f) |
|
1426 | 1426 | self.filefoldmap.pop(normed, None) |
|
1427 | 1427 | self._map[f] = dirstatetuple(b'r', 0, size, 0) |
@@ -1434,11 +1434,11 b' class dirstatemap(object):' | |||
|
1434 | 1434 | """ |
|
1435 | 1435 | exists = self._map.pop(f, None) is not None |
|
1436 | 1436 | if exists: |
|
1437 |
if oldstate != b"r" and |
|
|
1437 | if oldstate != b"r" and "_dirs" in self.__dict__: | |
|
1438 | 1438 | self._dirs.delpath(f) |
|
1439 |
if |
|
|
1439 | if "_alldirs" in self.__dict__: | |
|
1440 | 1440 | self._alldirs.delpath(f) |
|
1441 |
if |
|
|
1441 | if "filefoldmap" in self.__dict__: | |
|
1442 | 1442 | normed = util.normcase(f) |
|
1443 | 1443 | self.filefoldmap.pop(normed, None) |
|
1444 | 1444 | self.nonnormalset.discard(f) |
@@ -182,7 +182,7 b' def tolocal(s):' | |||
|
182 | 182 | if encoding == b'UTF-8': |
|
183 | 183 | # fast path |
|
184 | 184 | return s |
|
185 |
r = u.encode(_sysstr(encoding), |
|
|
185 | r = u.encode(_sysstr(encoding), "replace") | |
|
186 | 186 | if u == r.decode(_sysstr(encoding)): |
|
187 | 187 | # r is a safe, non-lossy encoding of s |
|
188 | 188 | return safelocalstr(r) |
@@ -191,7 +191,7 b' def tolocal(s):' | |||
|
191 | 191 | # we should only get here if we're looking at an ancient changeset |
|
192 | 192 | try: |
|
193 | 193 | u = s.decode(_sysstr(fallbackencoding)) |
|
194 |
r = u.encode(_sysstr(encoding), |
|
|
194 | r = u.encode(_sysstr(encoding), "replace") | |
|
195 | 195 | if u == r.decode(_sysstr(encoding)): |
|
196 | 196 | # r is a safe, non-lossy encoding of s |
|
197 | 197 | return safelocalstr(r) |
@@ -199,7 +199,7 b' def tolocal(s):' | |||
|
199 | 199 | except UnicodeDecodeError: |
|
200 | 200 | u = s.decode("utf-8", "replace") # last ditch |
|
201 | 201 | # can't round-trip |
|
202 |
return u.encode(_sysstr(encoding), |
|
|
202 | return u.encode(_sysstr(encoding), "replace") | |
|
203 | 203 | except LookupError as k: |
|
204 | 204 | raise error.Abort(k, hint=b"please check your locale settings") |
|
205 | 205 |
@@ -591,9 +591,7 b' def wrapfilecache(cls, propname, wrapper' | |||
|
591 | 591 | break |
|
592 | 592 | |
|
593 | 593 | if currcls is object: |
|
594 | raise AttributeError( | |
|
595 | r"type '%s' has no property '%s'" % (cls, propname) | |
|
596 | ) | |
|
594 | raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) | |
|
597 | 595 | |
|
598 | 596 | |
|
599 | 597 | class wrappedfunction(object): |
@@ -934,10 +934,10 b' def _maketempfiles(repo, fco, fca, local' | |||
|
934 | 934 | name = os.path.join(tmproot, pre) |
|
935 | 935 | if ext: |
|
936 | 936 | name += ext |
|
937 |
f = open(name, |
|
|
937 | f = open(name, "wb") | |
|
938 | 938 | else: |
|
939 | 939 | fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext) |
|
940 |
f = os.fdopen(fd, |
|
|
940 | f = os.fdopen(fd, "wb") | |
|
941 | 941 | return f, name |
|
942 | 942 | |
|
943 | 943 | def tempfromcontext(prefix, ctx): |
@@ -62,7 +62,7 b' class _error_logger(object):' | |||
|
62 | 62 | |
|
63 | 63 | def writelines(self, seq): |
|
64 | 64 | for msg in seq: |
|
65 |
self.handler.log_error( |
|
|
65 | self.handler.log_error("HG error: %s", encoding.strfromlocal(msg)) | |
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | class _httprequesthandler(httpservermod.basehttprequesthandler): |
@@ -128,20 +128,20 b' class _httprequesthandler(httpservermod.' | |||
|
128 | 128 | isinstance(e, (OSError, socket.error)) |
|
129 | 129 | and e.errno == errno.ECONNRESET |
|
130 | 130 | ): |
|
131 |
tb = |
|
|
131 | tb = "".join(traceback.format_exception(*sys.exc_info())) | |
|
132 | 132 | # We need a native-string newline to poke in the log |
|
133 | 133 | # message, because we won't get a newline when using an |
|
134 | 134 | # r-string. This is the easy way out. |
|
135 | 135 | newline = chr(10) |
|
136 | 136 | self.log_error( |
|
137 | 137 | r"Exception happened during processing " |
|
138 |
|
|
|
138 | "request '%s':%s%s", | |
|
139 | 139 | self.path, |
|
140 | 140 | newline, |
|
141 | 141 | tb, |
|
142 | 142 | ) |
|
143 | 143 | |
|
144 |
self._start_response( |
|
|
144 | self._start_response("500 Internal Server Error", []) | |
|
145 | 145 | self._write(b"Internal Server Error") |
|
146 | 146 | self._done() |
|
147 | 147 | |
@@ -335,8 +335,8 b' class _httprequesthandlerssl(_httpreques' | |||
|
335 | 335 | |
|
336 | 336 | def setup(self): |
|
337 | 337 | self.connection = self.request |
|
338 |
self.rfile = self.request.makefile( |
|
|
339 |
self.wfile = self.request.makefile( |
|
|
338 | self.rfile = self.request.makefile("rb", self.rbufsize) | |
|
339 | self.wfile = self.request.makefile("wb", self.wbufsize) | |
|
340 | 340 | |
|
341 | 341 | |
|
342 | 342 | try: |
@@ -129,7 +129,7 b' class Headers(object):' | |||
|
129 | 129 | return self._headers[:] |
|
130 | 130 | |
|
131 | 131 | def __repr__(self): |
|
132 |
return |
|
|
132 | return "%s(%r)" % (self.__class__.__name__, self._headers) | |
|
133 | 133 | |
|
134 | 134 | def __str__(self): |
|
135 | 135 | """str() returns the formatted headers, complete with end line, |
@@ -38,7 +38,7 b' def pythonhook(ui, repo, htype, hname, f' | |||
|
38 | 38 | |
|
39 | 39 | if callable(funcname): |
|
40 | 40 | obj = funcname |
|
41 |
funcname = pycompat.sysbytes(obj.__module__ + |
|
|
41 | funcname = pycompat.sysbytes(obj.__module__ + "." + obj.__name__) | |
|
42 | 42 | else: |
|
43 | 43 | d = funcname.rfind(b'.') |
|
44 | 44 | if d == -1: |
@@ -61,7 +61,7 b' def pythonhook(ui, repo, htype, hname, f' | |||
|
61 | 61 | e1 = sys.exc_info() |
|
62 | 62 | try: |
|
63 | 63 | # extensions are loaded with hgext_ prefix |
|
64 |
obj = __import__( |
|
|
64 | obj = __import__("hgext_%s" % pycompat.sysstr(modname)) | |
|
65 | 65 | except (ImportError, SyntaxError): |
|
66 | 66 | e2 = sys.exc_info() |
|
67 | 67 | if ui.tracebackflag: |
@@ -543,7 +543,7 b' class httppeer(wireprotov1peer.wirepeer)' | |||
|
543 | 543 | try: |
|
544 | 544 | # dump bundle to disk |
|
545 | 545 | fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg") |
|
546 |
with os.fdopen(fd, |
|
|
546 | with os.fdopen(fd, "wb") as fh: | |
|
547 | 547 | d = fp.read(4096) |
|
548 | 548 | while d: |
|
549 | 549 | fh.write(d) |
@@ -238,7 +238,7 b' class lock(object):' | |||
|
238 | 238 | def __del__(self): |
|
239 | 239 | if self.held: |
|
240 | 240 | warnings.warn( |
|
241 |
|
|
|
241 | "use lock.release instead of del lock", | |
|
242 | 242 | category=DeprecationWarning, |
|
243 | 243 | stacklevel=2, |
|
244 | 244 | ) |
@@ -31,7 +31,7 b' class Stats(object):' | |||
|
31 | 31 | def __init__(self, data): |
|
32 | 32 | self.data = data |
|
33 | 33 | |
|
34 |
def sort(self, crit= |
|
|
34 | def sort(self, crit="inlinetime"): | |
|
35 | 35 | """XXX docstring""" |
|
36 | 36 | # profiler_entries isn't defined when running under PyPy. |
|
37 | 37 | if profiler_entry: |
@@ -383,7 +383,7 b' class patchmeta(object):' | |||
|
383 | 383 | return self._ispatchinga(afile) and self._ispatchingb(bfile) |
|
384 | 384 | |
|
385 | 385 | def __repr__(self): |
|
386 |
return |
|
|
386 | return "<patchmeta %s %r>" % (self.op, self.path) | |
|
387 | 387 | |
|
388 | 388 | |
|
389 | 389 | def readgitpatch(lr): |
@@ -154,4 +154,4 b' def importrust(modname, member=None, def' | |||
|
154 | 154 | except AttributeError: |
|
155 | 155 | if _isrustpermissive(): |
|
156 | 156 | return default |
|
157 |
raise ImportError( |
|
|
157 | raise ImportError("Cannot import name %s" % member) |
@@ -257,7 +257,7 b' else:' | |||
|
257 | 257 | creation = _OPEN_ALWAYS |
|
258 | 258 | flags |= _O_APPEND |
|
259 | 259 | else: |
|
260 |
raise ValueError( |
|
|
260 | raise ValueError("invalid mode: %s" % pycompat.sysstr(mode)) | |
|
261 | 261 | |
|
262 | 262 | fh = _kernel32.CreateFileA( |
|
263 | 263 | name, |
@@ -423,7 +423,7 b' else:' | |||
|
423 | 423 | if isinstance(filename, str): |
|
424 | 424 | return filename |
|
425 | 425 | else: |
|
426 |
raise TypeError( |
|
|
426 | raise TypeError("expect str, not %s" % type(filename).__name__) | |
|
427 | 427 | |
|
428 | 428 | # In Python 2, fsdecode() has a very chance to receive bytes. So it's |
|
429 | 429 | # better not to touch Python 2 part as it's already working fine. |
@@ -126,20 +126,20 b' contextmanager = contextlib.contextmanag' | |||
|
126 | 126 | __all__ = [b'start', b'stop', b'reset', b'display', b'profile'] |
|
127 | 127 | |
|
128 | 128 | skips = { |
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
129 | "util.py:check", | |
|
130 | "extensions.py:closure", | |
|
131 | "color.py:colorcmd", | |
|
132 | "dispatch.py:checkargs", | |
|
133 | "dispatch.py:<lambda>", | |
|
134 | "dispatch.py:_runcatch", | |
|
135 | "dispatch.py:_dispatch", | |
|
136 | "dispatch.py:_runcommand", | |
|
137 | "pager.py:pagecmd", | |
|
138 | "dispatch.py:run", | |
|
139 | "dispatch.py:dispatch", | |
|
140 | "dispatch.py:runcommand", | |
|
141 | "hg.py:<module>", | |
|
142 | "evolve.py:warnobserrors", | |
|
143 | 143 | } |
|
144 | 144 | |
|
145 | 145 | ########################################################################### |
@@ -1061,15 +1061,15 b' def main(argv=None):' | |||
|
1061 | 1061 | displayargs[b'limit'] = 0.05 |
|
1062 | 1062 | path = None |
|
1063 | 1063 | for o, value in opts: |
|
1064 |
if o in ( |
|
|
1064 | if o in ("-l", "--limit"): | |
|
1065 | 1065 | displayargs[b'limit'] = float(value) |
|
1066 |
elif o in ( |
|
|
1066 | elif o in ("-f", "--file"): | |
|
1067 | 1067 | path = value |
|
1068 |
elif o in ( |
|
|
1068 | elif o in ("-o", "--output-file"): | |
|
1069 | 1069 | displayargs[b'outputfile'] = value |
|
1070 |
elif o in ( |
|
|
1070 | elif o in ("-p", "--script-path"): | |
|
1071 | 1071 | displayargs[b'scriptpath'] = value |
|
1072 |
elif o in ( |
|
|
1072 | elif o in ("-h", "help"): | |
|
1073 | 1073 | printusage() |
|
1074 | 1074 | return 0 |
|
1075 | 1075 | else: |
@@ -1086,5 +1086,5 b' def main(argv=None):' | |||
|
1086 | 1086 | return 0 |
|
1087 | 1087 | |
|
1088 | 1088 | |
|
1089 |
if __name__ == |
|
|
1089 | if __name__ == "__main__": | |
|
1090 | 1090 | sys.exit(main()) |
@@ -263,7 +263,7 b' def mainfrozen():' | |||
|
263 | 263 | return ( |
|
264 | 264 | pycompat.safehasattr(sys, "frozen") |
|
265 | 265 | or pycompat.safehasattr(sys, "importers") # new py2exe |
|
266 |
or imp.is_frozen( |
|
|
266 | or imp.is_frozen("__main__") # old py2exe | |
|
267 | 267 | ) # tools/freeze |
|
268 | 268 | |
|
269 | 269 |
@@ -167,39 +167,39 b' PKCS_7_ASN_ENCODING = 0x00010000' | |||
|
167 | 167 | # These structs are only complete enough to achieve what we need. |
|
168 | 168 | class CERT_CHAIN_CONTEXT(ctypes.Structure): |
|
169 | 169 | _fields_ = ( |
|
170 |
( |
|
|
170 | ("cbSize", _DWORD), | |
|
171 | 171 | # CERT_TRUST_STATUS struct |
|
172 |
( |
|
|
173 |
( |
|
|
174 |
( |
|
|
175 |
( |
|
|
176 |
( |
|
|
177 |
( |
|
|
178 |
( |
|
|
179 |
( |
|
|
172 | ("dwErrorStatus", _DWORD), | |
|
173 | ("dwInfoStatus", _DWORD), | |
|
174 | ("cChain", _DWORD), | |
|
175 | ("rgpChain", ctypes.c_void_p), | |
|
176 | ("cLowerQualityChainContext", _DWORD), | |
|
177 | ("rgpLowerQualityChainContext", ctypes.c_void_p), | |
|
178 | ("fHasRevocationFreshnessTime", _BOOL), | |
|
179 | ("dwRevocationFreshnessTime", _DWORD), | |
|
180 | 180 | ) |
|
181 | 181 | |
|
182 | 182 | |
|
183 | 183 | class CERT_USAGE_MATCH(ctypes.Structure): |
|
184 | 184 | _fields_ = ( |
|
185 |
( |
|
|
185 | ("dwType", _DWORD), | |
|
186 | 186 | # CERT_ENHKEY_USAGE struct |
|
187 |
( |
|
|
188 |
( |
|
|
187 | ("cUsageIdentifier", _DWORD), | |
|
188 | ("rgpszUsageIdentifier", ctypes.c_void_p), # LPSTR * | |
|
189 | 189 | ) |
|
190 | 190 | |
|
191 | 191 | |
|
192 | 192 | class CERT_CHAIN_PARA(ctypes.Structure): |
|
193 | 193 | _fields_ = ( |
|
194 |
( |
|
|
195 |
( |
|
|
196 |
( |
|
|
197 |
( |
|
|
198 |
( |
|
|
199 |
( |
|
|
200 |
( |
|
|
201 |
( |
|
|
202 |
( |
|
|
194 | ("cbSize", _DWORD), | |
|
195 | ("RequestedUsage", CERT_USAGE_MATCH), | |
|
196 | ("RequestedIssuancePolicy", CERT_USAGE_MATCH), | |
|
197 | ("dwUrlRetrievalTimeout", _DWORD), | |
|
198 | ("fCheckRevocationFreshnessTime", _BOOL), | |
|
199 | ("dwRevocationFreshnessTime", _DWORD), | |
|
200 | ("pftCacheResync", ctypes.c_void_p), # LPFILETIME | |
|
201 | ("pStrongSignPara", ctypes.c_void_p), # PCCERT_STRONG_SIGN_PARA | |
|
202 | ("dwStrongSignFlags", _DWORD), | |
|
203 | 203 | ) |
|
204 | 204 | |
|
205 | 205 | |
@@ -732,7 +732,7 b' def unlink(f):' | |||
|
732 | 732 | if e.errno != errno.EEXIST: |
|
733 | 733 | raise |
|
734 | 734 | else: |
|
735 |
raise IOError(errno.EEXIST, |
|
|
735 | raise IOError(errno.EEXIST, "No usable temporary filename found") | |
|
736 | 736 | |
|
737 | 737 | try: |
|
738 | 738 | os.unlink(temp) |
General Comments 0
You need to be logged in to leave comments.
Login now