# HG changeset patch # User Raphaël Gomès # Date 1721298972 -7200 # Node ID 493034cc3265f9db8e5f4e18a88045a8c6964d82 # Parent 39e2b2d062c1f2e404acc133bc33f6106205aa59 black: format the codebase with 23.3.0 The CI has moved to 23.3.0, which is the last version that supports 3.7 at runtime, so we should honor this change. # skip-blame mass-reformating only diff -r 39e2b2d062c1 -r 493034cc3265 contrib/automation/hgautomation/cli.py --- a/contrib/automation/hgautomation/cli.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/automation/hgautomation/cli.py Thu Jul 18 12:36:12 2024 +0200 @@ -201,7 +201,6 @@ with aws.temporary_linux_dev_instances( c, image, instance_type, ensure_extra_volume=ensure_extra_volume ) as insts: - instance = insts[0] linux.prepare_exec_environment( diff -r 39e2b2d062c1 -r 493034cc3265 contrib/check-config.py --- a/contrib/check-config.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/check-config.py Thu Jul 18 12:36:12 2024 +0200 @@ -57,7 +57,6 @@ return b return b.decode('utf8') - else: mkstr = lambda x: x diff -r 39e2b2d062c1 -r 493034cc3265 contrib/fuzz/mpatch_corpus.py --- a/contrib/fuzz/mpatch_corpus.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/fuzz/mpatch_corpus.py Thu Jul 18 12:36:12 2024 +0200 @@ -25,7 +25,6 @@ """Py2 calls __repr__ for `bytes(foo)`, forward to __bytes__""" return self.__bytes__() - else: class py2reprhack: diff -r 39e2b2d062c1 -r 493034cc3265 contrib/hgclient.py --- a/contrib/hgclient.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/hgclient.py Thu Jul 18 12:36:12 2024 +0200 @@ -21,7 +21,6 @@ pargs = [re.sub(br'''\bb(['"])''', br'\1', b'%s' % a) for a in args] stdout.write(b' '.join(pargs) + b'\n') - else: import cStringIO diff -r 39e2b2d062c1 -r 493034cc3265 contrib/perf-utils/compare-discovery-case --- a/contrib/perf-utils/compare-discovery-case Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/perf-utils/compare-discovery-case Thu Jul 18 12:36:12 2024 +0200 @@ -205,7 +205,6 @@ if __name__ == '__main__': - argv = sys.argv[:] kwargs = {} diff -r 39e2b2d062c1 -r 493034cc3265 contrib/perf.py --- a/contrib/perf.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/perf.py Thu Jul 18 12:36:12 2024 +0200 @@ -130,7 +130,6 @@ def revlog(opener, *args, **kwargs): return mercurial.revlog.revlog(opener, perf_rl_kind, *args, **kwargs) - except (ImportError, AttributeError): perf_rl_kind = None @@ -261,7 +260,6 @@ commands.norepo += b' %s' % b' '.join(parsealiases(name)) return _command(name, list(options), synopsis) - else: # for "historical portability": # define "@command" annotation locally, because cmdutil.command @@ -1926,7 +1924,7 @@ opts = _byteskwargs(opts) timer, fm = gettimer(ui, opts) - mercurial.revlog._prereadsize = 2 ** 24 # disable lazy parser in old hg + mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg if opts[b'no_lookup']: if opts['rev']: raise error.Abort('--no-lookup and --rev are mutually exclusive') @@ -1985,7 +1983,7 @@ opts = _byteskwargs(opts) timer, fm = gettimer(ui, opts) - mercurial.revlog._prereadsize = 2 ** 24 # disable lazy parser in old hg + mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg unfi = repo.unfiltered() clearcaches = opts[b'clear_caches'] @@ -2389,7 +2387,7 @@ timer, fm = gettimer(ui, opts) import mercurial.revlog - mercurial.revlog._prereadsize = 2 ** 24 # disable lazy parser in old hg + mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg n = scmutil.revsingle(repo, rev).node() try: @@ -3102,7 +3100,7 @@ # disable inlining old_max_inline = mercurial.revlog._maxinline # large enough to never happen - mercurial.revlog._maxinline = 2 ** 50 + mercurial.revlog._maxinline = 2**50 with repo.lock(): bundle = [None, None] diff -r 39e2b2d062c1 -r 493034cc3265 contrib/python-zstandard/tests/test_compressor_fuzzing.py --- a/contrib/python-zstandard/tests/test_compressor_fuzzing.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/python-zstandard/tests/test_compressor_fuzzing.py Thu Jul 18 12:36:12 2024 +0200 @@ -137,7 +137,6 @@ def test_buffer_source_read_variance( self, original, level, source_read_size, read_sizes ): - refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -203,7 +202,6 @@ def test_buffer_source_readinto( self, original, level, source_read_size, read_size ): - refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -273,7 +271,6 @@ def test_buffer_source_readinto_variance( self, original, level, source_read_size, read_sizes ): - refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -410,7 +407,6 @@ def test_buffer_source_read1_variance( self, original, level, source_read_size, read_sizes ): - refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -551,7 +547,6 @@ def test_buffer_source_readinto1_variance( self, original, level, source_read_size, read_sizes ): - refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) diff -r 39e2b2d062c1 -r 493034cc3265 contrib/python-zstandard/tests/test_decompressor.py --- a/contrib/python-zstandard/tests/test_decompressor.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/python-zstandard/tests/test_decompressor.py Thu Jul 18 12:36:12 2024 +0200 @@ -189,7 +189,7 @@ # Will get OverflowError on some Python distributions that can't # handle really large integers. with self.assertRaises((MemoryError, OverflowError)): - dctx.decompress(compressed, max_output_size=2 ** 62) + dctx.decompress(compressed, max_output_size=2**62) def test_dictionary(self): samples = [] @@ -238,7 +238,7 @@ cctx = zstd.ZstdCompressor(write_content_size=False) frame = cctx.compress(source) - dctx = zstd.ZstdDecompressor(max_window_size=2 ** zstd.WINDOWLOG_MIN) + dctx = zstd.ZstdDecompressor(max_window_size=2**zstd.WINDOWLOG_MIN) with self.assertRaisesRegex( zstd.ZstdError, diff -r 39e2b2d062c1 -r 493034cc3265 contrib/python-zstandard/tests/test_decompressor_fuzzing.py --- a/contrib/python-zstandard/tests/test_decompressor_fuzzing.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/python-zstandard/tests/test_decompressor_fuzzing.py Thu Jul 18 12:36:12 2024 +0200 @@ -353,7 +353,6 @@ def test_multiple_frames( self, originals, frame_count, level, source_read_size, read_sizes ): - cctx = zstd.ZstdCompressor(level=level) source = io.BytesIO() buffer = io.BytesIO() diff -r 39e2b2d062c1 -r 493034cc3265 contrib/python-zstandard/zstandard/cffi.py --- a/contrib/python-zstandard/zstandard/cffi.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/python-zstandard/zstandard/cffi.py Thu Jul 18 12:36:12 2024 +0200 @@ -273,7 +273,6 @@ ldm_hash_every_log=-1, threads=0, ): - params = lib.ZSTD_createCCtxParams() if params == ffi.NULL: raise MemoryError() @@ -1423,7 +1422,6 @@ read_size=COMPRESSION_RECOMMENDED_INPUT_SIZE, write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE, ): - if not hasattr(ifh, "read"): raise ValueError("first argument must have a read() method") if not hasattr(ofh, "write"): @@ -1523,7 +1521,6 @@ write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE, write_return_read=False, ): - if not hasattr(writer, "write"): raise ValueError("must pass an object with a write() method") diff -r 39e2b2d062c1 -r 493034cc3265 contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/revsetbenchmarks.py Thu Jul 18 12:36:12 2024 +0200 @@ -191,7 +191,7 @@ def formattiming(value): """format a value to strictly 8 char, dropping some precision if needed""" - if value < 10 ** 7: + if value < 10**7: return ('%.6f' % value)[:8] else: # value is HUGE very unlikely to happen (4+ month run) @@ -371,7 +371,6 @@ print() for ridx, rset in enumerate(revsets): - print("revset #%i: %s" % (ridx, rset)) printheader(variants, len(results), verbose=options.verbose, relative=True) ref = None diff -r 39e2b2d062c1 -r 493034cc3265 contrib/win32/hgwebdir_wsgi.py --- a/contrib/win32/hgwebdir_wsgi.py Thu Jul 18 12:03:29 2024 +0200 +++ b/contrib/win32/hgwebdir_wsgi.py Thu Jul 18 12:36:12 2024 +0200 @@ -101,6 +101,7 @@ import isapi_wsgi from mercurial.hgweb.hgwebdir_mod import hgwebdir + # Example tweak: Replace isapi_wsgi's handler to provide better error message # Other stuff could also be done here, like logging errors etc. class WsgiHandler(isapi_wsgi.IsapiWsgiHandler): @@ -114,7 +115,6 @@ def handler(environ, start_response): - # Translate IIS's weird URLs url = environ['SCRIPT_NAME'] + environ['PATH_INFO'] paths = url[1:].split('/')[path_strip:] diff -r 39e2b2d062c1 -r 493034cc3265 doc/hgmanpage.py --- a/doc/hgmanpage.py Thu Jul 18 12:03:29 2024 +0200 +++ b/doc/hgmanpage.py Thu Jul 18 12:36:12 2024 +0200 @@ -95,7 +95,6 @@ class Writer(writers.Writer): - supported = 'manpage' """Formats this writer supports.""" @@ -297,7 +296,7 @@ (u'´', u"\\'"), (u'`', u'\\(ga'), ] - for (in_char, out_markup) in replace_pairs: + for in_char, out_markup in replace_pairs: text = text.replace(in_char, out_markup) # unicode text = self.deunicode(text) diff -r 39e2b2d062c1 -r 493034cc3265 hgext/acl.py --- a/hgext/acl.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/acl.py Thu Jul 18 12:36:12 2024 +0200 @@ -279,7 +279,6 @@ def _getusers(ui, group): - # First, try to use group definition from section [acl.groups] hgrcusers = ui.configlist(b'acl.groups', group) if hgrcusers: @@ -294,12 +293,10 @@ def _usermatch(ui, user, usersorgroups): - if usersorgroups == b'*': return True for ug in usersorgroups.replace(b',', b' ').split(): - if ug.startswith(b'!'): # Test for excluded user or group. Format: # if ug is a user name: !username @@ -368,7 +365,6 @@ def hook(ui, repo, hooktype, node=None, source=None, **kwargs): - ensureenabled(ui) if hooktype not in [b'pretxnchangegroup', b'pretxncommit', b'prepushkey']: diff -r 39e2b2d062c1 -r 493034cc3265 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/convert/convcmd.py Thu Jul 18 12:36:12 2024 +0200 @@ -76,7 +76,6 @@ authors = {} with open(authorfile, b'rb') as afile: for line in afile: - line = line.strip() if not line or line.startswith(b'#'): continue @@ -273,7 +272,6 @@ class converter: def __init__(self, ui: "uimod.ui", source, dest, revmapfile, opts) -> None: - self.source = source self.dest = dest self.ui = ui diff -r 39e2b2d062c1 -r 493034cc3265 hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/convert/cvsps.py Thu Jul 18 12:36:12 2024 +0200 @@ -639,7 +639,6 @@ files = set() c = None for i, e in enumerate(log): - # Check if log entry belongs to the current changeset or not. # Since CVS is file-centric, two different file revisions with @@ -983,7 +982,6 @@ branches = {} # latest version number in each branch ancestors = {} # parent branch for cs in changesets: - if opts[b"ancestors"]: if cs.branch not in branches and cs.parents and cs.parents[0].id: ancestors[cs.branch] = ( diff -r 39e2b2d062c1 -r 493034cc3265 hgext/convert/subversion.py --- a/hgext/convert/subversion.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/convert/subversion.py Thu Jul 18 12:36:12 2024 +0200 @@ -1425,7 +1425,6 @@ return self.join(b'hg-authormap') def __init__(self, ui, repotype, path): - converter_sink.__init__(self, ui, repotype, path) commandline.__init__(self, ui, b'svn') self.delete = [] diff -r 39e2b2d062c1 -r 493034cc3265 hgext/extdiff.py --- a/hgext/extdiff.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/extdiff.py Thu Jul 18 12:36:12 2024 +0200 @@ -405,7 +405,6 @@ guitool, opts, ): - subrepos = opts.get(b'subrepos') # calculate list of files changed between both revs diff -r 39e2b2d062c1 -r 493034cc3265 hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/fastannotate/context.py Thu Jul 18 12:36:12 2024 +0200 @@ -38,6 +38,7 @@ revmap as revmapmod, ) + # given path, get filelog, cached @util.lrucachefunc def _getflog(repo, path): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/fastannotate/formatter.py --- a/hgext/fastannotate/formatter.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/fastannotate/formatter.py Thu Jul 18 12:36:12 2024 +0200 @@ -17,6 +17,7 @@ ) from mercurial.utils import dateutil + # imitating mercurial.commands.annotate, not using the vanilla formatter since # the data structures are a bit different, and we have some fast paths. class defaultformatter: diff -r 39e2b2d062c1 -r 493034cc3265 hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/fsmonitor/__init__.py Thu Jul 18 12:36:12 2024 +0200 @@ -893,7 +893,6 @@ matcher=None, **kwargs ): - distance = 0 partial = True oldnode = repo[b'.'].node() diff -r 39e2b2d062c1 -r 493034cc3265 hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/fsmonitor/pywatchman/__init__.py Thu Jul 18 12:36:12 2024 +0200 @@ -210,7 +210,6 @@ ) ) - else: def log(fmt, *args): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/fsmonitor/pywatchman/encoding.py --- a/hgext/fsmonitor/pywatchman/encoding.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/fsmonitor/pywatchman/encoding.py Thu Jul 18 12:36:12 2024 +0200 @@ -46,7 +46,6 @@ # returns None. return sys.getfilesystemencoding() - else: # Python 2 doesn't support surrogateescape, so use 'strict' by # default. Users can register a custom surrogateescape error handler and use diff -r 39e2b2d062c1 -r 493034cc3265 hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/highlight/highlight.py Thu Jul 18 12:36:12 2024 +0200 @@ -43,7 +43,6 @@ def pygmentize(field, fctx, style, tmpl, guessfilenameonly=False): - # append a to the syntax highlighting css tmpl.load(b'header') old_header = tmpl.cache[b'header'] diff -r 39e2b2d062c1 -r 493034cc3265 hgext/histedit.py --- a/hgext/histedit.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/histedit.py Thu Jul 18 12:36:12 2024 +0200 @@ -1526,7 +1526,8 @@ def move_cursor(self, oldpos, newpos): """Change the rule/changeset that the cursor is pointing to, regardless of - current mode (you can switch between patches from the view patch window).""" + current mode (you can switch between patches from the view patch window). + """ self.pos = newpos mode, _ = self.mode @@ -1605,7 +1606,8 @@ def change_view(self, delta, unit): """Change the region of whatever is being viewed (a patch or the list of - changesets). 'delta' is an amount (+/- 1) and 'unit' is 'page' or 'line'.""" + changesets). 'delta' is an amount (+/- 1) and 'unit' is 'page' or 'line'. + """ mode, _ = self.mode if mode != MODE_PATCH: return diff -r 39e2b2d062c1 -r 493034cc3265 hgext/journal.py --- a/hgext/journal.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/journal.py Thu Jul 18 12:36:12 2024 +0200 @@ -64,6 +64,7 @@ bookmarktype: hg.sharedbookmarks, } + # Journal recording, register hooks and storage object def extsetup(ui): extensions.wrapfunction(dispatch, 'runcommand', runcommand) diff -r 39e2b2d062c1 -r 493034cc3265 hgext/keyword.py --- a/hgext/keyword.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/keyword.py Thu Jul 18 12:36:12 2024 +0200 @@ -160,6 +160,8 @@ b'svn', default=False, ) + + # date like in cvs' $Date @templatefilter(b'utcdate', intype=templateutil.date) def utcdate(date): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/largefiles/overrides.py Thu Jul 18 12:36:12 2024 +0200 @@ -897,7 +897,7 @@ result += orig(ui, repo, listpats, opts, rename) lfdirstate = lfutil.openlfdirstate(ui, repo) - for (src, dest) in copiedfiles: + for src, dest in copiedfiles: if lfutil.shortname in src and dest.startswith( repo.wjoin(lfutil.shortname) ): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/largefiles/reposetup.py Thu Jul 18 12:36:12 2024 +0200 @@ -140,7 +140,6 @@ wlock = util.nullcontextmanager() gotlock = False with wlock, self.dirstate.running_status(self): - # First check if paths or patterns were specified on the # command line. If there were, and they don't match any # largefiles, we should just bail here and let super diff -r 39e2b2d062c1 -r 493034cc3265 hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/narrow/narrowbundle2.py Thu Jul 18 12:36:12 2024 +0200 @@ -37,6 +37,7 @@ _CSHEADERSIZE = struct.calcsize(_ELIDEDCSHEADER) _MFHEADERSIZE = struct.calcsize(_ELIDEDMFHEADER) + # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow( bundler, diff -r 39e2b2d062c1 -r 493034cc3265 hgext/notify.py --- a/hgext/notify.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/notify.py Thu Jul 18 12:36:12 2024 +0200 @@ -543,7 +543,6 @@ ) def diff(self, ctx, ref=None): - maxdiff = int(self.ui.config(b'notify', b'maxdiff')) prev = ctx.p1().node() if ref: diff -r 39e2b2d062c1 -r 493034cc3265 hgext/patchbomb.py --- a/hgext/patchbomb.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/patchbomb.py Thu Jul 18 12:36:12 2024 +0200 @@ -261,7 +261,6 @@ numbered, patchname=None, ): - desc = [] node = None body = b'' diff -r 39e2b2d062c1 -r 493034cc3265 hgext/rebase.py --- a/hgext/rebase.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/rebase.py Thu Jul 18 12:36:12 2024 +0200 @@ -830,7 +830,6 @@ cleanup = False if cleanup: - if rebased: strippoints = [ c.node() for c in repo.set(b'roots(%ld)', rebased) diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotefilelog/basepack.py --- a/hgext/remotefilelog/basepack.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotefilelog/basepack.py Thu Jul 18 12:36:12 2024 +0200 @@ -45,7 +45,7 @@ # bisect) with (8 step fanout scan + 1 step bisect) # 5 step bisect = log(2^16 / 8 / 255) # fanout # 10 step fanout scan = 2^16 / (2^16 / 8) # fanout space divided by entries -SMALLFANOUTCUTOFF = 2 ** 16 // 8 +SMALLFANOUTCUTOFF = 2**16 // 8 # The amount of time to wait between checking for new packs. This prevents an # exception when data is moved to a new pack after the process has already @@ -275,7 +275,7 @@ class basepack(versionmixin): # The maximum amount we should read via mmap before remmaping so the old # pages can be released (100MB) - MAXPAGEDIN = 100 * 1024 ** 2 + MAXPAGEDIN = 100 * 1024**2 SUPPORTED_VERSIONS = [2] diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotefilelog/connectionpool.py --- a/hgext/remotefilelog/connectionpool.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotefilelog/connectionpool.py Thu Jul 18 12:36:12 2024 +0200 @@ -38,7 +38,6 @@ pass if conn is None: - peer = hg.peer(self._repo.ui, {}, path) if hasattr(peer, '_cleanup'): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotefilelog/datapack.py --- a/hgext/remotefilelog/datapack.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotefilelog/datapack.py Thu Jul 18 12:36:12 2024 +0200 @@ -414,7 +414,7 @@ def add(self, name, node, deltabasenode, delta, metadata=None): # metadata is a dict, ex. {METAKEYFLAG: flag} - if len(name) > 2 ** 16: + if len(name) > 2**16: raise RuntimeError(_(b"name too long %s") % name) if len(node) != 20: raise RuntimeError(_(b"node should be 20 bytes %s") % node) diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotefilelog/remotefilelog.py Thu Jul 18 12:36:12 2024 +0200 @@ -41,7 +41,6 @@ class remotefilelog: - _flagserrorclass = error.RevlogError def __init__(self, opener, path, repo): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotefilelog/shallowrepo.py --- a/hgext/remotefilelog/shallowrepo.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotefilelog/shallowrepo.py Thu Jul 18 12:36:12 2024 +0200 @@ -32,6 +32,7 @@ shallowutil, ) + # These make*stores functions are global so that other extensions can replace # them. def makelocalstores(repo): diff -r 39e2b2d062c1 -r 493034cc3265 hgext/remotenames.py --- a/hgext/remotenames.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/remotenames.py Thu Jul 18 12:36:12 2024 +0200 @@ -259,7 +259,6 @@ def reposetup(ui, repo): - # set the config option to store remotenames repo.ui.setconfig(b'experimental', b'remotenames', True, b'remotenames-ext') diff -r 39e2b2d062c1 -r 493034cc3265 hgext/sqlitestore.py --- a/hgext/sqlitestore.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/sqlitestore.py Thu Jul 18 12:36:12 2024 +0200 @@ -649,7 +649,6 @@ deltamode=deltamode, sidedata_helpers=sidedata_helpers, ): - yield delta # End of ifiledata interface. diff -r 39e2b2d062c1 -r 493034cc3265 hgext/uncommit.py --- a/hgext/uncommit.py Thu Jul 18 12:03:29 2024 +0200 +++ b/hgext/uncommit.py Thu Jul 18 12:36:12 2024 +0200 @@ -154,7 +154,6 @@ cmdutil.resolve_commit_options(ui, opts) with repo.wlock(), repo.lock(): - st = repo.status() m, a, r, d = st.modified, st.added, st.removed, st.deleted isdirtypath = any(set(m + a + r + d) & set(pats)) @@ -264,7 +263,6 @@ unfi = repo.unfiltered() with repo.wlock(), repo.lock(), repo.transaction(b'unamend'): - # identify the commit from which to unamend curctx = repo[b'.'] diff -r 39e2b2d062c1 -r 493034cc3265 i18n/polib.py --- a/i18n/polib.py Thu Jul 18 12:03:29 2024 +0200 +++ b/i18n/polib.py Thu Jul 18 12:36:12 2024 +0200 @@ -64,7 +64,6 @@ def u(s): return unicode(s, "unicode_escape") - else: PY3 = True text_type = str @@ -1889,7 +1888,6 @@ chunks.reverse() while chunks: - # Start the list of chunks that will make up the current line. # cur_len is just the length of all the chunks in cur_line. cur_line = [] diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/ancestor.py --- a/mercurial/ancestor.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/ancestor.py Thu Jul 18 12:36:12 2024 +0200 @@ -88,7 +88,7 @@ depth = [0] * count seen = [0] * count mapping = [] - for (i, n) in enumerate(sorted(nodes)): + for i, n in enumerate(sorted(nodes)): depth[n] = 1 b = 1 << i seen[n] = b diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/bookmarks.py --- a/mercurial/bookmarks.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/bookmarks.py Thu Jul 18 12:36:12 2024 +0200 @@ -685,7 +685,7 @@ remotemarks""" changed = [] localmarks = repo._bookmarks - for (b, id) in remotemarks.items(): + for b, id in remotemarks.items(): if id != localmarks.get(b, None) and id in repo: changed.append((b, id, ui.debug, _(b"updating bookmark %s\n") % b)) for b in localmarks: diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/bundle2.py --- a/mercurial/bundle2.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/bundle2.py Thu Jul 18 12:36:12 2024 +0200 @@ -1286,7 +1286,6 @@ return None def __call__(self): - self.ui.debug( b'bundle2-input-stream-interrupt: opening out of band context\n' ) @@ -2614,7 +2613,6 @@ @parthandler(b'stream2', (b'requirements', b'filecount', b'bytecount')) def handlestreamv2bundle(op, part): - requirements = urlreq.unquote(part.params[b'requirements']) requirements = requirements.split(b',') if requirements else [] filecount = int(part.params[b'filecount']) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/bundlerepo.py Thu Jul 18 12:36:12 2024 +0200 @@ -408,7 +408,7 @@ with os.fdopen(fdtemp, 'wb') as fptemp: fptemp.write(header) while True: - chunk = readfn(2 ** 18) + chunk = readfn(2**18) if not chunk: break fptemp.write(chunk) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/changegroup.py --- a/mercurial/changegroup.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/changegroup.py Thu Jul 18 12:36:12 2024 +0200 @@ -407,7 +407,7 @@ yield chunkheader(len(chunk)) pos = 0 while pos < len(chunk): - next = pos + 2 ** 20 + next = pos + 2**20 yield chunk[pos:next] pos = next yield closechunk() diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/cmdutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -3833,7 +3833,6 @@ original_headers = patch.parsepatch(diff) try: - chunks, opts = recordfilter( repo.ui, original_headers, match, operation=operation ) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/copies.py --- a/mercurial/copies.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/copies.py Thu Jul 18 12:36:12 2024 +0200 @@ -915,11 +915,14 @@ self.movewithdir = {} if movewithdir is None else movewithdir def __repr__(self): - return '' % ( - self.copy, - self.renamedelete, - self.dirmove, - self.movewithdir, + return ( + '' + % ( + self.copy, + self.renamedelete, + self.dirmove, + self.movewithdir, + ) ) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/dirstate.py --- a/mercurial/dirstate.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/dirstate.py Thu Jul 18 12:36:12 2024 +0200 @@ -136,7 +136,6 @@ @interfaceutil.implementer(intdirstate.idirstate) class dirstate: - # used by largefile to avoid overwritting transaction callback _tr_key_suffix = b'' @@ -880,7 +879,6 @@ possibly_dirty=False, parentfiledata=None, ): - # note: I do not think we need to double check name clash here since we # are in a update/merge case that should already have taken care of # this. The test agrees @@ -1092,7 +1090,6 @@ write_key = self._use_tracked_hint and self._dirty_tracked_set if tr: - self._setup_tr_abort(tr) self._attached_to_a_transaction = True @@ -1286,7 +1283,7 @@ badfn(ff, badtype(kind)) if nf in dmap: results[nf] = None - except (OSError) as inst: + except OSError as inst: # nf not found on disk - it is dirstate only if nf in dmap: # does it exactly match a missing file? results[nf] = None diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/dirstatemap.py Thu Jul 18 12:36:12 2024 +0200 @@ -331,7 +331,7 @@ `all` is unused when Rust is not enabled """ - for (filename, item) in self.items(): + for filename, item in self.items(): yield (filename, item.state, item.mode, item.size, item.mtime) def keys(self): @@ -617,7 +617,8 @@ This should also drop associated copy information - The fact we actually need to drop it is the responsability of the caller""" + The fact we actually need to drop it is the responsability of the caller + """ self._map.pop(f, None) self.copymap.pop(f, None) @@ -625,7 +626,6 @@ if rustmod is not None: class dirstatemap(_dirstatemapcommon): - ### Core data storage and access @propertycache diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/encoding.py --- a/mercurial/encoding.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/encoding.py Thu Jul 18 12:36:12 2024 +0200 @@ -367,7 +367,6 @@ cwd = cwd[0:1].upper() + cwd[1:] return cwd - else: getcwd = os.getcwdb # re-exports diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/extensions.py --- a/mercurial/extensions.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/extensions.py Thu Jul 18 12:36:12 2024 +0200 @@ -290,7 +290,7 @@ with util.timedcm('load all extensions') as stats: default_sub_options = ui.configsuboptions(b"extensions", b"*")[1] - for (name, path) in result: + for name, path in result: if path: if path[0:1] == b'!': if name not in _disabledextensions: diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/filelog.py --- a/mercurial/filelog.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/filelog.py Thu Jul 18 12:36:12 2024 +0200 @@ -175,7 +175,6 @@ ) with self._revlog._writing(transaction): - if self._fix_issue6528: deltas = rewrite.filter_delta_issue6528(self._revlog, deltas) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/formatter.py --- a/mercurial/formatter.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/formatter.py Thu Jul 18 12:36:12 2024 +0200 @@ -176,7 +176,6 @@ class baseformatter: - # set to True if the formater output a strict format that does not support # arbitrary output in the stream. strict_format = False @@ -421,7 +420,6 @@ class jsonformatter(baseformatter): - strict_format = True def __init__(self, ui, out, topic, opts): diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/graphmod.py --- a/mercurial/graphmod.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/graphmod.py Thu Jul 18 12:36:12 2024 +0200 @@ -133,8 +133,7 @@ else: getconf = lambda rev: {} - for (cur, type, data, parents) in dag: - + for cur, type, data, parents in dag: # Compute seen and next if cur not in seen: seen.append(cur) # new head @@ -244,7 +243,7 @@ def _fixlongrightedges(edges): - for (i, (start, end)) in enumerate(edges): + for i, (start, end) in enumerate(edges): if end > start: edges[i] = (start, end + 1) @@ -265,7 +264,7 @@ def _drawedges(echars, edges, nodeline, interline): - for (start, end) in edges: + for start, end in edges: if start == end + 1: interline[2 * end + 1] = b"/" elif start == end - 1: @@ -381,7 +380,7 @@ this function can be monkey-patched by extensions to alter graph display without needing to mimic all of the edge-fixup logic in ascii() """ - for (ln, logstr) in graph: + for ln, logstr in graph: ui.write((ln + logstr).rstrip() + b"\n") diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Jul 18 12:36:12 2024 +0200 @@ -120,7 +120,6 @@ seenrepos = set() seendirs = set() for name, path in repos: - if not name.startswith(subdir): continue name = name[len(subdir) :] diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/hgweb/server.py Thu Jul 18 12:36:12 2024 +0200 @@ -66,7 +66,6 @@ class _httprequesthandler(httpservermod.basehttprequesthandler): - url_scheme = b'http' @staticmethod @@ -358,7 +357,6 @@ class MercurialHTTPServer(_mixin, httpservermod.httpserver, object): - # SO_REUSEADDR has broken semantics on windows if pycompat.iswindows: allow_reuse_address = 0 @@ -396,7 +394,6 @@ def create_server(ui, app): - if ui.config(b'web', b'certificate'): handler = _httprequesthandlerssl else: diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/hgweb/webcommands.py Thu Jul 18 12:36:12 2024 +0200 @@ -601,7 +601,6 @@ def dirlist(context): for d in sorted(dirs): - emptydirs = [] h = dirs[d] while isinstance(h, dict) and len(h) == 1: @@ -1427,7 +1426,7 @@ return tree def jsdata(context): - for (id, type, ctx, vtx, edges) in fulltree(): + for id, type, ctx, vtx, edges in fulltree(): yield { b'node': pycompat.bytestr(ctx), b'graphnode': webutil.getgraphnode(web.repo, ctx), diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/httpconnection.py --- a/mercurial/httpconnection.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/httpconnection.py Thu Jul 18 12:36:12 2024 +0200 @@ -25,6 +25,7 @@ urlerr = util.urlerr urlreq = util.urlreq + # moved here from url.py to avoid a cycle class httpsendfile: """This is a wrapper around the objects returned by python's "open". diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/i18n.py --- a/mercurial/i18n.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/i18n.py Thu Jul 18 12:36:12 2024 +0200 @@ -119,6 +119,5 @@ def _(message: bytes) -> bytes: return message - else: _ = gettext diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/linelog.py --- a/mercurial/linelog.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/linelog.py Thu Jul 18 12:36:12 2024 +0200 @@ -53,7 +53,6 @@ class _llinstruction: # pytype: disable=ignored-metaclass - __metaclass__ = abc.ABCMeta @abc.abstractmethod diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/merge.py --- a/mercurial/merge.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/merge.py Thu Jul 18 12:36:12 2024 +0200 @@ -420,11 +420,11 @@ # Track the names of all deleted files. for f in mresult.files((mergestatemod.ACTION_REMOVE,)): deletedfiles.add(f) - for (f, args, msg) in mresult.getactions((mergestatemod.ACTION_MERGE,)): + for f, args, msg in mresult.getactions((mergestatemod.ACTION_MERGE,)): f1, f2, fa, move, anc = args if move: deletedfiles.add(f1) - for (f, args, msg) in mresult.getactions( + for f, args, msg in mresult.getactions( (mergestatemod.ACTION_DIR_RENAME_MOVE_LOCAL,) ): f2, flags = args diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/mergestate.py --- a/mercurial/mergestate.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/mergestate.py Thu Jul 18 12:36:12 2024 +0200 @@ -495,7 +495,6 @@ class mergestate(_mergestate_base): - statepathv1 = b'merge/state' statepathv2 = b'merge/state2' diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/metadata.py --- a/mercurial/metadata.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/metadata.py Thu Jul 18 12:36:12 2024 +0200 @@ -433,14 +433,12 @@ # Iteration over d1 content will deal with all cases, but the one in the # first column of the table. for filename, d1 in diff_p1.items(): - d2 = diff_p2.pop(filename, None) if d2 is None: # this deal with the first line of the table. _process_other_unchanged(md, mas, filename, d1) else: - if d1[0][0] is None and d2[0][0] is None: # case 🄼 — both deleted the file. md.mark_added(filename) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/narrowspec.py --- a/mercurial/narrowspec.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/narrowspec.py Thu Jul 18 12:36:12 2024 +0200 @@ -225,7 +225,6 @@ m = "changing narrow spec outside of a transaction" raise error.ProgrammingError(m) else: - reporef = weakref.ref(repo) def clean_pending(tr): diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/obsolete.py --- a/mercurial/obsolete.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/obsolete.py Thu Jul 18 12:36:12 2024 +0200 @@ -1038,7 +1038,6 @@ def makefoldid(relation, user): - folddigest = hashutil.sha1(user) for p in relation[0] + relation[1]: folddigest.update(b'%d' % p.rev()) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/obsutil.py --- a/mercurial/obsutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/obsutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -961,7 +961,6 @@ single_successor = short(successors[0][0]) return filteredmsgtable[b'superseded'] % (changeid, single_successor) elif fate == b'superseded_split': - succs = [] for node_id in successors[0]: succs.append(short(node_id)) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/patch.py --- a/mercurial/patch.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/patch.py Thu Jul 18 12:36:12 2024 +0200 @@ -229,7 +229,6 @@ def _extract(ui, fileobj, tmpname, tmpfp): - # attempt to detect the start of a patch # (this heuristic is borrowed from quilt) diffre = re.compile( @@ -596,7 +595,7 @@ self.created = 0 self.maxsize = maxsize if self.maxsize is None: - self.maxsize = 4 * (2 ** 20) + self.maxsize = 4 * (2**20) self.size = 0 self.data = {} diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/phases.py --- a/mercurial/phases.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/phases.py Thu Jul 18 12:36:12 2024 +0200 @@ -893,7 +893,6 @@ this_phase_set = self._phasesets[targetphase] for r in range(start, end): - # gather information about the current_rev r_phase = phase(repo, r) p_phase = None # phase inherited from parents diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/pure/parsers.py Thu Jul 18 12:36:12 2024 +0200 @@ -911,7 +911,6 @@ ) def _pack_entry(self, rev, entry): - base = entry[revlog_constants.ENTRY_DELTA_BASE] link_rev = entry[revlog_constants.ENTRY_LINK_REV] assert base == rev, (base, rev) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/revlog.py --- a/mercurial/revlog.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/revlog.py Thu Jul 18 12:36:12 2024 +0200 @@ -226,7 +226,6 @@ index, cache = parsers.parse_index_devel_nodemap(data, inline) return index, cache - else: parse_index_v1_nodemap = None diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/revlogutils/deltas.py Thu Jul 18 12:36:12 2024 +0200 @@ -428,7 +428,6 @@ # Cut the revs at collected indices previdx = 0 for idx in selected: - chunk = _trimchunk(revlog, revs, previdx, idx) if chunk: yield chunk diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/revlogutils/nodemap.py Thu Jul 18 12:36:12 2024 +0200 @@ -553,7 +553,7 @@ Children blocks are always yield before their parent block. """ - for (__, item) in sorted(block.items()): + for __, item in sorted(block.items()): if isinstance(item, dict): for sub_block in _walk_trie(item): yield sub_block diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/revlogutils/rewrite.py --- a/mercurial/revlogutils/rewrite.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/revlogutils/rewrite.py Thu Jul 18 12:36:12 2024 +0200 @@ -258,7 +258,6 @@ # this revision is empty, we can delta against nullrev rewritten_entries[rev] = (nullrev, 0, 0, COMP_MODE_PLAIN) else: - text = revlog.rawdata(rev) info = revlogutils.revisioninfo( node=entry[ENTRY_NODE_ID], diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/scmutil.py --- a/mercurial/scmutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/scmutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -730,7 +730,6 @@ This is extracted in a function to help extensions (eg: evolve) to experiment with various message variants.""" if repo.filtername.startswith(b'visible'): - # Check if the changeset is obsolete unfilteredrepo = repo.unfiltered() ctx = revsymbol(unfilteredrepo, changeid) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/setdiscovery.py Thu Jul 18 12:36:12 2024 +0200 @@ -190,7 +190,6 @@ return getparents def _childrengetter(self): - if self._childrenmap is not None: # During discovery, the `undecided` set keep shrinking. # Therefore, the map computed for an iteration N will be @@ -454,7 +453,6 @@ full = not initial_head_exchange progress = ui.makeprogress(_(b'searching'), unit=_(b'queries')) while not disco.iscomplete(): - if full or disco.hasinfo(): if full: ui.note(_(b"sampling from both directions\n")) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/similar.py --- a/mercurial/similar.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/similar.py Thu Jul 18 12:36:12 2024 +0200 @@ -118,14 +118,14 @@ # Find exact matches. matchedfiles = set() - for (a, b) in _findexactmatches(repo, addedfiles, removedfiles): + for a, b in _findexactmatches(repo, addedfiles, removedfiles): matchedfiles.add(b) yield (a.path(), b.path(), 1.0) # If the user requested similar files to be matched, search for them also. if threshold < 1.0: addedfiles = [x for x in addedfiles if x not in matchedfiles] - for (a, b, score) in _findsimilarmatches( + for a, b, score in _findsimilarmatches( repo, addedfiles, removedfiles, threshold ): yield (a.path(), b.path(), score) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/sslutil.py --- a/mercurial/sslutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/sslutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -497,7 +497,6 @@ ) elif e.reason == 'CERTIFICATE_VERIFY_FAILED' and pycompat.iswindows: - ui.warn( _( b'(the full certificate chain may not be available ' diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/store.py --- a/mercurial/store.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/store.py Thu Jul 18 12:36:12 2024 +0200 @@ -37,7 +37,7 @@ parsers = policy.importmod('parsers') # how much bytes should be read from fncache in one read # It is done to prevent loading large fncache files into memory -fncache_chunksize = 10 ** 6 +fncache_chunksize = 10**6 def _match_tracked_entry(entry, matcher): diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/streamclone.py --- a/mercurial/streamclone.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/streamclone.py Thu Jul 18 12:36:12 2024 +0200 @@ -547,6 +547,7 @@ _srcstore = b's' # store (svfs) _srccache = b'c' # cache (cache) + # This is it's own function so extensions can override it. def _walkstreamfullstorefiles(repo): """list snapshot file from the store""" @@ -809,7 +810,6 @@ """ with repo.lock(): - repo.ui.debug(b'scanning\n') entries = _entries_walk( @@ -857,7 +857,6 @@ # considering the files to preserve, disabling the gc while we do so helps # performance a lot. with repo.lock(), util.nogc(): - repo.ui.debug(b'scanning\n') entries = _entries_walk( @@ -990,7 +989,6 @@ with repo.transaction(b'clone'): ctxs = (vfs.backgroundclosing(repo.ui) for vfs in vfsmap.values()) with nested(*ctxs): - for i in range(entrycount): filecount = util.uvarintdecodestream(fp) if filecount == 0: @@ -1123,7 +1121,6 @@ with dest_repo.lock(): with src_repo.lock(): - # bookmark is not integrated to the streaming as it might use the # `repo.vfs` and they are too many sentitive data accessible # through `repo.vfs` to expose it to streaming clone. diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/strip.py --- a/mercurial/strip.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/strip.py Thu Jul 18 12:36:12 2024 +0200 @@ -63,7 +63,6 @@ soft=False, ): with repo.wlock(), repo.lock(): - if update: checklocalchanges(repo, force=force) urev = _findupdatetarget(repo, revs) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/subrepo.py --- a/mercurial/subrepo.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/subrepo.py Thu Jul 18 12:36:12 2024 +0200 @@ -1227,16 +1227,12 @@ externals.append(path) elif item == 'missing': missing.append(path) - if ( - item - not in ( - '', - 'normal', - 'unversioned', - 'external', - ) - or props not in ('', 'none', 'normal') - ): + if item not in ( + '', + 'normal', + 'unversioned', + 'external', + ) or props not in ('', 'none', 'normal'): changes.append(path) for path in changes: for ext in externals: diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/tags.py --- a/mercurial/tags.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/tags.py Thu Jul 18 12:36:12 2024 +0200 @@ -601,7 +601,7 @@ # we keep them in UTF-8 throughout this module. If we converted # them local encoding on input, we would lose info writing them to # the cache. - for (name, (node, hist)) in sorted(cachetags.items()): + for name, (node, hist) in sorted(cachetags.items()): for n in hist: cachefile.write(b"%s %s\n" % (hex(n), name)) cachefile.write(b"%s %s\n" % (hex(node), name)) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/upgrade.py --- a/mercurial/upgrade.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/upgrade.py Thu Jul 18 12:36:12 2024 +0200 @@ -194,7 +194,6 @@ onlydefault.append(d) if fromconfig or onlydefault: - if fromconfig: ui.status( _( diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/urllibcompat.py --- a/mercurial/urllibcompat.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/urllibcompat.py Thu Jul 18 12:36:12 2024 +0200 @@ -109,6 +109,7 @@ ), ) + # urllib.parse.quote() accepts both str and bytes, decodes bytes # (if necessary), and returns str. This is wonky. We provide a custom # implementation that only accepts bytes and emits bytes. diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/util.py --- a/mercurial/util.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/util.py Thu Jul 18 12:36:12 2024 +0200 @@ -1328,7 +1328,7 @@ self[k] = f[k] def insert(self, position, key, value): - for (i, (k, v)) in enumerate(list(self.items())): + for i, (k, v) in enumerate(list(self.items())): if i == position: self[key] = value if i >= position: @@ -2724,10 +2724,10 @@ def splitbig(chunks): for chunk in chunks: - if len(chunk) > 2 ** 20: + if len(chunk) > 2**20: pos = 0 while pos < len(chunk): - end = pos + 2 ** 18 + end = pos + 2**18 yield chunk[pos:end] pos = end else: @@ -2751,7 +2751,7 @@ while left > 0: # refill the queue if not queue: - target = 2 ** 18 + target = 2**18 for chunk in self.iter: queue.append(chunk) target -= len(chunk) @@ -3081,12 +3081,12 @@ _sizeunits = ( - (b'm', 2 ** 20), - (b'k', 2 ** 10), - (b'g', 2 ** 30), - (b'kb', 2 ** 10), - (b'mb', 2 ** 20), - (b'gb', 2 ** 30), + (b'm', 2**20), + (b'k', 2**10), + (b'g', 2**30), + (b'kb', 2**10), + (b'mb', 2**20), + (b'gb', 2**30), (b'b', 1), ) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/utils/compression.py --- a/mercurial/utils/compression.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/utils/compression.py Thu Jul 18 12:36:12 2024 +0200 @@ -511,7 +511,7 @@ parts = [] pos = 0 while pos < insize: - pos2 = pos + 2 ** 20 + pos2 = pos + 2**20 parts.append(z.compress(data[pos:pos2])) pos = pos2 parts.append(z.flush()) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/utils/procutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -711,7 +711,6 @@ if stdin is not None: stdin.close() - else: def runbgcommand( diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/utils/resourceutil.py --- a/mercurial/utils/resourceutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/utils/resourceutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -52,7 +52,6 @@ assert dirs[0] == b"mercurial" return os.path.join(_rootpath, *dirs[1:]) - else: datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__))) _rootpath = os.path.dirname(datapath) @@ -98,7 +97,6 @@ for p in os.listdir(path): yield pycompat.fsencode(p) - else: from .. import encoding diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/utils/stringutil.py Thu Jul 18 12:36:12 2024 +0200 @@ -574,7 +574,6 @@ return mailmap for line in mailmapcontent.splitlines(): - # Don't bother checking the line if it is a comment or # is an improperly formed author field if line.lstrip().startswith(b'#'): @@ -801,7 +800,6 @@ chunks.reverse() while chunks: - # Start the list of chunks that will make up the current line. # cur_len is just the length of all the chunks in cur_line. cur_line = [] diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/win32.py --- a/mercurial/win32.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/win32.py Thu Jul 18 12:36:12 2024 +0200 @@ -172,6 +172,7 @@ X509_ASN_ENCODING = 0x00000001 PKCS_7_ASN_ENCODING = 0x00010000 + # These structs are only complete enough to achieve what we need. class CERT_CHAIN_CONTEXT(ctypes.Structure): _fields_ = ( @@ -368,7 +369,7 @@ # See https://bugs.python.org/issue28474 code = _kernel32.GetLastError() if code > 0x7FFFFFFF: - code -= 2 ** 32 + code -= 2**32 err = ctypes.WinError(code=code) # pytype: disable=module-attr raise OSError( err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) diff -r 39e2b2d062c1 -r 493034cc3265 mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py Thu Jul 18 12:03:29 2024 +0200 +++ b/mercurial/wireprotoframing.py Thu Jul 18 12:36:12 2024 +0200 @@ -546,7 +546,7 @@ """ atomdicts = [] - for (formatting, args, labels) in atoms: + for formatting, args, labels in atoms: # TODO look for localstr, other types here? if not isinstance(formatting, bytes): @@ -1198,7 +1198,6 @@ b'%s' % stringutil.forcebytestr(e), errtype=b'server', ): - yield frame break @@ -1259,7 +1258,6 @@ for chunk in cborutil.streamencodebytestringfromiter( o.chunks ): - for frame in emitter.send(chunk): yield frame diff -r 39e2b2d062c1 -r 493034cc3265 setup.py --- a/setup.py Thu Jul 18 12:03:29 2024 +0200 +++ b/setup.py Thu Jul 18 12:36:12 2024 +0200 @@ -463,7 +463,6 @@ class hgbuildmo(build): - description = "build translations (.mo files)" def run(self): @@ -1056,7 +1055,6 @@ class hginstall(install): - user_options = install.user_options + [ ( 'old-and-unmanageable', diff -r 39e2b2d062c1 -r 493034cc3265 tests/dumbhttp.py --- a/tests/dumbhttp.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/dumbhttp.py Thu Jul 18 12:36:12 2024 +0200 @@ -26,7 +26,6 @@ class simplehttpserver(httpserver.httpserver): address_family = socket.AF_INET6 - else: simplehttpserver = httpserver.httpserver diff -r 39e2b2d062c1 -r 493034cc3265 tests/fsmonitor-run-tests.py --- a/tests/fsmonitor-run-tests.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/fsmonitor-run-tests.py Thu Jul 18 12:36:12 2024 +0200 @@ -30,7 +30,6 @@ def _sys2bytes(p): return p.encode('utf-8') - elif sys.version_info >= (3, 0, 0): print( '%s is only supported on Python 3.5+ and 2.7, not %s' diff -r 39e2b2d062c1 -r 493034cc3265 tests/generate-working-copy-states.py --- a/tests/generate-working-copy-states.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/generate-working-copy-states.py Thu Jul 18 12:36:12 2024 +0200 @@ -33,6 +33,7 @@ import os import sys + # Generates pairs of (filename, contents), where 'contents' is a list # describing the file's content at each revision (or in the working copy). # At each revision, it is either None or the file's actual content. When not diff -r 39e2b2d062c1 -r 493034cc3265 tests/killdaemons.py --- a/tests/killdaemons.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/killdaemons.py Thu Jul 18 12:36:12 2024 +0200 @@ -75,7 +75,6 @@ raise _check(ctypes.windll.kernel32.CloseHandle(handle)) - else: def kill(pid, logfn, tryhard=True): diff -r 39e2b2d062c1 -r 493034cc3265 tests/mockblackbox.py --- a/tests/mockblackbox.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/mockblackbox.py Thu Jul 18 12:36:12 2024 +0200 @@ -1,5 +1,6 @@ from mercurial.utils import procutil + # XXX: we should probably offer a devel option to do this in blackbox directly def getuser(): return b'bob' diff -r 39e2b2d062c1 -r 493034cc3265 tests/run-tests.py --- a/tests/run-tests.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/run-tests.py Thu Jul 18 12:36:12 2024 +0200 @@ -223,6 +223,7 @@ # For Windows support wifexited = getattr(os, "WIFEXITED", lambda x: False) + # Whether to use IPv6 def checksocketfamily(name, port=20058): """return true if we can listen on localhost using family=name @@ -3397,7 +3398,6 @@ os.path.basename(t).startswith(b'test-') and (t.endswith(b'.py') or t.endswith(b'.t')) ): - m = testcasepattern.match(os.path.basename(t)) if m is not None: t_basename, casestr = m.groups() diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-ancestor.py --- a/tests/test-ancestor.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-ancestor.py Thu Jul 18 12:36:12 2024 +0200 @@ -87,6 +87,7 @@ testcount = 10 inccount = 10 nerrs = [0] + # the default mu and sigma give us a nice distribution of mostly # single-digit counts (including 0) with some higher ones def lognormrandom(mu, sigma): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-batching.py --- a/tests/test-batching.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-batching.py Thu Jul 18 12:36:12 2024 +0200 @@ -55,7 +55,6 @@ # usage of "thing" interface def use(it): - # Direct call to base method shared between client and server. bprint(it.hello()) @@ -106,6 +105,7 @@ # server side + # equivalent of wireproto's global functions class server: def __init__(self, local): @@ -156,6 +156,7 @@ # local side + # equivalent of wireproto.encode/decodelist, that is, type-specific marshalling # here we just transform the strings a bit to check we're properly en-/decoding def mangle(s): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-cbor.py --- a/tests/test-cbor.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-cbor.py Thu Jul 18 12:36:12 2024 +0200 @@ -216,11 +216,11 @@ for size in lens: if size < 24: hlen = 1 - elif size < 2 ** 8: + elif size < 2**8: hlen = 2 - elif size < 2 ** 16: + elif size < 2**16: hlen = 3 - elif size < 2 ** 32: + elif size < 2**32: hlen = 5 else: assert False @@ -487,7 +487,7 @@ ) def testdecodepartialushort(self): - encoded = b''.join(cborutil.streamencode(2 ** 15)) + encoded = b''.join(cborutil.streamencode(2**15)) self.assertEqual( cborutil.decodeitem(encoded[0:1]), @@ -499,7 +499,7 @@ ) self.assertEqual( cborutil.decodeitem(encoded[0:5]), - (True, 2 ** 15, 3, cborutil.SPECIAL_NONE), + (True, 2**15, 3, cborutil.SPECIAL_NONE), ) def testdecodepartialshort(self): @@ -519,7 +519,7 @@ ) def testdecodepartialulong(self): - encoded = b''.join(cborutil.streamencode(2 ** 28)) + encoded = b''.join(cborutil.streamencode(2**28)) self.assertEqual( cborutil.decodeitem(encoded[0:1]), @@ -539,7 +539,7 @@ ) self.assertEqual( cborutil.decodeitem(encoded[0:5]), - (True, 2 ** 28, 5, cborutil.SPECIAL_NONE), + (True, 2**28, 5, cborutil.SPECIAL_NONE), ) def testdecodepartiallong(self): @@ -567,7 +567,7 @@ ) def testdecodepartialulonglong(self): - encoded = b''.join(cborutil.streamencode(2 ** 32)) + encoded = b''.join(cborutil.streamencode(2**32)) self.assertEqual( cborutil.decodeitem(encoded[0:1]), @@ -603,7 +603,7 @@ ) self.assertEqual( cborutil.decodeitem(encoded[0:9]), - (True, 2 ** 32, 9, cborutil.SPECIAL_NONE), + (True, 2**32, 9, cborutil.SPECIAL_NONE), ) with self.assertRaisesRegex( diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-config-env.py --- a/tests/test-config-env.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-config-env.py Thu Jul 18 12:36:12 2024 +0200 @@ -15,6 +15,7 @@ testtmp = encoding.environ[b'TESTTMP'] + # prepare hgrc files def join(name): return os.path.join(testtmp, name) @@ -26,6 +27,7 @@ with open(join(b'userrc'), 'wb') as f: f.write(b'[ui]\neditor=e1') + # replace rcpath functions so they point to the files above def systemrcpath(): return [join(b'sysrc')] @@ -40,6 +42,7 @@ rcutil.systemrcpath = systemrcpath rcutil.userrcpath = userrcpath + # utility to print configs def printconfigs(env): encoding.environ = env diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-extensions-wrapfunction.py --- a/tests/test-extensions-wrapfunction.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-extensions-wrapfunction.py Thu Jul 18 12:36:12 2024 +0200 @@ -66,6 +66,7 @@ print('context manager', dummy.getstack()) print('context manager', dummy.getstack()) + # Wrap callable object which has no __name__ class callableobj: def __call__(self): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-hg-parseurl.py --- a/tests/test-hg-parseurl.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-hg-parseurl.py Thu Jul 18 12:36:12 2024 +0200 @@ -5,7 +5,6 @@ class ParseRequestTests(unittest.TestCase): def testparse(self): - self.assertEqual( urlutil.parseurl(b'http://example.com/no/anchor'), (b'http://example.com/no/anchor', (None, [])), diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-hybridencode.py --- a/tests/test-hybridencode.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-hybridencode.py Thu Jul 18 12:36:12 2024 +0200 @@ -5,7 +5,6 @@ class hybridencodetests(unittest.TestCase): def hybridencode(self, input, want): - # Check the C implementation if it's in use got = store._pathencode(input) self.assertEqual(want, got) diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-parseindex2.py --- a/tests/test-parseindex2.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-parseindex2.py Thu Jul 18 12:36:12 2024 +0200 @@ -26,6 +26,7 @@ parsers = policy.importmod('parsers') + # original python implementation def gettype(q): return int(q & 0xFFFF) diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-remotefilelog-datapack.py --- a/tests/test-remotefilelog-datapack.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-remotefilelog-datapack.py Thu Jul 18 12:36:12 2024 +0200 @@ -186,7 +186,7 @@ content = b'put-something-here \n' * i node = self.getHash(content) meta = { - constants.METAKEYFLAG: i ** 4, + constants.METAKEYFLAG: i**4, constants.METAKEYSIZE: len(content), b'Z': b'random_string', b'_': b'\0' * i, diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-remotefilelog-histpack.py --- a/tests/test-remotefilelog-histpack.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-remotefilelog-histpack.py Thu Jul 18 12:36:12 2024 +0200 @@ -177,7 +177,7 @@ pack = self.createPack(revisions) # Verify the pack contents - for (filename, node) in allentries: + for filename, node in allentries: ancestors = pack.getancestors(filename, node) self.assertEqual(ancestorcounts[(filename, node)], len(ancestors)) for anode, (ap1, ap2, alinknode, copyfrom) in ancestors.items(): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-revlog-raw.py --- a/tests/test-revlog-raw.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-revlog-raw.py Thu Jul 18 12:36:12 2024 +0200 @@ -246,7 +246,7 @@ That is to say, given any x, y where both x, and y are in range(2 ** n), there is an x followed immediately by y in the generated sequence. """ - m = 2 ** n + m = 2**n # Gray Code. See https://en.wikipedia.org/wiki/Gray_code gray = lambda x: x ^ (x >> 1) diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-simplemerge.py --- a/tests/test-simplemerge.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-simplemerge.py Thu Jul 18 12:36:12 2024 +0200 @@ -24,6 +24,8 @@ from mercurial.utils import stringutil TestCase = unittest.TestCase + + # bzr compatible interface, for the tests class Merge3(simplemerge.Merge3Text): """3-way merge of texts. diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-symlink-os-yes-fs-no.py --- a/tests/test-symlink-os-yes-fs-no.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-symlink-os-yes-fs-no.py Thu Jul 18 12:36:12 2024 +0200 @@ -30,6 +30,7 @@ time.sleep(1) commands.status(u, repo) + # now disable symlink support -- this is what os.symlink would do on a # non-symlink file system def symlink_failure(src, dst): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-ui-color.py --- a/tests/test-ui-color.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-ui-color.py Thu Jul 18 12:36:12 2024 +0200 @@ -25,6 +25,7 @@ # we're not interested in the output, so write that to devnull ui_.fout = open(os.devnull, 'wb') + # call some arbitrary command just so we go through # color's wrapped _runcommand twice. def runcmd(): diff -r 39e2b2d062c1 -r 493034cc3265 tests/test-verify-repo-operations.py --- a/tests/test-verify-repo-operations.py Thu Jul 18 12:03:29 2024 +0200 +++ b/tests/test-verify-repo-operations.py Thu Jul 18 12:36:12 2024 +0200 @@ -615,8 +615,8 @@ settings( timeout=-1, stateful_step_count=1000, - max_examples=10 ** 8, - max_iterations=10 ** 8, + max_examples=10**8, + max_iterations=10**8, database=writeonlydatabase(settings.default.database), ), )