##// END OF EJS Templates
merge with stable
Matt Harbison -
r47552:e2f7b269 merge default
parent child Browse files
Show More
@@ -39,6 +39,7 b' if pycompat.TYPE_CHECKING:'
39 Tuple,
39 Tuple,
40 Union,
40 Union,
41 )
41 )
42 from . import localrepo
42
43
43 assert any(
44 assert any(
44 (
45 (
@@ -51,6 +52,7 b' if pycompat.TYPE_CHECKING:'
51 Set,
52 Set,
52 Tuple,
53 Tuple,
53 Union,
54 Union,
55 localrepo,
54 )
56 )
55 )
57 )
56
58
@@ -193,7 +195,7 b' class branchcache(object):'
193 closednodes=None,
195 closednodes=None,
194 hasnode=None,
196 hasnode=None,
195 ):
197 ):
196 # type: (Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes, int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None
198 # type: (localrepo.localrepository, Union[Dict[bytes, List[bytes]], Iterable[Tuple[bytes, List[bytes]]]], bytes, int, Optional[bytes], Optional[Set[bytes]], Optional[Callable[[bytes], bool]]) -> None
197 """hasnode is a function which can be used to verify whether changelog
199 """hasnode is a function which can be used to verify whether changelog
198 has a given node or not. If it's not provided, we assume that every node
200 has a given node or not. If it's not provided, we assume that every node
199 we have exists in changelog"""
201 we have exists in changelog"""
@@ -303,9 +305,7 b' class branchcache(object):'
303 msg
305 msg
304 % (
306 % (
305 _branchcachedesc(repo),
307 _branchcachedesc(repo),
306 pycompat.bytestr(
308 stringutil.forcebytestr(inst),
307 inst
308 ), # pytype: disable=wrong-arg-types
309 )
309 )
310 )
310 )
311 bcache = None
311 bcache = None
@@ -10,7 +10,7 b' from __future__ import absolute_import'
10 import struct
10 import struct
11
11
12 from ..pure.bdiff import *
12 from ..pure.bdiff import *
13 from . import _bdiff
13 from . import _bdiff # pytype: disable=import-error
14
14
15 ffi = _bdiff.ffi
15 ffi = _bdiff.ffi
16 lib = _bdiff.lib
16 lib = _bdiff.lib
@@ -9,7 +9,7 b' from __future__ import absolute_import'
9
9
10 from ..pure.mpatch import *
10 from ..pure.mpatch import *
11 from ..pure.mpatch import mpatchError # silence pyflakes
11 from ..pure.mpatch import mpatchError # silence pyflakes
12 from . import _mpatch
12 from . import _mpatch # pytype: disable=import-error
13
13
14 ffi = _mpatch.ffi
14 ffi = _mpatch.ffi
15 lib = _mpatch.lib
15 lib = _mpatch.lib
@@ -15,7 +15,7 b' from ..pure.osutil import *'
15 from .. import pycompat
15 from .. import pycompat
16
16
17 if pycompat.isdarwin:
17 if pycompat.isdarwin:
18 from . import _osutil
18 from . import _osutil # pytype: disable=import-error
19
19
20 ffi = _osutil.ffi
20 ffi = _osutil.ffi
21 lib = _osutil.lib
21 lib = _osutil.lib
@@ -910,7 +910,7 b' def deltagroup('
910
910
911 configtarget = repo.ui.config(b'devel', b'bundle.delta')
911 configtarget = repo.ui.config(b'devel', b'bundle.delta')
912 if configtarget not in (b'', b'p1', b'full'):
912 if configtarget not in (b'', b'p1', b'full'):
913 msg = _("""config "devel.bundle.delta" as unknown value: %s""")
913 msg = _(b"""config "devel.bundle.delta" as unknown value: %s""")
914 repo.ui.warn(msg % configtarget)
914 repo.ui.warn(msg % configtarget)
915
915
916 deltamode = repository.CG_DELTAMODE_STD
916 deltamode = repository.CG_DELTAMODE_STD
@@ -1311,9 +1311,10 b' class cgpacker(object):'
1311 def makelookupmflinknode(tree, nodes):
1311 def makelookupmflinknode(tree, nodes):
1312 if fastpathlinkrev:
1312 if fastpathlinkrev:
1313 assert not tree
1313 assert not tree
1314 return (
1314
1315 manifests.__getitem__
1315 # pytype: disable=unsupported-operands
1316 ) # pytype: disable=unsupported-operands
1316 return manifests.__getitem__
1317 # pytype: enable=unsupported-operands
1317
1318
1318 def lookupmflinknode(x):
1319 def lookupmflinknode(x):
1319 """Callback for looking up the linknode for manifests.
1320 """Callback for looking up the linknode for manifests.
@@ -869,7 +869,7 b' class morestatus(object):'
869 )
869 )
870 msg = (
870 msg = (
871 _(
871 _(
872 '''Unresolved merge conflicts:
872 b'''Unresolved merge conflicts:
873
873
874 %s
874 %s
875
875
@@ -1083,7 +1083,7 b' def bisect('
1083 if rev:
1083 if rev:
1084 if not nodes:
1084 if not nodes:
1085 raise error.Abort(_(b'empty revision set'))
1085 raise error.Abort(_(b'empty revision set'))
1086 node = repo[nodes.last()].node()
1086 node = repo[nodes[-1]].node()
1087 with hbisect.restore_state(repo, state, node):
1087 with hbisect.restore_state(repo, state, node):
1088 while changesets:
1088 while changesets:
1089 # update state
1089 # update state
@@ -3452,7 +3452,8 b' def grep(ui, repo, pattern, *pats, **opt'
3452 regexp = util.re.compile(pattern, reflags)
3452 regexp = util.re.compile(pattern, reflags)
3453 except re.error as inst:
3453 except re.error as inst:
3454 ui.warn(
3454 ui.warn(
3455 _(b"grep: invalid match pattern: %s\n") % pycompat.bytestr(inst)
3455 _(b"grep: invalid match pattern: %s\n")
3456 % stringutil.forcebytestr(inst)
3456 )
3457 )
3457 return 1
3458 return 1
3458 sep, eol = b':', b'\n'
3459 sep, eol = b':', b'\n'
@@ -359,19 +359,15 b' def _filecommit('
359 elif fparent1 == nullid:
359 elif fparent1 == nullid:
360 fparent1, fparent2 = fparent2, nullid
360 fparent1, fparent2 = fparent2, nullid
361 elif fparent2 != nullid:
361 elif fparent2 != nullid:
362 # is one parent an ancestor of the other?
362 if ms.active() and ms.extras(fname).get(b'filenode-source') == b'other':
363 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
364 if fparent1 in fparentancestors:
365 fparent1, fparent2 = fparent2, nullid
363 fparent1, fparent2 = fparent2, nullid
366 elif fparent2 in fparentancestors:
364 # is one parent an ancestor of the other?
367 fparent2 = nullid
365 else:
368 elif not fparentancestors:
366 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
369 # TODO: this whole if-else might be simplified much more
367 if fparent1 in fparentancestors:
370 if (
371 ms.active()
372 and ms.extras(fname).get(b'filenode-source') == b'other'
373 ):
374 fparent1, fparent2 = fparent2, nullid
368 fparent1, fparent2 = fparent2, nullid
369 elif fparent2 in fparentancestors:
370 fparent2 = nullid
375
371
376 force_new_node = False
372 force_new_node = False
377 # The file might have been deleted by merge code and user explicitly choose
373 # The file might have been deleted by merge code and user explicitly choose
@@ -993,8 +993,10 b' class basefilectx(object):'
993 # if file data starts with '\1\n', empty metadata block is
993 # if file data starts with '\1\n', empty metadata block is
994 # prepended, which adds 4 bytes to filelog.size().
994 # prepended, which adds 4 bytes to filelog.size().
995 return self._filelog.cmp(self._filenode, fctx.data())
995 return self._filelog.cmp(self._filenode, fctx.data())
996 if self.size() == fctx.size():
996 if self.size() == fctx.size() or self.flags() == b'l':
997 # size() matches: need to compare content
997 # size() matches: need to compare content
998 # issue6456: Always compare symlinks because size can represent
999 # encrypted string for EXT-4 encryption(fscrypt).
998 return self._filelog.cmp(self._filenode, fctx.data())
1000 return self._filelog.cmp(self._filenode, fctx.data())
999
1001
1000 # size() differs
1002 # size() differs
@@ -34,14 +34,14 b' stringio = util.stringio'
34
34
35 # patch comments based on the git one
35 # patch comments based on the git one
36 diffhelptext = _(
36 diffhelptext = _(
37 """# To remove '-' lines, make them ' ' lines (context).
37 b"""# To remove '-' lines, make them ' ' lines (context).
38 # To remove '+' lines, delete them.
38 # To remove '+' lines, delete them.
39 # Lines starting with # will be removed from the patch.
39 # Lines starting with # will be removed from the patch.
40 """
40 """
41 )
41 )
42
42
43 hunkhelptext = _(
43 hunkhelptext = _(
44 """#
44 b"""#
45 # If the patch applies cleanly, the edited hunk will immediately be
45 # If the patch applies cleanly, the edited hunk will immediately be
46 # added to the record list. If it does not apply cleanly, a rejects file
46 # added to the record list. If it does not apply cleanly, a rejects file
47 # will be generated. You can use that when you try again. If all lines
47 # will be generated. You can use that when you try again. If all lines
@@ -51,7 +51,7 b' hunkhelptext = _('
51 )
51 )
52
52
53 patchhelptext = _(
53 patchhelptext = _(
54 """#
54 b"""#
55 # If the patch applies cleanly, the edited patch will immediately
55 # If the patch applies cleanly, the edited patch will immediately
56 # be finalised. If it does not apply cleanly, rejects files will be
56 # be finalised. If it does not apply cleanly, rejects files will be
57 # generated. You can use those when you try again.
57 # generated. You can use those when you try again.
@@ -64,7 +64,7 b' try:'
64
64
65 curses.error
65 curses.error
66 except (ImportError, AttributeError):
66 except (ImportError, AttributeError):
67 curses = False
67 curses = None
68
68
69
69
70 class fallbackerror(error.Abort):
70 class fallbackerror(error.Abort):
@@ -611,7 +611,8 b' def testchunkselector(testfn, ui, header'
611
611
612 chunkselector.stdscr = dummystdscr()
612 chunkselector.stdscr = dummystdscr()
613 if testfn and os.path.exists(testfn):
613 if testfn and os.path.exists(testfn):
614 testf = open(testfn, 'r')
614 testf = open(testfn, b'r')
615 # TODO: open in binary mode?
615 testcommands = [x.rstrip('\n') for x in testf.readlines()]
616 testcommands = [x.rstrip('\n') for x in testf.readlines()]
616 testf.close()
617 testf.close()
617 while True:
618 while True:
@@ -1151,7 +1152,7 b' class curseschunkselector(object):'
1151 numtrailingspaces = origlen - strippedlen
1152 numtrailingspaces = origlen - strippedlen
1152
1153
1153 if towin:
1154 if towin:
1154 window.addstr(text, colorpair)
1155 window.addstr(encoding.strfromlocal(text), colorpair)
1155 t += text
1156 t += text
1156
1157
1157 if showwhtspc:
1158 if showwhtspc:
@@ -1621,7 +1622,7 b' class curseschunkselector(object):'
1621 def helpwindow(self):
1622 def helpwindow(self):
1622 """print a help window to the screen. exit after any keypress."""
1623 """print a help window to the screen. exit after any keypress."""
1623 helptext = _(
1624 helptext = _(
1624 """ [press any key to return to the patch-display]
1625 b""" [press any key to return to the patch-display]
1625
1626
1626 The curses hunk selector allows you to interactively choose among the
1627 The curses hunk selector allows you to interactively choose among the
1627 changes you have made, and confirm only those changes you select for
1628 changes you have made, and confirm only those changes you select for
@@ -1745,7 +1746,7 b' smaller changesets. the following are va'
1745 """ask for 'y' to be pressed to confirm selected. return True if
1746 """ask for 'y' to be pressed to confirm selected. return True if
1746 confirmed."""
1747 confirmed."""
1747 confirmtext = _(
1748 confirmtext = _(
1748 """If you answer yes to the following, your currently chosen patch chunks
1749 b"""If you answer yes to the following, your currently chosen patch chunks
1749 will be loaded into an editor. To modify the patch, make the changes in your
1750 will be loaded into an editor. To modify the patch, make the changes in your
1750 editor and save. To accept the current patch as-is, close the editor without
1751 editor and save. To accept the current patch as-is, close the editor without
1751 saving.
1752 saving.
@@ -168,9 +168,9 b' def parsedag(desc):'
168 if not desc:
168 if not desc:
169 return
169 return
170
170
171 wordchars = pycompat.bytestr(
171 # pytype: disable=wrong-arg-types
172 string.ascii_letters + string.digits
172 wordchars = pycompat.bytestr(string.ascii_letters + string.digits)
173 ) # pytype: disable=wrong-arg-types
173 # pytype: enable=wrong-arg-types
174
174
175 labels = {}
175 labels = {}
176 p1 = -1
176 p1 = -1
@@ -179,9 +179,9 b' def parsedag(desc):'
179 def resolve(ref):
179 def resolve(ref):
180 if not ref:
180 if not ref:
181 return p1
181 return p1
182 elif ref[0] in pycompat.bytestr(
182 # pytype: disable=wrong-arg-types
183 string.digits
183 elif ref[0] in pycompat.bytestr(string.digits):
184 ): # pytype: disable=wrong-arg-types
184 # pytype: enable=wrong-arg-types
185 return r - int(ref)
185 return r - int(ref)
186 else:
186 else:
187 return labels[ref]
187 return labels[ref]
@@ -215,9 +215,9 b' def parsedag(desc):'
215
215
216 c = nextch()
216 c = nextch()
217 while c != b'\0':
217 while c != b'\0':
218 while c in pycompat.bytestr(
218 # pytype: disable=wrong-arg-types
219 string.whitespace
219 while c in pycompat.bytestr(string.whitespace):
220 ): # pytype: disable=wrong-arg-types
220 # pytype: enable=wrong-arg-types
221 c = nextch()
221 c = nextch()
222 if c == b'.':
222 if c == b'.':
223 yield b'n', (r, [p1])
223 yield b'n', (r, [p1])
@@ -225,9 +225,9 b' def parsedag(desc):'
225 r += 1
225 r += 1
226 c = nextch()
226 c = nextch()
227 elif c == b'+':
227 elif c == b'+':
228 c, digs = nextrun(
228 # pytype: disable=wrong-arg-types
229 nextch(), pycompat.bytestr(string.digits)
229 c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
230 ) # pytype: disable=wrong-arg-types
230 # pytype: enable=wrong-arg-types
231 n = int(digs)
231 n = int(digs)
232 for i in pycompat.xrange(0, n):
232 for i in pycompat.xrange(0, n):
233 yield b'n', (r, [p1])
233 yield b'n', (r, [p1])
@@ -1702,7 +1702,7 b' def debuginstall(ui, **opts):'
1702 )
1702 )
1703
1703
1704 try:
1704 try:
1705 from . import rustext
1705 from . import rustext # pytype: disable=import-error
1706
1706
1707 rustext.__doc__ # trigger lazy import
1707 rustext.__doc__ # trigger lazy import
1708 except ImportError:
1708 except ImportError:
@@ -2121,7 +2121,9 b' def debugmanifestfulltextcache(ui, repo,'
2121 try:
2121 try:
2122 manifest = m[store.lookup(n)]
2122 manifest = m[store.lookup(n)]
2123 except error.LookupError as e:
2123 except error.LookupError as e:
2124 raise error.Abort(e, hint=b"Check your manifest node id")
2124 raise error.Abort(
2125 bytes(e), hint=b"Check your manifest node id"
2126 )
2125 manifest.read() # stores revisision in cache too
2127 manifest.read() # stores revisision in cache too
2126 return
2128 return
2127
2129
@@ -2456,7 +2458,7 b' def debugobsolete(ui, repo, precursor=No'
2456 tr.close()
2458 tr.close()
2457 except ValueError as exc:
2459 except ValueError as exc:
2458 raise error.Abort(
2460 raise error.Abort(
2459 _(b'bad obsmarker input: %s') % pycompat.bytestr(exc)
2461 _(b'bad obsmarker input: %s') % stringutil.forcebytestr(exc)
2460 )
2462 )
2461 finally:
2463 finally:
2462 tr.release()
2464 tr.release()
@@ -1284,7 +1284,12 b' class dirstate(object):'
1284 or size == -2 # other parent
1284 or size == -2 # other parent
1285 or fn in copymap
1285 or fn in copymap
1286 ):
1286 ):
1287 madd(fn)
1287 if stat.S_ISLNK(st.st_mode) and size != st.st_size:
1288 # issue6456: Size returned may be longer due to
1289 # encryption on EXT-4 fscrypt, undecided.
1290 ladd(fn)
1291 else:
1292 madd(fn)
1288 elif (
1293 elif (
1289 time != st[stat.ST_MTIME]
1294 time != st[stat.ST_MTIME]
1290 and time != st[stat.ST_MTIME] & _rangemask
1295 and time != st[stat.ST_MTIME] & _rangemask
@@ -173,7 +173,9 b' if pycompat.ispy3:'
173 "line_buffering": sys.stdout.line_buffering,
173 "line_buffering": sys.stdout.line_buffering,
174 }
174 }
175 if util.safehasattr(sys.stdout, "write_through"):
175 if util.safehasattr(sys.stdout, "write_through"):
176 # pytype: disable=attribute-error
176 kwargs["write_through"] = sys.stdout.write_through
177 kwargs["write_through"] = sys.stdout.write_through
178 # pytype: enable=attribute-error
177 sys.stdout = io.TextIOWrapper(
179 sys.stdout = io.TextIOWrapper(
178 sys.stdout.buffer,
180 sys.stdout.buffer,
179 sys.stdout.encoding,
181 sys.stdout.encoding,
@@ -187,7 +189,9 b' if pycompat.ispy3:'
187 "line_buffering": sys.stderr.line_buffering,
189 "line_buffering": sys.stderr.line_buffering,
188 }
190 }
189 if util.safehasattr(sys.stderr, "write_through"):
191 if util.safehasattr(sys.stderr, "write_through"):
192 # pytype: disable=attribute-error
190 kwargs["write_through"] = sys.stderr.write_through
193 kwargs["write_through"] = sys.stderr.write_through
194 # pytype: enable=attribute-error
191 sys.stderr = io.TextIOWrapper(
195 sys.stderr = io.TextIOWrapper(
192 sys.stderr.buffer,
196 sys.stderr.buffer,
193 sys.stderr.encoding,
197 sys.stderr.encoding,
@@ -18,6 +18,11 b' import difflib'
18 # Do not import anything but pycompat here, please
18 # Do not import anything but pycompat here, please
19 from . import pycompat
19 from . import pycompat
20
20
21 if pycompat.TYPE_CHECKING:
22 from typing import (
23 Optional,
24 )
25
21
26
22 def _tobytes(exc):
27 def _tobytes(exc):
23 """Byte-stringify exception in the same way as BaseException_str()"""
28 """Byte-stringify exception in the same way as BaseException_str()"""
@@ -170,6 +175,7 b' class Abort(Hint, Exception):'
170 """Raised if a command needs to print an error and exit."""
175 """Raised if a command needs to print an error and exit."""
171
176
172 def __init__(self, message, hint=None):
177 def __init__(self, message, hint=None):
178 # type: (bytes, Optional[bytes]) -> None
173 self.message = message
179 self.message = message
174 self.hint = hint
180 self.hint = hint
175 # Pass the message into the Exception constructor to help extensions
181 # Pass the message into the Exception constructor to help extensions
@@ -912,6 +912,7 b' def enabled(shortname=True):'
912 exts = {}
912 exts = {}
913 for ename, ext in extensions():
913 for ename, ext in extensions():
914 doc = gettext(ext.__doc__) or _(b'(no help text available)')
914 doc = gettext(ext.__doc__) or _(b'(no help text available)')
915 assert doc is not None # help pytype
915 if shortname:
916 if shortname:
916 ename = ename.split(b'.')[-1]
917 ename = ename.split(b'.')[-1]
917 exts[ename] = doc.splitlines()[0].strip()
918 exts[ename] = doc.splitlines()[0].strip()
@@ -41,7 +41,6 b' from . import ('
41 mergestate as mergestatemod,
41 mergestate as mergestatemod,
42 narrowspec,
42 narrowspec,
43 phases,
43 phases,
44 pycompat,
45 requirements,
44 requirements,
46 scmutil,
45 scmutil,
47 sshpeer,
46 sshpeer,
@@ -53,7 +52,11 b' from . import ('
53 verify as verifymod,
52 verify as verifymod,
54 vfs as vfsmod,
53 vfs as vfsmod,
55 )
54 )
56 from .utils import hashutil
55 from .utils import (
56 hashutil,
57 stringutil,
58 )
59
57
60
58 release = lock.release
61 release = lock.release
59
62
@@ -74,7 +77,7 b' def _local(path):'
74 # Python 2 raises TypeError, Python 3 ValueError.
77 # Python 2 raises TypeError, Python 3 ValueError.
75 except (TypeError, ValueError) as e:
78 except (TypeError, ValueError) as e:
76 raise error.Abort(
79 raise error.Abort(
77 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
80 _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
78 )
81 )
79 except OSError:
82 except OSError:
80 isfile = False
83 isfile = False
@@ -1156,6 +1156,7 b' def filelog(web):'
1156
1156
1157 linerange = None
1157 linerange = None
1158 if lrange is not None:
1158 if lrange is not None:
1159 assert lrange is not None # help pytype (!?)
1159 linerange = webutil.formatlinerange(*lrange)
1160 linerange = webutil.formatlinerange(*lrange)
1160 # deactivate numeric nav links when linerange is specified as this
1161 # deactivate numeric nav links when linerange is specified as this
1161 # would required a dedicated "revnav" class
1162 # would required a dedicated "revnav" class
@@ -25,7 +25,7 b' def launch(application):'
25 procutil.setbinary(procutil.stdout)
25 procutil.setbinary(procutil.stdout)
26
26
27 environ = dict(pycompat.iteritems(os.environ)) # re-exports
27 environ = dict(pycompat.iteritems(os.environ)) # re-exports
28 environ.setdefault('PATH_INFO', b'')
28 environ.setdefault('PATH_INFO', '')
29 if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'):
29 if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'):
30 # IIS includes script_name in PATH_INFO
30 # IIS includes script_name in PATH_INFO
31 scriptname = environ['SCRIPT_NAME']
31 scriptname = environ['SCRIPT_NAME']
@@ -2336,6 +2336,7 b' class localrepository(object):'
2336
2336
2337 def tracktags(tr2):
2337 def tracktags(tr2):
2338 repo = reporef()
2338 repo = reporef()
2339 assert repo is not None # help pytype
2339 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
2340 oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads)
2340 newheads = repo.changelog.headrevs()
2341 newheads = repo.changelog.headrevs()
2341 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
2342 newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads)
@@ -2372,6 +2373,7 b' class localrepository(object):'
2372 # gating.
2373 # gating.
2373 tracktags(tr2)
2374 tracktags(tr2)
2374 repo = reporef()
2375 repo = reporef()
2376 assert repo is not None # help pytype
2375
2377
2376 singleheadopt = (b'experimental', b'single-head-per-branch')
2378 singleheadopt = (b'experimental', b'single-head-per-branch')
2377 singlehead = repo.ui.configbool(*singleheadopt)
2379 singlehead = repo.ui.configbool(*singleheadopt)
@@ -2475,6 +2477,8 b' class localrepository(object):'
2475
2477
2476 def hookfunc(unused_success):
2478 def hookfunc(unused_success):
2477 repo = reporef()
2479 repo = reporef()
2480 assert repo is not None # help pytype
2481
2478 if hook.hashook(repo.ui, b'txnclose-bookmark'):
2482 if hook.hashook(repo.ui, b'txnclose-bookmark'):
2479 bmchanges = sorted(tr.changes[b'bookmarks'].items())
2483 bmchanges = sorted(tr.changes[b'bookmarks'].items())
2480 for name, (old, new) in bmchanges:
2484 for name, (old, new) in bmchanges:
@@ -2506,7 +2510,9 b' class localrepository(object):'
2506 b'txnclose', throw=False, **pycompat.strkwargs(hookargs)
2510 b'txnclose', throw=False, **pycompat.strkwargs(hookargs)
2507 )
2511 )
2508
2512
2509 reporef()._afterlock(hookfunc)
2513 repo = reporef()
2514 assert repo is not None # help pytype
2515 repo._afterlock(hookfunc)
2510
2516
2511 tr.addfinalize(b'txnclose-hook', txnclosehook)
2517 tr.addfinalize(b'txnclose-hook', txnclosehook)
2512 # Include a leading "-" to make it happen before the transaction summary
2518 # Include a leading "-" to make it happen before the transaction summary
@@ -2517,7 +2523,9 b' class localrepository(object):'
2517
2523
2518 def txnaborthook(tr2):
2524 def txnaborthook(tr2):
2519 """To be run if transaction is aborted"""
2525 """To be run if transaction is aborted"""
2520 reporef().hook(
2526 repo = reporef()
2527 assert repo is not None # help pytype
2528 repo.hook(
2521 b'txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs)
2529 b'txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs)
2522 )
2530 )
2523
2531
@@ -2700,6 +2708,7 b' class localrepository(object):'
2700
2708
2701 def updater(tr):
2709 def updater(tr):
2702 repo = reporef()
2710 repo = reporef()
2711 assert repo is not None # help pytype
2703 repo.updatecaches(tr)
2712 repo.updatecaches(tr)
2704
2713
2705 return updater
2714 return updater
@@ -2915,7 +2924,7 b' class localrepository(object):'
2915
2924
2916 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2925 If both 'lock' and 'wlock' must be acquired, ensure you always acquires
2917 'wlock' first to avoid a dead-lock hazard."""
2926 'wlock' first to avoid a dead-lock hazard."""
2918 l = self._wlockref and self._wlockref()
2927 l = self._wlockref() if self._wlockref else None
2919 if l is not None and l.held:
2928 if l is not None and l.held:
2920 l.lock()
2929 l.lock()
2921 return l
2930 return l
@@ -52,6 +52,7 b' if pycompat.TYPE_CHECKING:'
52 Dict,
52 Dict,
53 List,
53 List,
54 Optional,
54 Optional,
55 Sequence,
55 Tuple,
56 Tuple,
56 )
57 )
57
58
@@ -754,7 +755,7 b' class walkopts(object):'
754
755
755
756
756 def parseopts(ui, pats, opts):
757 def parseopts(ui, pats, opts):
757 # type: (Any, List[bytes], Dict[bytes, Any]) -> walkopts
758 # type: (Any, Sequence[bytes], Dict[bytes, Any]) -> walkopts
758 """Parse log command options into walkopts
759 """Parse log command options into walkopts
759
760
760 The returned walkopts will be passed in to getrevs() or makewalker().
761 The returned walkopts will be passed in to getrevs() or makewalker().
@@ -165,7 +165,7 b' def _smtp(ui):'
165 try:
165 try:
166 s.login(username, password)
166 s.login(username, password)
167 except smtplib.SMTPException as inst:
167 except smtplib.SMTPException as inst:
168 raise error.Abort(inst)
168 raise error.Abort(stringutil.forcebytestr(inst))
169
169
170 def send(sender, recipients, msg):
170 def send(sender, recipients, msg):
171 try:
171 try:
@@ -20,6 +20,7 b' from .node import ('
20 nullrev,
20 nullrev,
21 )
21 )
22 from .thirdparty import attr
22 from .thirdparty import attr
23 from .utils import stringutil
23 from . import (
24 from . import (
24 copies,
25 copies,
25 encoding,
26 encoding,
@@ -1343,7 +1344,7 b' def batchremove(repo, wctx, actions):'
1343 except OSError as inst:
1344 except OSError as inst:
1344 repo.ui.warn(
1345 repo.ui.warn(
1345 _(b"update failed to remove %s: %s!\n")
1346 _(b"update failed to remove %s: %s!\n")
1346 % (f, pycompat.bytestr(inst.strerror))
1347 % (f, stringutil.forcebytestr(inst.strerror))
1347 )
1348 )
1348 if i == 100:
1349 if i == 100:
1349 yield i, f
1350 yield i, f
@@ -782,7 +782,7 b' def successorsandmarkers(repo, ctx):'
782 # closestsuccessors returns an empty list for pruned revisions, remap it
782 # closestsuccessors returns an empty list for pruned revisions, remap it
783 # into a list containing an empty list for future processing
783 # into a list containing an empty list for future processing
784 if ssets == []:
784 if ssets == []:
785 ssets = [[]]
785 ssets = [_succs()]
786
786
787 # Try to recover pruned markers
787 # Try to recover pruned markers
788 succsmap = repo.obsstore.successors
788 succsmap = repo.obsstore.successors
@@ -1210,7 +1210,7 b' def filterpatch(ui, headers, match, oper'
1210 # Patch comment based on the Git one (based on comment at end of
1210 # Patch comment based on the Git one (based on comment at end of
1211 # https://mercurial-scm.org/wiki/RecordExtension)
1211 # https://mercurial-scm.org/wiki/RecordExtension)
1212 phelp = b'---' + _(
1212 phelp = b'---' + _(
1213 """
1213 b"""
1214 To remove '-' lines, make them ' ' lines (context).
1214 To remove '-' lines, make them ' ' lines (context).
1215 To remove '+' lines, delete them.
1215 To remove '+' lines, delete them.
1216 Lines starting with # will be removed from the patch.
1216 Lines starting with # will be removed from the patch.
@@ -321,9 +321,10 b' def checklink(path):'
321 fullpath = os.path.join(cachedir, target)
321 fullpath = os.path.join(cachedir, target)
322 open(fullpath, b'w').close()
322 open(fullpath, b'w').close()
323 except IOError as inst:
323 except IOError as inst:
324 if (
324 # pytype: disable=unsupported-operands
325 inst[0] == errno.EACCES
325 if inst[0] == errno.EACCES:
326 ): # pytype: disable=unsupported-operands
326 # pytype: enable=unsupported-operands
327
327 # If we can't write to cachedir, just pretend
328 # If we can't write to cachedir, just pretend
328 # that the fs is readonly and by association
329 # that the fs is readonly and by association
329 # that the fs won't support symlinks. This
330 # that the fs won't support symlinks. This
@@ -172,7 +172,7 b' if not pycompat.iswindows:'
172 else:
172 else:
173 import msvcrt
173 import msvcrt
174
174
175 _kernel32 = ctypes.windll.kernel32
175 _kernel32 = ctypes.windll.kernel32 # pytype: disable=module-attr
176
176
177 _DWORD = ctypes.c_ulong
177 _DWORD = ctypes.c_ulong
178 _LPCSTR = _LPSTR = ctypes.c_char_p
178 _LPCSTR = _LPSTR = ctypes.c_char_p
@@ -216,7 +216,7 b' else:'
216 _kernel32.CreateFileA.restype = _HANDLE
216 _kernel32.CreateFileA.restype = _HANDLE
217
217
218 def _raiseioerror(name):
218 def _raiseioerror(name):
219 err = ctypes.WinError()
219 err = ctypes.WinError() # pytype: disable=module-attr
220 raise IOError(
220 raise IOError(
221 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
221 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
222 )
222 )
@@ -271,7 +271,7 b' else:'
271 if fh == _INVALID_HANDLE_VALUE:
271 if fh == _INVALID_HANDLE_VALUE:
272 _raiseioerror(name)
272 _raiseioerror(name)
273
273
274 fd = msvcrt.open_osfhandle(fh, flags)
274 fd = msvcrt.open_osfhandle(fh, flags) # pytype: disable=module-attr
275 if fd == -1:
275 if fd == -1:
276 _kernel32.CloseHandle(fh)
276 _kernel32.CloseHandle(fh)
277 _raiseioerror(name)
277 _raiseioerror(name)
@@ -570,7 +570,7 b' def _to_value(item, block_map):'
570 def parse_data(data):
570 def parse_data(data):
571 """parse parse nodemap data into a nodemap Trie"""
571 """parse parse nodemap data into a nodemap Trie"""
572 if (len(data) % S_BLOCK.size) != 0:
572 if (len(data) % S_BLOCK.size) != 0:
573 msg = "nodemap data size is not a multiple of block size (%d): %d"
573 msg = b"nodemap data size is not a multiple of block size (%d): %d"
574 raise error.Abort(msg % (S_BLOCK.size, len(data)))
574 raise error.Abort(msg % (S_BLOCK.size, len(data)))
575 if not data:
575 if not data:
576 return Block(), None
576 return Block(), None
@@ -269,7 +269,7 b' def wrapsocket(sock, keyfile, certfile, '
269
269
270 if b'SSLKEYLOGFILE' in encoding.environ:
270 if b'SSLKEYLOGFILE' in encoding.environ:
271 try:
271 try:
272 import sslkeylog
272 import sslkeylog # pytype: disable=import-error
273
273
274 sslkeylog.set_keylog(
274 sslkeylog.set_keylog(
275 pycompat.fsdecode(encoding.environ[b'SSLKEYLOGFILE'])
275 pycompat.fsdecode(encoding.environ[b'SSLKEYLOGFILE'])
@@ -543,7 +543,9 b' def wrapserversocket('
543 # Use the list of more secure ciphers if found in the ssl module.
543 # Use the list of more secure ciphers if found in the ssl module.
544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'):
544 if util.safehasattr(ssl, b'_RESTRICTED_SERVER_CIPHERS'):
545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0)
545 sslcontext.options |= getattr(ssl, 'OP_CIPHER_SERVER_PREFERENCE', 0)
546 # pytype: disable=module-attr
546 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS)
547 sslcontext.set_ciphers(ssl._RESTRICTED_SERVER_CIPHERS)
548 # pytype: enable=module-attr
547
549
548 if requireclientcert:
550 if requireclientcert:
549 sslcontext.verify_mode = ssl.CERT_REQUIRED
551 sslcontext.verify_mode = ssl.CERT_REQUIRED
@@ -1891,7 +1891,12 b' class gitsubrepo(abstractsubrepo):'
1891 if info.issym():
1891 if info.issym():
1892 data = info.linkname
1892 data = info.linkname
1893 else:
1893 else:
1894 data = tar.extractfile(info).read()
1894 f = tar.extractfile(info)
1895 if f:
1896 data = f.read()
1897 else:
1898 self.ui.warn(_(b'skipping "%s" (unknown type)') % bname)
1899 continue
1895 archiver.addfile(prefix + bname, info.mode, info.issym(), data)
1900 archiver.addfile(prefix + bname, info.mode, info.issym(), data)
1896 total += 1
1901 total += 1
1897 progress.increment()
1902 progress.increment()
@@ -24,7 +24,7 b' data_non_inlined = ('
24
24
25
25
26 try:
26 try:
27 from ..cext import parsers as cparsers
27 from ..cext import parsers as cparsers # pytype: disable=import-error
28 except ImportError:
28 except ImportError:
29 cparsers = None
29 cparsers = None
30
30
@@ -581,6 +581,7 b' def upgrade(ui, srcrepo, dstrepo, upgrad'
581 # reference to its new location. So clean it up manually. Alternatively, we
581 # reference to its new location. So clean it up manually. Alternatively, we
582 # could update srcrepo.svfs and other variables to point to the new
582 # could update srcrepo.svfs and other variables to point to the new
583 # location. This is simpler.
583 # location. This is simpler.
584 assert backupvfs is not None # help pytype
584 backupvfs.unlink(b'store/lock')
585 backupvfs.unlink(b'store/lock')
585
586
586 return backuppath
587 return backuppath
@@ -148,6 +148,7 b' if pycompat.ispy3:'
148
148
149
149
150 else:
150 else:
151 # pytype: disable=import-error
151 import BaseHTTPServer
152 import BaseHTTPServer
152 import CGIHTTPServer
153 import CGIHTTPServer
153 import SimpleHTTPServer
154 import SimpleHTTPServer
@@ -155,6 +156,8 b' else:'
155 import urllib
156 import urllib
156 import urlparse
157 import urlparse
157
158
159 # pytype: enable=import-error
160
158 urlreq._registeraliases(
161 urlreq._registeraliases(
159 urllib,
162 urllib,
160 (
163 (
@@ -3,7 +3,7 b' from __future__ import absolute_import'
3 import hashlib
3 import hashlib
4
4
5 try:
5 try:
6 from ..thirdparty import sha1dc
6 from ..thirdparty import sha1dc # pytype: disable=import-error
7
7
8 sha1 = sha1dc.sha1
8 sha1 = sha1dc.sha1
9 except (ImportError, AttributeError):
9 except (ImportError, AttributeError):
@@ -152,8 +152,8 b' if pycompat.ispy3:'
152
152
153 if pycompat.iswindows:
153 if pycompat.iswindows:
154 # Work around Windows bugs.
154 # Work around Windows bugs.
155 stdout = platform.winstdout(stdout)
155 stdout = platform.winstdout(stdout) # pytype: disable=module-attr
156 stderr = platform.winstdout(stderr)
156 stderr = platform.winstdout(stderr) # pytype: disable=module-attr
157 if isatty(stdout):
157 if isatty(stdout):
158 # The standard library doesn't offer line-buffered binary streams.
158 # The standard library doesn't offer line-buffered binary streams.
159 stdout = make_line_buffered(stdout)
159 stdout = make_line_buffered(stdout)
@@ -164,8 +164,8 b' else:'
164 stderr = sys.stderr
164 stderr = sys.stderr
165 if pycompat.iswindows:
165 if pycompat.iswindows:
166 # Work around Windows bugs.
166 # Work around Windows bugs.
167 stdout = platform.winstdout(stdout)
167 stdout = platform.winstdout(stdout) # pytype: disable=module-attr
168 stderr = platform.winstdout(stderr)
168 stderr = platform.winstdout(stderr) # pytype: disable=module-attr
169 if isatty(stdout):
169 if isatty(stdout):
170 if pycompat.iswindows:
170 if pycompat.iswindows:
171 # The Windows C runtime library doesn't support line buffering.
171 # The Windows C runtime library doesn't support line buffering.
@@ -70,12 +70,14 b' try:'
70 )
70 )
71
71
72 def is_resource(package, name):
72 def is_resource(package, name):
73 return resources.is_resource(
73 return resources.is_resource( # pytype: disable=module-attr
74 pycompat.sysstr(package), encoding.strfromlocal(name)
74 pycompat.sysstr(package), encoding.strfromlocal(name)
75 )
75 )
76
76
77 def contents(package):
77 def contents(package):
78 # pytype: disable=module-attr
78 for r in resources.contents(pycompat.sysstr(package)):
79 for r in resources.contents(pycompat.sysstr(package)):
80 # pytype: enable=module-attr
79 yield encoding.strtolocal(r)
81 yield encoding.strtolocal(r)
80
82
81
83
@@ -14,6 +14,9 b' from .node import ('
14 nullid,
14 nullid,
15 short,
15 short,
16 )
16 )
17 from .utils import (
18 stringutil,
19 )
17
20
18 from . import (
21 from . import (
19 error,
22 error,
@@ -81,7 +84,7 b' class verifier(object):'
81
84
82 def _exc(self, linkrev, msg, inst, filename=None):
85 def _exc(self, linkrev, msg, inst, filename=None):
83 """record exception raised during the verify process"""
86 """record exception raised during the verify process"""
84 fmsg = pycompat.bytestr(inst)
87 fmsg = stringutil.forcebytestr(inst)
85 if not fmsg:
88 if not fmsg:
86 fmsg = pycompat.byterepr(inst)
89 fmsg = pycompat.byterepr(inst)
87 self._err(linkrev, b"%s: %s" % (msg, fmsg), filename)
90 self._err(linkrev, b"%s: %s" % (msg, fmsg), filename)
@@ -431,6 +434,7 b' class verifier(object):'
431 filenodes.setdefault(f, {}).update(onefilenodes)
434 filenodes.setdefault(f, {}).update(onefilenodes)
432
435
433 if not dir and subdirnodes:
436 if not dir and subdirnodes:
437 assert subdirprogress is not None # help pytype
434 subdirprogress.complete()
438 subdirprogress.complete()
435 if self.warnorphanstorefiles:
439 if self.warnorphanstorefiles:
436 for f in sorted(storefiles):
440 for f in sorted(storefiles):
@@ -20,10 +20,12 b' from . import ('
20 pycompat,
20 pycompat,
21 )
21 )
22
22
23 # pytype: disable=module-attr
23 _kernel32 = ctypes.windll.kernel32
24 _kernel32 = ctypes.windll.kernel32
24 _advapi32 = ctypes.windll.advapi32
25 _advapi32 = ctypes.windll.advapi32
25 _user32 = ctypes.windll.user32
26 _user32 = ctypes.windll.user32
26 _crypt32 = ctypes.windll.crypt32
27 _crypt32 = ctypes.windll.crypt32
28 # pytype: enable=module-attr
27
29
28 _BOOL = ctypes.c_long
30 _BOOL = ctypes.c_long
29 _WORD = ctypes.c_ushort
31 _WORD = ctypes.c_ushort
@@ -311,7 +313,9 b' except AttributeError:'
311 _kernel32.GetCurrentProcessId.argtypes = []
313 _kernel32.GetCurrentProcessId.argtypes = []
312 _kernel32.GetCurrentProcessId.restype = _DWORD
314 _kernel32.GetCurrentProcessId.restype = _DWORD
313
315
316 # pytype: disable=module-attr
314 _SIGNAL_HANDLER = ctypes.WINFUNCTYPE(_BOOL, _DWORD)
317 _SIGNAL_HANDLER = ctypes.WINFUNCTYPE(_BOOL, _DWORD)
318 # pytype: enable=module-attr
315 _kernel32.SetConsoleCtrlHandler.argtypes = [_SIGNAL_HANDLER, _BOOL]
319 _kernel32.SetConsoleCtrlHandler.argtypes = [_SIGNAL_HANDLER, _BOOL]
316 _kernel32.SetConsoleCtrlHandler.restype = _BOOL
320 _kernel32.SetConsoleCtrlHandler.restype = _BOOL
317
321
@@ -336,7 +340,9 b' except AttributeError:'
336 _user32.ShowWindow.argtypes = [_HANDLE, ctypes.c_int]
340 _user32.ShowWindow.argtypes = [_HANDLE, ctypes.c_int]
337 _user32.ShowWindow.restype = _BOOL
341 _user32.ShowWindow.restype = _BOOL
338
342
343 # pytype: disable=module-attr
339 _WNDENUMPROC = ctypes.WINFUNCTYPE(_BOOL, _HWND, _LPARAM)
344 _WNDENUMPROC = ctypes.WINFUNCTYPE(_BOOL, _HWND, _LPARAM)
345 # pytype: enable=module-attr
340 _user32.EnumWindows.argtypes = [_WNDENUMPROC, _LPARAM]
346 _user32.EnumWindows.argtypes = [_WNDENUMPROC, _LPARAM]
341 _user32.EnumWindows.restype = _BOOL
347 _user32.EnumWindows.restype = _BOOL
342
348
@@ -357,7 +363,7 b' def _raiseoserror(name):'
357 code = _kernel32.GetLastError()
363 code = _kernel32.GetLastError()
358 if code > 0x7FFFFFFF:
364 if code > 0x7FFFFFFF:
359 code -= 2 ** 32
365 code -= 2 ** 32
360 err = ctypes.WinError(code=code)
366 err = ctypes.WinError(code=code) # pytype: disable=module-attr
361 raise OSError(
367 raise OSError(
362 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
368 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
363 )
369 )
@@ -466,7 +472,7 b' def samedevice(path1, path2):'
466
472
467
473
468 def peekpipe(pipe):
474 def peekpipe(pipe):
469 handle = msvcrt.get_osfhandle(pipe.fileno())
475 handle = msvcrt.get_osfhandle(pipe.fileno()) # pytype: disable=module-attr
470 avail = _DWORD()
476 avail = _DWORD()
471
477
472 if not _kernel32.PeekNamedPipe(
478 if not _kernel32.PeekNamedPipe(
@@ -475,7 +481,7 b' def peekpipe(pipe):'
475 err = _kernel32.GetLastError()
481 err = _kernel32.GetLastError()
476 if err == _ERROR_BROKEN_PIPE:
482 if err == _ERROR_BROKEN_PIPE:
477 return 0
483 return 0
478 raise ctypes.WinError(err)
484 raise ctypes.WinError(err) # pytype: disable=module-attr
479
485
480 return avail.value
486 return avail.value
481
487
@@ -506,10 +512,12 b' def executablepath():'
506 size = 600
512 size = 600
507 buf = ctypes.create_string_buffer(size + 1)
513 buf = ctypes.create_string_buffer(size + 1)
508 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
514 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
515 # pytype: disable=module-attr
509 if len == 0:
516 if len == 0:
510 raise ctypes.WinError() # Note: WinError is a function
517 raise ctypes.WinError() # Note: WinError is a function
511 elif len == size:
518 elif len == size:
512 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
519 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
520 # pytype: enable=module-attr
513 return buf.value
521 return buf.value
514
522
515
523
@@ -528,7 +536,8 b' def getvolumename(path):'
528 buf = ctypes.create_string_buffer(size)
536 buf = ctypes.create_string_buffer(size)
529
537
530 if not _kernel32.GetVolumePathNameA(realpath, ctypes.byref(buf), size):
538 if not _kernel32.GetVolumePathNameA(realpath, ctypes.byref(buf), size):
531 raise ctypes.WinError() # Note: WinError is a function
539 # Note: WinError is a function
540 raise ctypes.WinError() # pytype: disable=module-attr
532
541
533 return buf.value
542 return buf.value
534
543
@@ -558,7 +567,8 b' def getfstype(path):'
558 if not _kernel32.GetVolumeInformationA(
567 if not _kernel32.GetVolumeInformationA(
559 volume, None, 0, None, None, None, ctypes.byref(name), size
568 volume, None, 0, None, None, None, ctypes.byref(name), size
560 ):
569 ):
561 raise ctypes.WinError() # Note: WinError is a function
570 # Note: WinError is a function
571 raise ctypes.WinError() # pytype: disable=module-attr
562
572
563 return name.value
573 return name.value
564
574
@@ -568,7 +578,7 b' def getuser():'
568 size = _DWORD(300)
578 size = _DWORD(300)
569 buf = ctypes.create_string_buffer(size.value + 1)
579 buf = ctypes.create_string_buffer(size.value + 1)
570 if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)):
580 if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)):
571 raise ctypes.WinError()
581 raise ctypes.WinError() # pytype: disable=module-attr
572 return buf.value
582 return buf.value
573
583
574
584
@@ -589,7 +599,7 b' def setsignalhandler():'
589 h = _SIGNAL_HANDLER(handler)
599 h = _SIGNAL_HANDLER(handler)
590 _signalhandler.append(h) # needed to prevent garbage collection
600 _signalhandler.append(h) # needed to prevent garbage collection
591 if not _kernel32.SetConsoleCtrlHandler(h, True):
601 if not _kernel32.SetConsoleCtrlHandler(h, True):
592 raise ctypes.WinError()
602 raise ctypes.WinError() # pytype: disable=module-attr
593
603
594
604
595 def hidewindow():
605 def hidewindow():
@@ -686,7 +696,7 b' def spawndetached(args):'
686 ctypes.byref(pi),
696 ctypes.byref(pi),
687 )
697 )
688 if not res:
698 if not res:
689 raise ctypes.WinError()
699 raise ctypes.WinError() # pytype: disable=module-attr
690
700
691 _kernel32.CloseHandle(pi.hProcess)
701 _kernel32.CloseHandle(pi.hProcess)
692 _kernel32.CloseHandle(pi.hThread)
702 _kernel32.CloseHandle(pi.hThread)
@@ -24,6 +24,7 b' from .interfaces import util as interfac'
24 from .utils import (
24 from .utils import (
25 cborutil,
25 cborutil,
26 compression,
26 compression,
27 stringutil,
27 )
28 )
28
29
29 stringio = util.stringio
30 stringio = util.stringio
@@ -233,10 +234,12 b' def handlewsgirequest(rctx, req, res, ch'
233 except hgwebcommon.ErrorResponse as e:
234 except hgwebcommon.ErrorResponse as e:
234 for k, v in e.headers:
235 for k, v in e.headers:
235 res.headers[k] = v
236 res.headers[k] = v
236 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
237 res.status = hgwebcommon.statusmessage(
238 e.code, stringutil.forcebytestr(e)
239 )
237 # TODO This response body assumes the failed command was
240 # TODO This response body assumes the failed command was
238 # "unbundle." That assumption is not always valid.
241 # "unbundle." That assumption is not always valid.
239 res.setbodybytes(b'0\n%s\n' % pycompat.bytestr(e))
242 res.setbodybytes(b'0\n%s\n' % stringutil.forcebytestr(e))
240
243
241 return True
244 return True
242
245
@@ -88,7 +88,9 b' def handlehttpv2request(rctx, req, res, '
88 try:
88 try:
89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
90 except hgwebcommon.ErrorResponse as e:
90 except hgwebcommon.ErrorResponse as e:
91 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
91 res.status = hgwebcommon.statusmessage(
92 e.code, stringutil.forcebytestr(e)
93 )
92 for k, v in e.headers:
94 for k, v in e.headers:
93 res.headers[k] = v
95 res.headers[k] = v
94 res.setbodybytes(b'permission denied')
96 res.setbodybytes(b'permission denied')
@@ -104,7 +104,9 b' if pycompat.ispy3:'
104 else:
104 else:
105
105
106 def ismainthread():
106 def ismainthread():
107 # pytype: disable=module-attr
107 return isinstance(threading.current_thread(), threading._MainThread)
108 return isinstance(threading.current_thread(), threading._MainThread)
109 # pytype: enable=module-attr
108
110
109 def _blockingreader(wrapped):
111 def _blockingreader(wrapped):
110 return wrapped
112 return wrapped
@@ -276,13 +276,13 b' Check that the right ancestors is used w'
276 committing manifest
276 committing manifest
277 committing changelog
277 committing changelog
278 updating the branch cache
278 updating the branch cache
279 rebased as 2a7f09cac94c
279 rebased as c1ffa3b5274e
280 rebase status stored
280 rebase status stored
281 rebase merging completed
281 rebase merging completed
282 update back to initial working directory parent
282 update back to initial working directory parent
283 resolving manifests
283 resolving manifests
284 branchmerge: False, force: False, partial: False
284 branchmerge: False, force: False, partial: False
285 ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0
285 ancestor: c1ffa3b5274e, local: c1ffa3b5274e+, remote: d79e2059b5c0
286 f1.txt: other deleted -> r
286 f1.txt: other deleted -> r
287 removing f1.txt
287 removing f1.txt
288 f2.txt: remote created -> g
288 f2.txt: remote created -> g
@@ -300,7 +300,7 b' Check that the right ancestors is used w'
300 list of changesets:
300 list of changesets:
301 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
301 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
302 19c888675e133ab5dff84516926a65672eaf04d9
302 19c888675e133ab5dff84516926a65672eaf04d9
303 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
303 c1ffa3b5274e92a9388fe782854e295d2e8d0443
304 bundle2-output-bundle: "HG20", 3 parts total
304 bundle2-output-bundle: "HG20", 3 parts total
305 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
305 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
306 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
306 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
@@ -311,7 +311,7 b' Check that the right ancestors is used w'
311 adding changesets
311 adding changesets
312 add changeset 4c9fbe56a16f
312 add changeset 4c9fbe56a16f
313 add changeset 19c888675e13
313 add changeset 19c888675e13
314 add changeset 2a7f09cac94c
314 add changeset c1ffa3b5274e
315 adding manifests
315 adding manifests
316 adding file changes
316 adding file changes
317 adding f1.txt revisions
317 adding f1.txt revisions
General Comments 0
You need to be logged in to leave comments. Login now