Skip to content
Snippets Groups Projects
  1. Dec 09, 2022
    • Matt Harbison's avatar
      demandimport: fix a crash in LazyFinder.__delattr__ · 48e38b17
      Matt Harbison authored
      I was tinkering with `with hgdemandimport.deactivated()` wrapped around loading
      the keyring module, and got spew that seemed to be confirmed by PyCharm.  But I
      can't believe we haven't seen this before (and phabricator uses the same
      pattern):
      
          ** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" 1.4.3 (keyring 23.11.0, backend unknown)
          ** which supports versions unknown of Mercurial.
          ** Please disable "mercurial_keyring" and try your action again.
          ** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
          ** Python 3.9.15 (main, Oct 13 2022, 04:28:25) [GCC 7.5.0]
          ** Mercurial Distributed SCM (version 6.3.1)
          ** Extensions loaded: absorb, attorc 20220315, blackbox, eol, extdiff, fastannotate, lfs, mercurial_keyring 1.4.3 (keyring 23.11.0, backend unknown), phabblocker 20220315, phabricator 20220315, purge, rebase, schemes, share, show, strip, uncommit
          Traceback (most recent call last):
            File "/usr/local/bin/hg", line 59, in <module>
              dispatch.run()
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 143, in run
              status = dispatch(req)
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 232, in dispatch
              status = _rundispatch(req)
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 276, in _rundispatch
              ret = _runcatch(req) or 0
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 451, in _runcatch
              return _callcatch(ui, _runcatchfunc)
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 461, in _callcatch
              return scmutil.callcatch(ui, func)
            File "/usr/local/lib/python3.9/site-packages/mercurial/scmutil.py", line 153, in callcatch
              return func()
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 441, in _runcatchfunc
              return _dispatch(req)
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 1265, in _dispatch
              return runcommand(
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 899, in runcommand
              ret = _runcommand(ui, options, cmd, d)
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 1277, in _runcommand
              return cmdfunc()
            File "/usr/local/lib/python3.9/site-packages/mercurial/dispatch.py", line 1263, in <lambda>
              d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
            File "/usr/local/lib/python3.9/site-packages/mercurial/util.py", line 1880, in check
              return func(*args, **kwargs)
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 962, in cmd_keyring_check
              user, pwd, source, final_url = handler.get_credentials(
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 497, in get_credentials
              keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 287, in get_http_password
              return self._read_password_from_keyring(
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 335, in _read_password_from_keyring
              keyring = import_keyring()
      >> `with hgdemandimport.deactivated()` inserted here
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 120, in import_keyring
              return _import_keyring()
            File "/root/mercurial_keyring/mercurial_keyring/mercurial_keyring.py", line 133, in _import_keyring
              mod, was_imported_now = meu.direct_import_ext(
            File "/usr/lib/python3.9/site-packages/mercurial_extension_utils.py", line 1381, in direct_import_ext
              __import__(module_name)
            File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
            File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 46, in exec_module
              self.loader.exec_module(module)
            File "/usr/lib/python3.9/site-packages/keyring/__init__.py", line 1, in <module>
              from .core import (
            File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
            File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 46, in exec_module
              self.loader.exec_module(module)
            File "/usr/lib/python3.9/site-packages/keyring/core.py", line 11, in <module>
              from . import backend, credentials
            File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
            File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 46, in exec_module
              self.loader.exec_module(module)
            File "/usr/lib/python3.9/site-packages/keyring/backend.py", line 13, in <module>
              from .py312compat import metadata
            File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
            File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 46, in exec_module
              self.loader.exec_module(module)
            File "/usr/lib/python3.9/site-packages/keyring/py312compat.py", line 10, in <module>
              import importlib_metadata as metadata  # type: ignore
            File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
            File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
            File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 46, in exec_module
              self.loader.exec_module(module)
            File "/usr/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 715, in <module>
              class MetadataPathFinder(NullFinder, DistributionFinder):
            File "/usr/lib/python3.9/site-packages/importlib_metadata/_compat.py", line 24, in install
              disable_stdlib_finder()
            File "/usr/lib/python3.9/site-packages/importlib_metadata/_compat.py", line 43, in disable_stdlib_finder
              del finder.find_distributions
            File "/usr/local/lib/python3.9/site-packages/hgdemandimport/demandimportpy3.py", line 88, in __delattr__
              return delattr(object.__getattribute__(self, "_finder"))
          TypeError: delattr expected 2 arguments, got 1
      48e38b17
  2. Dec 05, 2022
  3. Dec 01, 2022
  4. Nov 28, 2022
  5. Nov 24, 2022
    • Pierre-Yves David's avatar
      test: adjust test-push-race.t timeout's to overall test timeout · c6f0bcb7
      Pierre-Yves David authored
      The generic `tests/testlib/wait-on-file` mechanism scale its timeout with the
      value of `HGTEST_TIMEOUT`, the `delaypush.py` in `test-push-race.t` is not doing
      this, and we have been seeing more and more timeout from loaded CI worker
      lately.
      
      Adding this timeout scaling should help with that.
      c6f0bcb7
  6. Nov 23, 2022
  7. Nov 22, 2022
  8. Nov 20, 2022
    • Matt Harbison's avatar
      help: fix a py3 error interpolating Set into b'%s' · f09bc2ed
      Matt Harbison authored
      I can't reproduce it, but a coworker hit this with `hg help -v` with 6.2.3:
      
          ...
            File "mercurial\help.pyc", line 865, in helplist
          TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'set'
      
      I can confirm that the original expression fails in `hg debugshell`, and the new
      one works.  The second instance was found by searching for "%s", but PyCharm
      detects a lot of variables as Any type, so I have no idea if there are other
      lurking problems.
      f09bc2ed
  9. Nov 19, 2022
    • Raphaël Gomès's avatar
      3324f394
    • Raphaël Gomès's avatar
      010d9e36
    • Raphaël Gomès's avatar
    • Pierre-Yves David's avatar
      memory-usage: fix `hg log --follow --rev R F` space complexity · dcb2581e
      Pierre-Yves David authored
      When running `hg log --follow --rev REVS FILES`, the log code will walk the
      history of all FILES starting from the file revisions that exists in each REVS.
      
      Before doing so, it looks if the files actually exists in the target revisions.
      To do so, it opens the manifest of each revision in REVS to look up if we find
      the associated items in FILES.
      
      Before this changeset this was done in a way that created a changectx for
      each target revision, keeping them in memory while we look into each file.
      
      If the set of REVS is large, this means keeping the manifest for each entry in
      REVS in memory. That can be large… if REV is in the form `::X`, this can quickly
      become huge and saturate the memory. We have seen usage allocating 2GB per
      second until memory runs out.
      
      So this changeset invert the two loop so that only one revision is kept in
      memory during the operation. This solve the memory explosion issue.
      dcb2581e
  10. Nov 18, 2022
  11. Nov 17, 2022
  12. Nov 18, 2022
  13. Nov 17, 2022
  14. Nov 08, 2022
  15. Nov 02, 2022
  16. Nov 16, 2022
    • Pierre-Yves David's avatar
      matcher: do not prepend '.*' to pattern using ^ after flags · b3480822
      Pierre-Yves David authored
      Since the previous commit (fixing wider issue), the code generated strange
      regex. This is now fixed and tested.
      b3480822
    • Pierre-Yves David's avatar
      matcher: fix the issue with regex inline-flag in rust oo · 086b0c4f
      Pierre-Yves David authored
      Same problem same solution.
      086b0c4f
    • Pierre-Yves David's avatar
      matcher: fix issues regex flag contained in pattern (issue6759) · 3eda36e9
      Pierre-Yves David authored
      Python 3.11 is now enforcing that flag must be at the beginning of the regex
      
      This creates a serious regression for people using Python 3.11 with an hgignore
      using flag in a "relre" pattern.
      
      We now detect any flags in such pattern and "prepend" our ".*" pattern after them.
      
      In addition, we now insert the flag in the regexp to only affect the pattern we
      are rewriting. Otherwise, the regex built from the combined pattern would these
      flags in the middle of it anyway.
      
      As a side effect of this last change, we fix a bug… before this change regex
      flag in a pattern would affect all combined patterns. That was bad and is not
      longer the case.
      
      The Rust code needs to be updated to fix that very bug, but we will do it in
      another changeset.
      3eda36e9
    • Pierre-Yves David's avatar
      release: removed the 6.3.0 tag · 4e3d8656
      Pierre-Yves David authored
      The revision having two tags confuses some of the build script trying to fetch
      the version. So, remove the "bad" tag for now.
      4e3d8656
  17. Nov 14, 2022
  18. Jun 20, 2022
  19. Nov 15, 2022
    • Pierre-Yves David's avatar
      release: add the "6.3" to the 6.3 release · 9e5b411b
      Pierre-Yves David authored
      The release was tagged "6.3.0" while the custom have been to omit the third ".0"
      for initial release for the history of the project.
      
      For consistency, we add the customary version of the tag to the 6.3 release.
      9e5b411b
  20. Nov 14, 2022
  21. Nov 10, 2022
  22. Nov 12, 2022
    • Pierre-Yves David's avatar
      tags-fnode-cache: skip building a changectx in getfnode · 08fe5c4d
      Pierre-Yves David authored
      Building a changectx object is costly, doing it just to retrieve the revision
      number is suboptimal. Directly fetching the revision number from the changelog
      provide a sizeable speedup to `hg debugupdatecache`.
      
      ### data-env-vars.name           = mercurial-2018-08-01-zstd-sparse-revlog
        # benchmark.name               = debug-update-cache
        # benchmark.variants.pre-state = warm
      before: 0.213229 seconds
      after:  0.165577 seconds  (-22.35%)
        # data-env-vars.name           = mercurial-filtered-2019-11-22-zstd-sparse-revlog
      before: 1.200383 seconds
      after:  1.071618 seconds  (-10.73%)
        # data-env-vars.name           = mozilla-central-2018-08-01-zstd-sparse-revlog
      before: 1.465735 seconds
      after:  0.923128 seconds  (-37.02%)
        # data-env-vars.name           = mozilla-try-2019-02-18-zstd-sparse-revlog
      before: 6.511771 seconds
      after:  4.507316 seconds  (-30.78%)
        # data-env-vars.name           = netbeans-2018-08-01-zstd-sparse-revlog
      before: 1.023007 seconds
      after:  0.645026 seconds  (-36.95%)
        # data-env-vars.name           = pypy-2018-08-01-zstd-sparse-revlog
      before: 0.381141 seconds
      after:  0.268654 seconds  (-29.51%)
      08fe5c4d
    • Pierre-Yves David's avatar
      tags-fnode-cache: do not repeatedly open the filelog in a loop · 15a89b72
      Pierre-Yves David authored
      While getting multiple hgtagsfnodecache entries, we were opening (and closing)
      the `.hgtags` filelog for each iteration. The meant repeatedly reading and
      parsing the version same information from disk. A quite costly operation.
      
      We no longer do this, leading to a sizable improvement in `hg debugupdatecache`
      run for an already warm repositories.
      
      ### data-env-vars.name           = mercurial-2018-08-01-zstd-sparse-revlog
        # benchmark.name               = debug-update-cache
        # benchmark.variants.pre-state = warm
      before:  1.711778 seconds
      after:   0.213229 seconds  (-87.54%)
        # data-env-vars.name           = pypy-2018-08-01-zstd-sparse-revlog
      before:  4.010817 seconds
      after:   0.381141 seconds  (-90.50%)
        # data-env-vars.name           = netbeans-2018-08-01-zstd-sparse-revlog
      before: 13.574141
      after:   1.023007 seconds  (-92.46%)
        # data-env-vars.name           = mozilla-central-2018-08-01-zstd-sparse-revlog
      before: 18.884656
      after:   1.465735 seconds  (-92.24%)
        # data-env-vars.name           = mozilla-try-2019-02-18-zstd-sparse-revlog
      before: 88.924823
      after:   6.511771 seconds  (-92.68%)
      15a89b72
    • Pierre-Yves David's avatar
      profile: prevent a crash when line number is unknown · aab3d4c0
      Pierre-Yves David authored
      For some unknown reason, `self.lineno` can be None. The previous code crashed in
      such case, we now ignore the case, as we do for other error in this function.
      
      We also fallback to using `-1` in the output when this lack of line number
      makes it to the display code.
      
      The reason of unknown line-numbers is… unknown.
      aab3d4c0
  23. Nov 06, 2022
    • Matt Harbison's avatar
      upgrade: byteify requirement changes written to output · d1244676
      Matt Harbison authored
      ui.write() expects bytes, and internally uses `b''` as the default when getting
      the `label` keyword from `*args`.  So either we're missing test coverage, or
      there's some very subtle conversion from unicode somewhere.
      
      Also, slip in a type hint to flag this in the future.
      d1244676
Loading