Skip to content
Snippets Groups Projects
  1. Jan 21, 2020
  2. Jan 09, 2020
  3. Jan 03, 2020
    • Kyle Lippincott's avatar
      progress: flush stderr after clearing · 4e0a6d15
      Kyle Lippincott authored
      On python3, ui.stderr is buffered, it seems, so we need to flush it to actually
      get the progress bar off the screen. This is important since ui.write() will
      call into progbar.clear() if it thinks there's a progress bar on the screen,
      with the intent that the next thing it outputs is at the beginning of the line
      (instead of at the end of the progress bar line). Without the flush, we buffer
      up the clearing of the screen, and we get some really weird/corrupt output.
      
      Differential Revision: https://phab.mercurial-scm.org/D7784
      4e0a6d15
  4. Dec 24, 2019
    • Matt Harbison's avatar
      subrepo: fix a crash when archiving an svn or git subrepo · 7ca8aa88
      Matt Harbison authored
      Only hgsubrepos have a repository attribute.  This is pretty hacky, but probably
      the best we can do on stable.  Pushing the lfstatus check down into the wrapper
      for hgsubrepo (and dropping the check for lfstatus at the top of
      `hgsubrepoarchive()`) resulted in various test failures because:
      
        1) hgsubrepoarchive isn't returning the number of files archived at the
           bottom, resulting in an error about += NoneType
        2) These copypasta archive wrappers don't use progress bars
        3) Largefiles are *not* currently archived when using extdiff (68822b7cdd01),
           but pushing this context manager down into the subrepo resulted in it
           apparently doing so (as evidenced by progress bars being dropped)
      
      The other uses of `lfstatus()` are not in the substate processing loop, so they
      shouldn't be an issue.
      
      I initially put testcases in this test for largefiles-{on,off}, and it flagged
      a bunch of exit code differences for `cat` and `diff`, so I backed that off.
      
      Differential Revision: https://phab.mercurial-scm.org/D7714
      7ca8aa88
  5. Jan 17, 2020
    • Matt Harbison's avatar
      phabricator: use .arcconfig for `phabricator.url` if not set locally · ff396501
      Matt Harbison authored
      This setting is also per repo; see the previous commit for details.
      
      The existing `conduit_uri` setting is the previous name of `phabricator.uri`[1]
      and while it could easily be queried before the latter for compatibility, the
      config in this repo has '/api' appended. That's already done in `callconduit()`,
      which would clearly end up giving the wrong result. It looks like the path of
      the URL is now ignored in user configs[2], so add the modern setting without it
      to this repo's .arcconfig.
      
      Sadly, we still need to have contributors configure `auth.hg.phabtoken` (and
      therefore `auth.hg.prefix` to link it to `phabricator.url`) in order to submit
      patches, but at least now it's localized to a single section.
      
      [1] https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/
      [2] https://github.com/phacility/arcanist/blob/cc850163f30c4697e925df0d6212469679600a2c/scripts/arcanist.php#L271
      
      Differential Revision: https://phab.mercu...
      ff396501
    • Matt Harbison's avatar
      phabricator: use .arcconfig for the callsign if not set locally (issue6243) · 59b3fe1e
      Matt Harbison authored
      This makes things easier for people working with more than one repository
      because this file can be committed to each repository.  The bug report asks to
      read <repo>/.arcrc, but AFAICT, that file lives in ~/ and holds the credentials.
      And we already track an .arcconfig file.  Any callsign set globally is still
      used if that is all that is present, but .arcconfig will override it if
      available.  The idea behind letting the local hgrc override .arcconfig is that
      the developer may need to do testing against another server, and not dirty the
      working directory.
      
      Originally I was going to just try to read the callsign in `getrepophid()` if it
      wasn't present in the hg config.  That works fine, but I think it also makes
      sense to read the URL from this file too.  That would have worked less well
      because `readurltoken()` doesn't have access to the repo object to know where to
      find the file.  Supplimenting the config mechanism is less magical because it
      reports the source and value of the properties used, and it doesn't need to read
      the file twice.
      
      Invalid hgrc files generally cause the program to abort.  I only flagged it as a
      warning here because it's not our config file, not crucial to the whole program
      operating, and really shouldn't be corrupt in the typical case where it is
      checked into the repo.
      
      Differential Revision: https://phab.mercurial-scm.org/D7934
      59b3fe1e
    • Matt Harbison's avatar
      config: add a function to insert non-file based, but overridable settings · e2278581
      Matt Harbison authored
      This will be used in the next patch.
      
      Until relatively recently (473510bf0575), there was no official way for
      extensions to inject per-repo config data, so it probably makes sense that
      `ui.setconfig()` items are sticky, and not affected by loading more config
      files.  But that makes it cumbersome if the extension wants to allow the data it
      might add to be overridden by any data in the local hgrc file.  The only thing I
      could get to work was to load the local hgrc first, and then check if the source
      for the config item that should be overridden was *not* the local hgrc file
      name.  But that's brittle because in addition to the file name, the source
      contains the line number, there are the usual '\' vs '/' platform differences,
      etc.
      
      Differential Revision: https://phab.mercurial-scm.org/D7933
      e2278581
    • Matt Harbison's avatar
      tests: restore phabricator tests and regenerate the recordings · a5e3f384
      Matt Harbison authored
      These contain the new API chatter.  Most of the changes are because some new
      commits were created, but they're pretty obviously equivalent.  I have no idea
      why the last recording contains real data, whereas it previously looked fake.
      
      Differential Revision: https://phab.mercurial-scm.org/D7920
      a5e3f384
  6. Jan 07, 2020
  7. Jan 18, 2020
  8. Jan 21, 2020
    • Gregory Szorc's avatar
      hgdemandimport: apply lazy module loading to sys.meta_path finders · f81c17ec
      Gregory Szorc authored
      Python's `sys.meta_path` finders are the primary objects whose job it
      is to find a module at import time. When `import` is called, Python
      iterates objects in this list and calls `o.find_spec(...)` to find
      a `ModuleSpec` (or None if the module couldn't be found by that
      finder). If no meta path finder can find a module, import fails.
      
      One of the default meta path finders is `PathFinder`. Its job is to
      import modules from the filesystem and is probably the most important
      importer. This finder looks at `sys.path` and `sys.path_hooks` to do
      its job.
      
      The `ModuleSpec` returned by `MetaPathImporter.find_spec()` has a
      `loader` attribute, which defines the concrete module loader to use.
      `sys.path_hooks` is a hook point for teaching `PathFinder` to
      instantiate custom loader types.
      
      Previously, we injected a custom `sys.path_hook` that told `PathFinder`
      to wrap the default loaders with a loader that creates a module object
      that is lazy.
      
      This approach worked. But its main limitation was that it only applied
      to the `PathFinder` meta path importer. There are other meta path
      importers that are registered. And in the case of PyOxidizer loading
      modules from memory, `PathFinder` doesn't come into play since
      PyOxidizer's own meta path importer was handling all imports.
      
      This commit changes our approach to lazy module loading by proxying
      all meta path importers. Specifically, we overload the `find_spec()`
      method to swap in a wrapped loader on the `ModuleSpec` before it
      is returned. The end result of this is all meta path importers should
      be lazy.
      
      As much as I would have loved to utilize .__class__ manipulation to
      achieve this, some meta path importers are implemented in C/Rust
      in such a way that they cannot be monkeypatched. This is why we
      use __getattribute__ to define a proxy.
      
      Also, this change could theoretically open us up to regressions in
      meta path importers whose loader is creating module objects which
      can't be monkeypatched. But I'm not aware of any of these in the
      wild. So I think we'll be safe.
      
      According to hyperfine, this change yields a decent startup time win of
      5-6ms:
      
      ```
      Benchmark #1: ~/.pyenv/versions/3.6.10/bin/python ./hg version
        Time (mean ± σ):      86.8 ms ±   0.5 ms    [User: 78.0 ms, System: 8.7 ms]
        Range (min … max):    86.0 ms …  89.1 ms    50 runs
      
        Time (mean ± σ):      81.1 ms ±   2.7 ms    [User: 74.5 ms, System: 6.5 ms]
        Range (min … max):    77.8 ms …  90.5 ms    50 runs
      
      Benchmark #2: ~/.pyenv/versions/3.7.6/bin/python ./hg version
        Time (mean ± σ):      78.9 ms ±   0.6 ms    [User: 70.2 ms, System: 8.7 ms]
        Range (min … max):    78.1 ms …  81.2 ms    50 runs
      
        Time (mean ± σ):      73.4 ms ±   0.6 ms    [User: 65.3 ms, System: 8.0 ms]
        Range (min … max):    72.4 ms …  75.7 ms    50 runs
      
      Benchmark #3: ~/.pyenv/versions/3.8.1/bin/python ./hg version
        Time (mean ± σ):      78.1 ms ±   0.6 ms    [User: 70.2 ms, System: 7.9 ms]
        Range (min … max):    77.4 ms …  80.9 ms    50 runs
      
        Time (mean ± σ):      72.1 ms ±   0.4 ms    [User: 64.4 ms, System: 7.6 ms]
        Range (min … max):    71.4 ms …  74.1 ms    50 runs
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7954
      f81c17ec
    • Gregory Szorc's avatar
      hgdemandimport: disable on Python 3.5 · c5e0a9b9
      Gregory Szorc authored
      The demand importer functionality isn't working at all on Python 3.5.
      I'm not sure what's wrong.
      
      Since it isn't working, let's disable it completely.
      
      ```
      $ HGRCPATH= hyperfine -w 1 -r 50 -- "~/.pyenv/versions/3.5.9/bin/python ./hg version" \
        "HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version"
      Benchmark #1: ~/.pyenv/versions/3.5.9/bin/python ./hg version
        Time (mean ± σ):     163.7 ms ±   2.2 ms    [User: 148.5 ms, System: 15.7 ms]
        Range (min … max):   161.0 ms … 170.2 ms    50 runs
      
      Benchmark #2: HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version
        Time (mean ± σ):     164.3 ms ±   1.4 ms    [User: 148.2 ms, System: 16.6 ms]
        Range (min … max):   161.4 ms … 169.8 ms    50 runs
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7953
      c5e0a9b9
  9. Jan 18, 2020
    • Gregory Szorc's avatar
      py3: suppress unraisable exceptions in test-worker.t · b5aaa09b
      Gregory Szorc authored
      Python 3.8 calls sys.unraisablehook when an unraisable
      exception is encountered. The default behavior is to print a
      warning.
      
      test-worker.t was triggering this hook due to a race between
      a newly forked process exiting and that process's
      _os.register_at_fork handlers running. I was seeing the
      stdlib's random module in the stack re-seeding itself. Although
      there could be other after-fork handlers in the mix.
      
      This commit defines sys.unraisablehook to effectively no-op.
      This suppresses the warning and makes test output on Python 3.8
      consistent with prior versions. test-worker.t now passes on
      Python 3.8.
      
      Differential Revision: https://phab.mercurial-scm.org/D7949
      b5aaa09b
  10. Jan 20, 2020
  11. Jan 18, 2020
  12. Nov 21, 2019
  13. Nov 17, 2019
    • Pierre-Yves David's avatar
      localrepo: recognize trivial request for '.' · bfaf4c67
      Pierre-Yves David authored
      Same logic as for `null`, this is a command request and skipping the revset
      logic can avoid triggering the changelog filtering logic.
      
      Differential Revision: https://phab.mercurial-scm.org/D7495
      bfaf4c67
    • Pierre-Yves David's avatar
      localrepo: fastpath access to "." · d86dede1
      Pierre-Yves David authored
      "." is just an alias for `p1(wdir())`, let us handle it that way.
      
      Differential Revision: https://phab.mercurial-scm.org/D7494
      d86dede1
    • Pierre-Yves David's avatar
      localrepo: also fastpath access to working copy parents when possible · 85c4cd73
      Pierre-Yves David authored
      If the filter level guarantee that the working copy parents will be visible, we
      allow fast path access to them. With this change multiple commands can now run
      without triggering filtering.
      
      After using the quick access mechanism introduced, the whole series results in
      pretty good performance gain:
      
      ```
      All benchmarks:
      
             before           after         ratio
           [8e09551206f5]       [36b2f659]
      -       711±0.8ms       60.7±0.2ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       712±0.8ms       61.6±0.2ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         690±1ms       93.5±0.3ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         688±1ms       93.8±0.3ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         714±1ms       60.7±0.8ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         713±1ms       60.9±0.3ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         689±1ms       93.7±0.2ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         687±2ms       92.8±0.2ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         799±2ms       98.1±0.6ms     0.12  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       800±0.8ms      100.0±0.4ms     0.12  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -       711±0.9ms        111±0.2ms     0.16  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         711±1ms        112±0.3ms     0.16  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         760±1ms       59.8±0.1ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         763±2ms       62.2±0.3ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         689±1ms       93.1±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         688±1ms       94.3±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         763±1ms       60.1±0.2ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         763±1ms       62.1±0.4ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -       689±0.8ms       93.2±0.2ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       687±0.9ms       94.1±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7492
      85c4cd73
  14. Jan 16, 2020
  15. Dec 26, 2019
  16. Jan 14, 2020
  17. Jan 16, 2020
  18. Jan 15, 2020
  19. Dec 28, 2019
    • Matt Harbison's avatar
      tests: stabilize test-subrepo-svn.t on Windows · e598c874
      Matt Harbison authored
      This partially reverts 991e4404e910, because the URL form of `C:\...` gets
      escaped to `C%3A/...`, which breaks the substitution of $TESTTMP.
      
      The forget command on 'notafile*' errored out with:
      
         notafile*: The filename, directory name, or volume label syntax is incorrect
      
      which I think is because '*' isn't a legal character in a file name (though I
      can't trigger this directly from MSYS or cmd.exe for some reason).
      
      Differential Revision: https://phab.mercurial-scm.org/D7816
      e598c874
  20. Jan 13, 2020
Loading