# HG changeset patch # User Raphaël Gomès # Date 1721721766 -7200 # Node ID 7f0cb9ee0534b86b07593444fcd7f504dcf96e87 # Parent bd1483fd70884a1e272b07f01086d6ea58374afb Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse. diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/automation/hgautomation/cli.py --- a/contrib/automation/hgautomation/cli.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/automation/hgautomation/cli.py Tue Jul 23 10:02:46 2024 +0200 @@ -201,6 +201,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/check-config.py --- a/contrib/check-config.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/check-config.py Tue Jul 23 10:02:46 2024 +0200 @@ -57,6 +57,7 @@ return b return b.decode('utf8') + else: mkstr = lambda x: x diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/fuzz/mpatch_corpus.py --- a/contrib/fuzz/mpatch_corpus.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/fuzz/mpatch_corpus.py Tue Jul 23 10:02:46 2024 +0200 @@ -25,6 +25,7 @@ """Py2 calls __repr__ for `bytes(foo)`, forward to __bytes__""" return self.__bytes__() + else: class py2reprhack: diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/heptapod-ci.yml Tue Jul 23 10:02:46 2024 +0200 @@ -22,7 +22,7 @@ stages: - tests -image: registry.heptapod.net/mercurial/ci-images/mercurial-core@sha256:dc95edf69e2f9baee0eba74a92514b0d6852b98aba48495831a81a495f58c1e7 +image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG variables: PYTHON: python @@ -39,16 +39,15 @@ # The runner made a clone as root. # We make a new clone owned by user used to run the step. before_script: - - export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH" - - echo "python used, $PYTHON" - - $PYTHON --version - - black --version - - clang-format --version - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'` - cd /tmp/mercurial-ci/ - ls -1 tests/test-check-*.* > /tmp/check-tests.txt + - black --version + - clang-format --version script: + - echo "python used, $PYTHON" + - $PYTHON --version - echo "$RUNTEST_ARGS" - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS @@ -56,22 +55,25 @@ <<: *runtests variables: RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt" - PYTHON: python + PYTHON: python3 CI_CLEVER_CLOUD_FLAVOR: S rust-cargo-test: <<: *all stage: tests script: + - echo "python used, $PYTHON" - make rust-tests - make cargo-clippy variables: + PYTHON: python3 CI_CLEVER_CLOUD_FLAVOR: S test-c: <<: *runtests variables: RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt" + PYTHON: python3 TEST_HGMODULEPOLICY: "c" TEST_HGTESTS_ALLOW_NETIO: "1" @@ -79,6 +81,7 @@ <<: *runtests variables: RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt" + PYTHON: python3 TEST_HGMODULEPOLICY: "py" test-rust: @@ -86,7 +89,7 @@ variables: HGWITHRUSTEXT: cpython RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt" - PYTHON: python + PYTHON: python3 TEST_HGMODULEPOLICY: "rust+c" test-rhg: @@ -94,27 +97,30 @@ variables: HGWITHRUSTEXT: cpython RUNTEST_ARGS: "--rust --rhg --blacklist /tmp/check-tests.txt" + PYTHON: python3 TEST_HGMODULEPOLICY: "rust+c" test-chg: <<: *runtests variables: + PYTHON: python3 RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg" TEST_HGMODULEPOLICY: "c" check-pytype: extends: .runtests_template before_script: - - export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH" - - echo "PATH, $PATH" - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'` - cd /tmp/mercurial-ci/ - make local PYTHON=$PYTHON + - $PYTHON -m pip install --user -U libcst==0.3.20 pytype==2022.11.18 - ./contrib/setup-pytype.sh script: - echo "Entering script section" - sh contrib/check-pytype.sh + variables: + PYTHON: python3 # `sh.exe --login` sets a couple of extra environment variables that are defined # in the MinGW shell, but switches CWD to /home/$username. The previous value diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/hgclient.py --- a/contrib/hgclient.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/hgclient.py Tue Jul 23 10:02:46 2024 +0200 @@ -21,6 +21,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/perf-utils/compare-discovery-case --- a/contrib/perf-utils/compare-discovery-case Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/perf-utils/compare-discovery-case Tue Jul 23 10:02:46 2024 +0200 @@ -205,6 +205,7 @@ if __name__ == '__main__': + argv = sys.argv[:] kwargs = {} diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/perf.py --- a/contrib/perf.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/perf.py Tue Jul 23 10:02:46 2024 +0200 @@ -130,6 +130,7 @@ def revlog(opener, *args, **kwargs): return mercurial.revlog.revlog(opener, perf_rl_kind, *args, **kwargs) + except (ImportError, AttributeError): perf_rl_kind = None @@ -260,6 +261,7 @@ 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 @@ -1924,7 +1926,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') @@ -1983,7 +1985,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'] @@ -2387,7 +2389,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: @@ -3100,7 +3102,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 bd1483fd7088 -r 7f0cb9ee0534 contrib/python-zstandard/tests/test_compressor_fuzzing.py --- a/contrib/python-zstandard/tests/test_compressor_fuzzing.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/python-zstandard/tests/test_compressor_fuzzing.py Tue Jul 23 10:02:46 2024 +0200 @@ -137,6 +137,7 @@ def test_buffer_source_read_variance( self, original, level, source_read_size, read_sizes ): + refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -202,6 +203,7 @@ def test_buffer_source_readinto( self, original, level, source_read_size, read_size ): + refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -271,6 +273,7 @@ def test_buffer_source_readinto_variance( self, original, level, source_read_size, read_sizes ): + refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -407,6 +410,7 @@ def test_buffer_source_read1_variance( self, original, level, source_read_size, read_sizes ): + refctx = zstd.ZstdCompressor(level=level) ref_frame = refctx.compress(original) @@ -547,6 +551,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/python-zstandard/tests/test_decompressor.py --- a/contrib/python-zstandard/tests/test_decompressor.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/python-zstandard/tests/test_decompressor.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/python-zstandard/tests/test_decompressor_fuzzing.py --- a/contrib/python-zstandard/tests/test_decompressor_fuzzing.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/python-zstandard/tests/test_decompressor_fuzzing.py Tue Jul 23 10:02:46 2024 +0200 @@ -353,6 +353,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/python-zstandard/zstandard/cffi.py --- a/contrib/python-zstandard/zstandard/cffi.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/python-zstandard/zstandard/cffi.py Tue Jul 23 10:02:46 2024 +0200 @@ -273,6 +273,7 @@ ldm_hash_every_log=-1, threads=0, ): + params = lib.ZSTD_createCCtxParams() if params == ffi.NULL: raise MemoryError() @@ -1422,6 +1423,7 @@ 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"): @@ -1521,6 +1523,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/revsetbenchmarks.py Tue Jul 23 10:02:46 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,6 +371,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 contrib/setup-pytype.sh --- a/contrib/setup-pytype.sh Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/setup-pytype.sh Tue Jul 23 10:02:46 2024 +0200 @@ -5,7 +5,7 @@ # Find the python3 setup that would run pytype PYTYPE=`which pytype` -PYTHON3=${PYTHON:-`head -n1 ${PYTYPE} | sed -s 's/#!//'`} +PYTHON3=`head -n1 ${PYTYPE} | sed -s 's/#!//'` # Existing stubs that pytype processes live here TYPESHED=$(${PYTHON3} -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs diff -r bd1483fd7088 -r 7f0cb9ee0534 contrib/win32/hgwebdir_wsgi.py --- a/contrib/win32/hgwebdir_wsgi.py Mon Jul 22 16:49:38 2024 +0200 +++ b/contrib/win32/hgwebdir_wsgi.py Tue Jul 23 10:02:46 2024 +0200 @@ -101,7 +101,6 @@ 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): @@ -115,6 +114,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 doc/hgmanpage.py --- a/doc/hgmanpage.py Mon Jul 22 16:49:38 2024 +0200 +++ b/doc/hgmanpage.py Tue Jul 23 10:02:46 2024 +0200 @@ -95,6 +95,7 @@ class Writer(writers.Writer): + supported = 'manpage' """Formats this writer supports.""" @@ -296,7 +297,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 bd1483fd7088 -r 7f0cb9ee0534 hgext/acl.py --- a/hgext/acl.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/acl.py Tue Jul 23 10:02:46 2024 +0200 @@ -279,6 +279,7 @@ def _getusers(ui, group): + # First, try to use group definition from section [acl.groups] hgrcusers = ui.configlist(b'acl.groups', group) if hgrcusers: @@ -293,10 +294,12 @@ 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 @@ -365,6 +368,7 @@ def hook(ui, repo, hooktype, node=None, source=None, **kwargs): + ensureenabled(ui) if hooktype not in [b'pretxnchangegroup', b'pretxncommit', b'prepushkey']: diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/convert/convcmd.py Tue Jul 23 10:02:46 2024 +0200 @@ -76,6 +76,7 @@ authors = {} with open(authorfile, b'rb') as afile: for line in afile: + line = line.strip() if not line or line.startswith(b'#'): continue @@ -272,6 +273,7 @@ class converter: def __init__(self, ui: "uimod.ui", source, dest, revmapfile, opts) -> None: + self.source = source self.dest = dest self.ui = ui diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/convert/cvsps.py Tue Jul 23 10:02:46 2024 +0200 @@ -639,6 +639,7 @@ 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 @@ -982,6 +983,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/convert/subversion.py --- a/hgext/convert/subversion.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/convert/subversion.py Tue Jul 23 10:02:46 2024 +0200 @@ -1425,6 +1425,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/extdiff.py --- a/hgext/extdiff.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/extdiff.py Tue Jul 23 10:02:46 2024 +0200 @@ -405,6 +405,7 @@ guitool, opts, ): + subrepos = opts.get(b'subrepos') # calculate list of files changed between both revs diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/fastannotate/context.py Tue Jul 23 10:02:46 2024 +0200 @@ -38,7 +38,6 @@ revmap as revmapmod, ) - # given path, get filelog, cached @util.lrucachefunc def _getflog(repo, path): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/fastannotate/formatter.py --- a/hgext/fastannotate/formatter.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/fastannotate/formatter.py Tue Jul 23 10:02:46 2024 +0200 @@ -17,7 +17,6 @@ ) 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/fsmonitor/__init__.py Tue Jul 23 10:02:46 2024 +0200 @@ -893,6 +893,7 @@ matcher=None, **kwargs ): + distance = 0 partial = True oldnode = repo[b'.'].node() diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/fsmonitor/pywatchman/__init__.py Tue Jul 23 10:02:46 2024 +0200 @@ -210,6 +210,7 @@ ) ) + else: def log(fmt, *args): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/fsmonitor/pywatchman/encoding.py --- a/hgext/fsmonitor/pywatchman/encoding.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/fsmonitor/pywatchman/encoding.py Tue Jul 23 10:02:46 2024 +0200 @@ -46,6 +46,7 @@ # 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/highlight/highlight.py Tue Jul 23 10:02:46 2024 +0200 @@ -43,6 +43,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/histedit.py --- a/hgext/histedit.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/histedit.py Tue Jul 23 10:02:46 2024 +0200 @@ -1526,8 +1526,7 @@ 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 @@ -1606,8 +1605,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/journal.py --- a/hgext/journal.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/journal.py Tue Jul 23 10:02:46 2024 +0200 @@ -64,7 +64,6 @@ bookmarktype: hg.sharedbookmarks, } - # Journal recording, register hooks and storage object def extsetup(ui): extensions.wrapfunction(dispatch, 'runcommand', runcommand) diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/keyword.py --- a/hgext/keyword.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/keyword.py Tue Jul 23 10:02:46 2024 +0200 @@ -160,8 +160,6 @@ b'svn', default=False, ) - - # date like in cvs' $Date @templatefilter(b'utcdate', intype=templateutil.date) def utcdate(date): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/largefiles/overrides.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/largefiles/reposetup.py Tue Jul 23 10:02:46 2024 +0200 @@ -140,6 +140,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/narrow/narrowbundle2.py Tue Jul 23 10:02:46 2024 +0200 @@ -37,7 +37,6 @@ _CSHEADERSIZE = struct.calcsize(_ELIDEDCSHEADER) _MFHEADERSIZE = struct.calcsize(_ELIDEDMFHEADER) - # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow( bundler, diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/notify.py --- a/hgext/notify.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/notify.py Tue Jul 23 10:02:46 2024 +0200 @@ -543,6 +543,7 @@ ) def diff(self, ctx, ref=None): + maxdiff = int(self.ui.config(b'notify', b'maxdiff')) prev = ctx.p1().node() if ref: diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/patchbomb.py --- a/hgext/patchbomb.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/patchbomb.py Tue Jul 23 10:02:46 2024 +0200 @@ -261,6 +261,7 @@ numbered, patchname=None, ): + desc = [] node = None body = b'' diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/rebase.py --- a/hgext/rebase.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/rebase.py Tue Jul 23 10:02:46 2024 +0200 @@ -830,6 +830,7 @@ cleanup = False if cleanup: + if rebased: strippoints = [ c.node() for c in repo.set(b'roots(%ld)', rebased) diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/remotefilelog/basepack.py --- a/hgext/remotefilelog/basepack.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotefilelog/basepack.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/remotefilelog/connectionpool.py --- a/hgext/remotefilelog/connectionpool.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotefilelog/connectionpool.py Tue Jul 23 10:02:46 2024 +0200 @@ -38,6 +38,7 @@ pass if conn is None: + peer = hg.peer(self._repo.ui, {}, path) if hasattr(peer, '_cleanup'): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/remotefilelog/datapack.py --- a/hgext/remotefilelog/datapack.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotefilelog/datapack.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotefilelog/remotefilelog.py Tue Jul 23 10:02:46 2024 +0200 @@ -41,6 +41,7 @@ class remotefilelog: + _flagserrorclass = error.RevlogError def __init__(self, opener, path, repo): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/remotefilelog/shallowrepo.py --- a/hgext/remotefilelog/shallowrepo.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotefilelog/shallowrepo.py Tue Jul 23 10:02:46 2024 +0200 @@ -32,7 +32,6 @@ shallowutil, ) - # These make*stores functions are global so that other extensions can replace # them. def makelocalstores(repo): diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/remotenames.py --- a/hgext/remotenames.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/remotenames.py Tue Jul 23 10:02:46 2024 +0200 @@ -259,6 +259,7 @@ def reposetup(ui, repo): + # set the config option to store remotenames repo.ui.setconfig(b'experimental', b'remotenames', True, b'remotenames-ext') diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/sqlitestore.py --- a/hgext/sqlitestore.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/sqlitestore.py Tue Jul 23 10:02:46 2024 +0200 @@ -649,6 +649,7 @@ deltamode=deltamode, sidedata_helpers=sidedata_helpers, ): + yield delta # End of ifiledata interface. diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/uncommit.py --- a/hgext/uncommit.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/uncommit.py Tue Jul 23 10:02:46 2024 +0200 @@ -154,6 +154,7 @@ 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)) @@ -263,6 +264,7 @@ unfi = repo.unfiltered() with repo.wlock(), repo.lock(), repo.transaction(b'unamend'): + # identify the commit from which to unamend curctx = repo[b'.'] diff -r bd1483fd7088 -r 7f0cb9ee0534 hgext/zeroconf/Zeroconf.py --- a/hgext/zeroconf/Zeroconf.py Mon Jul 22 16:49:38 2024 +0200 +++ b/hgext/zeroconf/Zeroconf.py Tue Jul 23 10:02:46 2024 +0200 @@ -1307,7 +1307,6 @@ delay = _LISTENER_TIME next = now + delay last = now + timeout - result = False try: zeroconf.addListener( self, DNSQuestion(self.name, _TYPE_ANY, _CLASS_IN) @@ -1353,7 +1352,7 @@ zeroconf.wait(min(next, last) - now) now = currentTimeMillis() - result = True + result = 1 finally: zeroconf.removeListener(self) diff -r bd1483fd7088 -r 7f0cb9ee0534 i18n/polib.py --- a/i18n/polib.py Mon Jul 22 16:49:38 2024 +0200 +++ b/i18n/polib.py Tue Jul 23 10:02:46 2024 +0200 @@ -64,6 +64,7 @@ def u(s): return unicode(s, "unicode_escape") + else: PY3 = True text_type = str @@ -1888,6 +1889,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/ancestor.py --- a/mercurial/ancestor.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/ancestor.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/bookmarks.py --- a/mercurial/bookmarks.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/bookmarks.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/bundle2.py --- a/mercurial/bundle2.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/bundle2.py Tue Jul 23 10:02:46 2024 +0200 @@ -1286,6 +1286,7 @@ return None def __call__(self): + self.ui.debug( b'bundle2-input-stream-interrupt: opening out of band context\n' ) @@ -2613,6 +2614,7 @@ @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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/bundlerepo.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/changegroup.py --- a/mercurial/changegroup.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/changegroup.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/chgserver.py --- a/mercurial/chgserver.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/chgserver.py Tue Jul 23 10:02:46 2024 +0200 @@ -151,7 +151,7 @@ """ modules = [m for n, m in extensions.extensions(ui)] try: - from . import __version__ # type: ignore + from . import __version__ modules.append(__version__) except ImportError: diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/cmdutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -3833,6 +3833,7 @@ original_headers = patch.parsepatch(diff) try: + chunks, opts = recordfilter( repo.ui, original_headers, match, operation=operation ) diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/copies.py --- a/mercurial/copies.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/copies.py Tue Jul 23 10:02:46 2024 +0200 @@ -915,14 +915,11 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/dirstate.py --- a/mercurial/dirstate.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/dirstate.py Tue Jul 23 10:02:46 2024 +0200 @@ -136,6 +136,7 @@ @interfaceutil.implementer(intdirstate.idirstate) class dirstate: + # used by largefile to avoid overwritting transaction callback _tr_key_suffix = b'' @@ -879,6 +880,7 @@ 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 @@ -1090,6 +1092,7 @@ write_key = self._use_tracked_hint and self._dirty_tracked_set if tr: + self._setup_tr_abort(tr) self._attached_to_a_transaction = True @@ -1283,7 +1286,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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/dirstatemap.py Tue Jul 23 10:02:46 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,8 +617,7 @@ 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) @@ -626,6 +625,7 @@ if rustmod is not None: class dirstatemap(_dirstatemapcommon): + ### Core data storage and access @propertycache diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/encoding.py --- a/mercurial/encoding.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/encoding.py Tue Jul 23 10:02:46 2024 +0200 @@ -367,6 +367,7 @@ cwd = cwd[0:1].upper() + cwd[1:] return cwd + else: getcwd = os.getcwdb # re-exports diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/extensions.py --- a/mercurial/extensions.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/extensions.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/filelog.py --- a/mercurial/filelog.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/filelog.py Tue Jul 23 10:02:46 2024 +0200 @@ -175,6 +175,7 @@ ) with self._revlog._writing(transaction): + if self._fix_issue6528: deltas = rewrite.filter_delta_issue6528(self._revlog, deltas) diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/formatter.py --- a/mercurial/formatter.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/formatter.py Tue Jul 23 10:02:46 2024 +0200 @@ -176,6 +176,7 @@ class baseformatter: + # set to True if the formater output a strict format that does not support # arbitrary output in the stream. strict_format = False @@ -420,6 +421,7 @@ class jsonformatter(baseformatter): + strict_format = True def __init__(self, ui, out, topic, opts): diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/graphmod.py --- a/mercurial/graphmod.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/graphmod.py Tue Jul 23 10:02:46 2024 +0200 @@ -133,7 +133,8 @@ 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 @@ -243,7 +244,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) @@ -264,7 +265,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: @@ -380,7 +381,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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Tue Jul 23 10:02:46 2024 +0200 @@ -120,6 +120,7 @@ seenrepos = set() seendirs = set() for name, path in repos: + if not name.startswith(subdir): continue name = name[len(subdir) :] diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/hgweb/server.py Tue Jul 23 10:02:46 2024 +0200 @@ -66,6 +66,7 @@ class _httprequesthandler(httpservermod.basehttprequesthandler): + url_scheme = b'http' @staticmethod @@ -357,6 +358,7 @@ class MercurialHTTPServer(_mixin, httpservermod.httpserver, object): + # SO_REUSEADDR has broken semantics on windows if pycompat.iswindows: allow_reuse_address = 0 @@ -394,6 +396,7 @@ def create_server(ui, app): + if ui.config(b'web', b'certificate'): handler = _httprequesthandlerssl else: diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/hgweb/webcommands.py Tue Jul 23 10:02:46 2024 +0200 @@ -601,6 +601,7 @@ def dirlist(context): for d in sorted(dirs): + emptydirs = [] h = dirs[d] while isinstance(h, dict) and len(h) == 1: @@ -1426,7 +1427,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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/httpconnection.py --- a/mercurial/httpconnection.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/httpconnection.py Tue Jul 23 10:02:46 2024 +0200 @@ -25,7 +25,6 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/i18n.py --- a/mercurial/i18n.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/i18n.py Tue Jul 23 10:02:46 2024 +0200 @@ -119,5 +119,6 @@ def _(message: bytes) -> bytes: return message + else: _ = gettext diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/linelog.py --- a/mercurial/linelog.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/linelog.py Tue Jul 23 10:02:46 2024 +0200 @@ -53,6 +53,7 @@ class _llinstruction: # pytype: disable=ignored-metaclass + __metaclass__ = abc.ABCMeta @abc.abstractmethod diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/merge.py --- a/mercurial/merge.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/merge.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/mergestate.py --- a/mercurial/mergestate.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/mergestate.py Tue Jul 23 10:02:46 2024 +0200 @@ -495,6 +495,7 @@ class mergestate(_mergestate_base): + statepathv1 = b'merge/state' statepathv2 = b'merge/state2' diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/metadata.py --- a/mercurial/metadata.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/metadata.py Tue Jul 23 10:02:46 2024 +0200 @@ -433,12 +433,14 @@ # 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/narrowspec.py --- a/mercurial/narrowspec.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/narrowspec.py Tue Jul 23 10:02:46 2024 +0200 @@ -225,6 +225,7 @@ m = "changing narrow spec outside of a transaction" raise error.ProgrammingError(m) else: + reporef = weakref.ref(repo) def clean_pending(tr): diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/obsolete.py --- a/mercurial/obsolete.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/obsolete.py Tue Jul 23 10:02:46 2024 +0200 @@ -1038,6 +1038,7 @@ def makefoldid(relation, user): + folddigest = hashutil.sha1(user) for p in relation[0] + relation[1]: folddigest.update(b'%d' % p.rev()) diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/obsutil.py --- a/mercurial/obsutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/obsutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -961,6 +961,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/patch.py --- a/mercurial/patch.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/patch.py Tue Jul 23 10:02:46 2024 +0200 @@ -229,6 +229,7 @@ def _extract(ui, fileobj, tmpname, tmpfp): + # attempt to detect the start of a patch # (this heuristic is borrowed from quilt) diffre = re.compile( @@ -595,7 +596,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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/phases.py --- a/mercurial/phases.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/phases.py Tue Jul 23 10:02:46 2024 +0200 @@ -893,6 +893,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/policy.py --- a/mercurial/policy.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/policy.py Tue Jul 23 10:02:46 2024 +0200 @@ -37,7 +37,7 @@ } try: - from . import __modulepolicy__ # type: ignore + from . import __modulepolicy__ policy = __modulepolicy__.modulepolicy except ImportError: diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/pure/parsers.py Tue Jul 23 10:02:46 2024 +0200 @@ -911,6 +911,7 @@ ) 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/revlog.py --- a/mercurial/revlog.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/revlog.py Tue Jul 23 10:02:46 2024 +0200 @@ -226,6 +226,7 @@ index, cache = parsers.parse_index_devel_nodemap(data, inline) return index, cache + else: parse_index_v1_nodemap = None diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/revlogutils/deltas.py Tue Jul 23 10:02:46 2024 +0200 @@ -428,6 +428,7 @@ # Cut the revs at collected indices previdx = 0 for idx in selected: + chunk = _trimchunk(revlog, revs, previdx, idx) if chunk: yield chunk diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/revlogutils/nodemap.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/revlogutils/rewrite.py --- a/mercurial/revlogutils/rewrite.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/revlogutils/rewrite.py Tue Jul 23 10:02:46 2024 +0200 @@ -258,6 +258,7 @@ # 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/scmutil.py --- a/mercurial/scmutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/scmutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -730,6 +730,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/setdiscovery.py Tue Jul 23 10:02:46 2024 +0200 @@ -190,6 +190,7 @@ 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 @@ -453,6 +454,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/similar.py --- a/mercurial/similar.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/similar.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/sslutil.py --- a/mercurial/sslutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/sslutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -497,6 +497,7 @@ ) elif e.reason == 'CERTIFICATE_VERIFY_FAILED' and pycompat.iswindows: + ui.warn( _( b'(the full certificate chain may not be available ' diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/store.py --- a/mercurial/store.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/store.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/streamclone.py --- a/mercurial/streamclone.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/streamclone.py Tue Jul 23 10:02:46 2024 +0200 @@ -547,7 +547,6 @@ _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""" @@ -810,6 +809,7 @@ """ with repo.lock(): + repo.ui.debug(b'scanning\n') entries = _entries_walk( @@ -857,6 +857,7 @@ # 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( @@ -989,6 +990,7 @@ 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: @@ -1121,6 +1123,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/strip.py --- a/mercurial/strip.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/strip.py Tue Jul 23 10:02:46 2024 +0200 @@ -63,6 +63,7 @@ soft=False, ): with repo.wlock(), repo.lock(): + if update: checklocalchanges(repo, force=force) urev = _findupdatetarget(repo, revs) diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/subrepo.py Tue Jul 23 10:02:46 2024 +0200 @@ -1227,12 +1227,16 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/tags.py --- a/mercurial/tags.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/tags.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/upgrade.py --- a/mercurial/upgrade.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/upgrade.py Tue Jul 23 10:02:46 2024 +0200 @@ -194,6 +194,7 @@ onlydefault.append(d) if fromconfig or onlydefault: + if fromconfig: ui.status( _( diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/urllibcompat.py --- a/mercurial/urllibcompat.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/urllibcompat.py Tue Jul 23 10:02:46 2024 +0200 @@ -109,7 +109,6 @@ ), ) - # 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/util.py --- a/mercurial/util.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/util.py Tue Jul 23 10:02:46 2024 +0200 @@ -1152,7 +1152,7 @@ def version(): """Return version information if available.""" try: - from . import __version__ # type: ignore + from . import __version__ return __version__.version except ImportError: @@ -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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/utils/compression.py --- a/mercurial/utils/compression.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/utils/compression.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/utils/procutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -711,6 +711,7 @@ if stdin is not None: stdin.close() + else: def runbgcommand( diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/utils/resourceutil.py --- a/mercurial/utils/resourceutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/utils/resourceutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -52,6 +52,7 @@ 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) @@ -97,6 +98,7 @@ for p in os.listdir(path): yield pycompat.fsencode(p) + else: from .. import encoding diff -r bd1483fd7088 -r 7f0cb9ee0534 mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/utils/stringutil.py Tue Jul 23 10:02:46 2024 +0200 @@ -574,6 +574,7 @@ 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'#'): @@ -800,6 +801,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/win32.py --- a/mercurial/win32.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/win32.py Tue Jul 23 10:02:46 2024 +0200 @@ -172,7 +172,6 @@ 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_ = ( @@ -369,7 +368,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 bd1483fd7088 -r 7f0cb9ee0534 mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py Mon Jul 22 16:49:38 2024 +0200 +++ b/mercurial/wireprotoframing.py Tue Jul 23 10:02:46 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,6 +1198,7 @@ b'%s' % stringutil.forcebytestr(e), errtype=b'server', ): + yield frame break @@ -1258,6 +1259,7 @@ for chunk in cborutil.streamencodebytestringfromiter( o.chunks ): + for frame in emitter.send(chunk): yield frame diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/.cargo/config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/.cargo/config Tue Jul 23 10:02:46 2024 +0200 @@ -0,0 +1,7 @@ +# Rust builds with a modern MSVC and uses a newer CRT. +# Python 2.7 has a shared library dependency on an older CRT (msvcr90.dll). +# We statically link the modern CRT to avoid multiple msvcr*.dll libraries +# being loaded and Python possibly picking up symbols from the newer runtime +# (which would be loaded first). +[target.'cfg(target_os = "windows")'] +rustflags = ["-Ctarget-feature=+crt-static"] diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/.cargo/config.toml --- a/rust/.cargo/config.toml Mon Jul 22 16:49:38 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -# Rust builds with a modern MSVC and uses a newer CRT. -# Python 2.7 has a shared library dependency on an older CRT (msvcr90.dll). -# We statically link the modern CRT to avoid multiple msvcr*.dll libraries -# being loaded and Python possibly picking up symbols from the newer runtime -# (which would be loaded first). -[target.'cfg(target_os = "windows")'] -rustflags = ["-Ctarget-feature=+crt-static"] diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/dirstate_tree/on_disk.rs --- a/rust/hg-core/src/dirstate_tree/on_disk.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Tue Jul 23 10:02:46 2024 +0200 @@ -332,7 +332,9 @@ ) -> Result { let start = self.base_name_start.get(); if start < self.full_path.len.get() { - let start = usize::from(start); + let start = usize::try_from(start) + // u32 -> usize, could only panic on a 16-bit CPU + .expect("dirstate-v2 base_name_start out of bounds"); Ok(start) } else { Err(DirstateV2ParseError::new("not enough bytes for base name")) @@ -591,8 +593,8 @@ { // Either `usize::MAX` would result in "out of bounds" error since a single // `&[u8]` cannot occupy the entire addess space. - let start = start.get().try_into().unwrap_or(usize::MAX); - let len = len.try_into().unwrap_or(usize::MAX); + let start = start.get().try_into().unwrap_or(std::usize::MAX); + let len = len.try_into().unwrap_or(std::usize::MAX); let bytes = match on_disk.get(start..) { Some(bytes) => bytes, None => { diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/dirstate_tree/status.rs --- a/rust/hg-core/src/dirstate_tree/status.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/dirstate_tree/status.rs Tue Jul 23 10:02:46 2024 +0200 @@ -677,14 +677,14 @@ // The directory was modified too recently, // don’t cache its `read_dir` results. // - // 1. A change to this directory (direct child was added or - // removed) cause its mtime to be set (possibly truncated) - // to `directory_mtime` + // 1. A change to this directory (direct child was + // added or removed) cause its mtime to be set + // (possibly truncated) to `directory_mtime` // 2. This `status` algorithm calls `read_dir` - // 3. An other change is made to the same directory is made so - // that calling `read_dir` agin would give different - // results, but soon enough after 1. that the mtime stays - // the same + // 3. An other change is made to the same directory is + // made so that calling `read_dir` agin would give + // different results, but soon enough after 1. that + // the mtime stays the same // // On a system where the time resolution poor, this // scenario is not unlikely if all three steps are caused diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/matchers.rs --- a/rust/hg-core/src/matchers.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/matchers.rs Tue Jul 23 10:02:46 2024 +0200 @@ -617,11 +617,7 @@ std::mem::swap(&mut m1, &mut m2); } m1.file_set().map(|m1_files| { - m1_files - .iter() - .filter(|&f| m2.matches(f)) - .cloned() - .collect() + m1_files.iter().cloned().filter(|f| m2.matches(f)).collect() }) } else { // without exact input file sets, we can't do an exact @@ -714,7 +710,7 @@ }; if base_is_exact { new.files = base_files.map(|files| { - files.iter().filter(|&f| new.matches(f)).cloned().collect() + files.iter().cloned().filter(|f| new.matches(f)).collect() }); } new diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/revlog/changelog.rs Tue Jul 23 10:02:46 2024 +0200 @@ -713,7 +713,7 @@ for (extra, msg) in test_cases { assert!( - decode_extra(extra).is_err(), + decode_extra(&extra).is_err(), "corrupt extra should have failed to parse: {}", msg ); diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/revlog/index.rs --- a/rust/hg-core/src/revlog/index.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/revlog/index.rs Tue Jul 23 10:02:46 2024 +0200 @@ -1387,7 +1387,6 @@ fn vec_of_empty(sets_size: usize, vec_len: usize) -> Vec; /// The size of the bit mask in memory - #[allow(unused)] fn size(&self) -> usize; /// The number of elements that can be represented in the set. @@ -1395,14 +1394,12 @@ /// Another way to put it is that it is the highest integer `C` such that /// the set is guaranteed to always be a subset of the integer range /// `[0, C)` - #[allow(unused)] fn capacity(&self) -> usize; /// Declare `n` to belong to the set fn add(&mut self, n: usize); /// Declare `n` not to belong to the set - #[allow(unused)] fn discard(&mut self, n: usize); /// Replace this bit set by its union with other @@ -1752,9 +1749,6 @@ } #[cfg(test)] -pub use tests::IndexEntryBuilder; - -#[cfg(test)] mod tests { use super::*; use crate::node::NULL_NODE; @@ -2033,3 +2027,6 @@ assert_eq!(get_version(&bytes), 2) } } + +#[cfg(test)] +pub use tests::IndexEntryBuilder; diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-core/src/revlog/node.rs --- a/rust/hg-core/src/revlog/node.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-core/src/revlog/node.rs Tue Jul 23 10:02:46 2024 +0200 @@ -83,7 +83,7 @@ #[inline] fn try_from(bytes: &'a [u8]) -> Result { match Node::from_bytes(bytes) { - Ok((node, [])) => Ok(node), + Ok((node, rest)) if rest.is_empty() => Ok(node), _ => Err(()), } } @@ -323,9 +323,6 @@ } #[cfg(test)] -pub use tests::hex_pad_right; - -#[cfg(test)] mod tests { use super::*; @@ -431,3 +428,6 @@ assert_eq!(prefix.first_different_nybble(&node), None); } } + +#[cfg(test)] +pub use tests::hex_pad_right; diff -r bd1483fd7088 -r 7f0cb9ee0534 rust/hg-cpython/src/ancestors.rs --- a/rust/hg-cpython/src/ancestors.rs Mon Jul 22 16:49:38 2024 +0200 +++ b/rust/hg-cpython/src/ancestors.rs Tue Jul 23 10:02:46 2024 +0200 @@ -19,8 +19,8 @@ //! `mercurial.ancestor.incrementalmissingancestors`. //! //! API differences: -//! + it is instantiated with a C `parsers.index` instance instead of a -//! parents function. +//! + it is instantiated with a C `parsers.index` +//! instance instead of a parents function. //! + `MissingAncestors.bases` is a method returning a tuple instead of //! a set-valued attribute. We could return a Python set easily if our //! [PySet PR](https://github.com/dgrunwald/rust-cpython/pull/165) diff -r bd1483fd7088 -r 7f0cb9ee0534 setup.py --- a/setup.py Mon Jul 22 16:49:38 2024 +0200 +++ b/setup.py Tue Jul 23 10:02:46 2024 +0200 @@ -463,6 +463,7 @@ class hgbuildmo(build): + description = "build translations (.mo files)" def run(self): @@ -1055,6 +1056,7 @@ class hginstall(install): + user_options = install.user_options + [ ( 'old-and-unmanageable', diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/dumbhttp.py --- a/tests/dumbhttp.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/dumbhttp.py Tue Jul 23 10:02:46 2024 +0200 @@ -26,6 +26,7 @@ class simplehttpserver(httpserver.httpserver): address_family = socket.AF_INET6 + else: simplehttpserver = httpserver.httpserver diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/dummysmtpd.py --- a/tests/dummysmtpd.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/dummysmtpd.py Tue Jul 23 10:02:46 2024 +0200 @@ -31,15 +31,8 @@ def mocksmtpserversession(conn, addr): conn.send(b'220 smtp.example.com ESMTP\r\n') - try: - # Newer versions of OpenSSL raise on EOF - line = conn.recv(1024) - except ssl.SSLError: - log('no hello: EOF\n') - return - + line = conn.recv(1024) if not line.lower().startswith(b'ehlo '): - # Older versions of OpenSSl don't raise log('no hello: %s\n' % line) return diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/fsmonitor-run-tests.py --- a/tests/fsmonitor-run-tests.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/fsmonitor-run-tests.py Tue Jul 23 10:02:46 2024 +0200 @@ -30,6 +30,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/generate-working-copy-states.py --- a/tests/generate-working-copy-states.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/generate-working-copy-states.py Tue Jul 23 10:02:46 2024 +0200 @@ -33,7 +33,6 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/hghave.py --- a/tests/hghave.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/hghave.py Tue Jul 23 10:02:46 2024 +0200 @@ -1113,13 +1113,13 @@ return matchoutput('emacs --version', b'GNU Emacs 2(4.4|4.5|5|6|7|8|9)') -@check('black', 'the black formatter for python >=23.3.0') +@check('black', 'the black formatter for python (>= 20.8b1)') def has_black(): blackcmd = 'black --version' version_regex = b'black, (?:version )?([0-9a-b.]+)' version = matchoutput(blackcmd, version_regex) sv = distutils.version.StrictVersion - return version and sv(_bytes2sys(version.group(1))) >= sv('23.3.0') + return version and sv(_bytes2sys(version.group(1))) >= sv('20.8b1') @check('pytype', 'the pytype type checker') diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/killdaemons.py --- a/tests/killdaemons.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/killdaemons.py Tue Jul 23 10:02:46 2024 +0200 @@ -75,6 +75,7 @@ raise _check(ctypes.windll.kernel32.CloseHandle(handle)) + else: def kill(pid, logfn, tryhard=True): diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/mockblackbox.py --- a/tests/mockblackbox.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/mockblackbox.py Tue Jul 23 10:02:46 2024 +0200 @@ -1,6 +1,5 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/run-tests.py --- a/tests/run-tests.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/run-tests.py Tue Jul 23 10:02:46 2024 +0200 @@ -223,7 +223,6 @@ # 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 @@ -3398,6 +3397,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-ancestor.py --- a/tests/test-ancestor.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-ancestor.py Tue Jul 23 10:02:46 2024 +0200 @@ -87,7 +87,6 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-batching.py --- a/tests/test-batching.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-batching.py Tue Jul 23 10:02:46 2024 +0200 @@ -55,6 +55,7 @@ # usage of "thing" interface def use(it): + # Direct call to base method shared between client and server. bprint(it.hello()) @@ -105,7 +106,6 @@ # server side - # equivalent of wireproto's global functions class server: def __init__(self, local): @@ -156,7 +156,6 @@ # 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-cbor.py --- a/tests/test-cbor.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-cbor.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-config-env.py --- a/tests/test-config-env.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-config-env.py Tue Jul 23 10:02:46 2024 +0200 @@ -15,7 +15,6 @@ testtmp = encoding.environ[b'TESTTMP'] - # prepare hgrc files def join(name): return os.path.join(testtmp, name) @@ -27,7 +26,6 @@ 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')] @@ -42,7 +40,6 @@ rcutil.systemrcpath = systemrcpath rcutil.userrcpath = userrcpath - # utility to print configs def printconfigs(env): encoding.environ = env diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/test-extensions-wrapfunction.py --- a/tests/test-extensions-wrapfunction.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-extensions-wrapfunction.py Tue Jul 23 10:02:46 2024 +0200 @@ -66,7 +66,6 @@ print('context manager', dummy.getstack()) print('context manager', dummy.getstack()) - # Wrap callable object which has no __name__ class callableobj: def __call__(self): diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/test-hg-parseurl.py --- a/tests/test-hg-parseurl.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-hg-parseurl.py Tue Jul 23 10:02:46 2024 +0200 @@ -5,6 +5,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-hybridencode.py --- a/tests/test-hybridencode.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-hybridencode.py Tue Jul 23 10:02:46 2024 +0200 @@ -5,6 +5,7 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-install.t --- a/tests/test-install.t Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-install.t Tue Jul 23 10:02:46 2024 +0200 @@ -216,9 +216,6 @@ Failed building wheel for mercurial (?) WARNING: You are using pip version *; however, version * is available. (glob) (?) You should consider upgrading via the '$TESTTMP/installenv/bin/python* -m pip install --upgrade pip' command. (glob) (?) - (?) - [notice] A new release of pip is available: * -> * (glob) (?) - [notice] To update, run: python -m pip install --upgrade pip (?) $ ./installenv/*/hg debuginstall || cat pip.log checking encoding (ascii)... checking Python executable (*) (glob) diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/test-parseindex2.py --- a/tests/test-parseindex2.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-parseindex2.py Tue Jul 23 10:02:46 2024 +0200 @@ -26,7 +26,6 @@ parsers = policy.importmod('parsers') - # original python implementation def gettype(q): return int(q & 0xFFFF) diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-patchbomb-tls.t Tue Jul 23 10:02:46 2024 +0200 @@ -98,7 +98,7 @@ $ wait_log "no hello:" $ cat ../log connection from * (glob) - no hello: (b''|EOF) (re) + no hello: b'' $ : > ../log With global certificates: diff -r bd1483fd7088 -r 7f0cb9ee0534 tests/test-remotefilelog-datapack.py --- a/tests/test-remotefilelog-datapack.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-remotefilelog-datapack.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-remotefilelog-histpack.py --- a/tests/test-remotefilelog-histpack.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-remotefilelog-histpack.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-revlog-raw.py --- a/tests/test-revlog-raw.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-revlog-raw.py Tue Jul 23 10:02:46 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-simplemerge.py --- a/tests/test-simplemerge.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-simplemerge.py Tue Jul 23 10:02:46 2024 +0200 @@ -24,8 +24,6 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-symlink-os-yes-fs-no.py --- a/tests/test-symlink-os-yes-fs-no.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-symlink-os-yes-fs-no.py Tue Jul 23 10:02:46 2024 +0200 @@ -30,7 +30,6 @@ 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-ui-color.py --- a/tests/test-ui-color.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-ui-color.py Tue Jul 23 10:02:46 2024 +0200 @@ -25,7 +25,6 @@ # 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 bd1483fd7088 -r 7f0cb9ee0534 tests/test-verify-repo-operations.py --- a/tests/test-verify-repo-operations.py Mon Jul 22 16:49:38 2024 +0200 +++ b/tests/test-verify-repo-operations.py Tue Jul 23 10:02:46 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), ), )