1. 05 Nov, 2020 1 commit
    • Georges Racinet's avatar
      WIP demo testhelpers: translating a half of test-revset.t · 29a04e45242e
      Georges Racinet authored
      This corresponds to test-revset.t until this comment:
      "Test smartset.slice() by first/last()"
      
      On my workstation, the truncated test-revset.t takes 25-30 seconds to run:
      
          $ time ./run-tests.py -l test-revset.t
          running 1 tests using 1 parallel processes
          .
          # Ran 1 tests, 0 skipped, 0 failed.
          ./run-tests.py -l test-revset.t  28.51s user 4.03s system 98% cpu 32.869 total
      
      This translation runs in 0.3 seconds
      
          (venv3) ~/heptapod/hdk/default/py-heptapod $ pytest heptapod/tests/test_demo_testhelpers_revset.py
          =========================== test session starts ===========================
          platform linux -- Python 3.8.6, pytest-3.10.1, py-1.9.0, pluggy-0.13.1
          rootdir: /home/gracinet/heptapod/hdk/default/py-heptapod, inifile: pytest.ini
          plugins: cov-2.6.0, grpc-0.8.0
          collected 1 item
      
          heptapod/tests/test_demo_testhelpers_revset.py .                    [100%]
      
          ============================ warnings summary =============================
          heptapod/tests/test_demo_testhelpers_revset.py::test_revset
            /home/gracinet/heptapod/hdk/default/venv3/lib/python3.8/site-packages/mercurial/utils/stringutil.py:635: DeprecationWarning: invalid escape sequence '\d'
              return codecs.escape_decode(s)[0]
            /home/gracinet/heptapod/hdk/default/venv3/lib/python3.8/site-packages/mercurial/utils/stringutil.py:635: DeprecationWarning: invalid escape sequence '\d'
              return codecs.escape_decode(s)[0]
      
          -- Docs: https://docs.pytest.org/en/latest/warnings.html
          ================== 1 passed, 2 warnings in 0.28 seconds ===================
      
      Remarks and caveats:
      
        - we're not making assertions about internal representation of the revsets,
          especially to check optimizations. Arguably, these could belong to another
          test case
        - ignored tests related to `r3232`. Don't expect them to be a problem.
        - time to run was almost the same with only a dozen assertions. Could mean
          that most of the time is spent in the fixture. On the other side, the
          truncated `test-revset.t` is faster than the whole (28s vs 59s).
      29a04e45242e
  2. 11 Nov, 2020 5 commits
  3. 21 Nov, 2020 5 commits
  4. 19 Nov, 2020 3 commits
  5. 18 Nov, 2020 5 commits
    • Georges Racinet's avatar
      git: abort transactions pruning the default GitLab branch · e8f0746800f5
      Georges Racinet authored
      Instead of ignoring the prune (and hence making a slight
      discrepancy between Git and Mercurial content), we will
      refuse the transaction.
      
      Someone with enough commit rights to close the default branch
      can surely change it in the Heptapod project settings.
      
      This is ultimately because the native mode reads Mercurial
      content only. Of course, when it doesn't perform Git conversion,
      we'll still have to port that check, but the functional tests
      are also covering this, so we'll know.
      e8f0746800f5
    • Georges Racinet's avatar
      git: not scheduling prune of default GitLab branch for bookmarks · 4754af38da18
      Georges Racinet authored
      As explained in the doctest, this is very unwanted. Up to now
      we were just removing that prune at the end of the process.
      
      With the native mode (currently still using hg-git) we can't do
      that any more: we will need instead to abort the transaction if
      there is such a scheduled prune (mostly for other reasons, such
      as closed heads). Therefore the simplest here is to not schedule
      the prune.
      4754af38da18
    • Georges Racinet's avatar
      git: separate method for bookmarks filtering and branch prune. · 4f3582264e92
      Georges Racinet authored
      We split out the filtering logic and (GitLab) branch prune
      scheduling related to masking by bookmaks, before we add more
      rules to it, without changing any outcome for now.
      
      This is also an opportunity to clarify the comments and move them
      up the ladder: it's always nicer as a docstring.
      4f3582264e92
    • Georges Racinet's avatar
      git: split out methods to read default Git ref and branch · c53a189d66bd
      Georges Racinet authored
      This is a simple refactor, but we take the opportunity to explain
      the difference with the "default GitLab branch" of native
      repositories: they're stored differently, should be equal wherever
      it makes sense (it won't when native repositories won't use
      hg-git except for mirroring).
      c53a189d66bd
    • Georges Racinet's avatar
      Prune reasons: BookmarkRemoved now stores previous Git SHA · 158b7fe2174c
      Georges Racinet authored
      This puts it in conformity with its docstring. Actually the
      Rails app doesn't make anything of it at this point, but this
      was done along the way.
      158b7fe2174c
  6. 17 Nov, 2020 1 commit
  7. 16 Nov, 2020 1 commit
    • Georges Racinet's avatar
      PreReceive GitLab hook: pass over HEPTAPOD_ACCEPT_MR_IID · bdec902e9e18
      Georges Racinet authored
      Part of heptapod#368: the Rails app will be able to set
      this environment variable and we're now sending it back
      as the `accept_mr_iid` key to the listener for the pre-receive
      hook, so that the Rails app may apply merge permissions instead
      of (direct) push permissions.
      
      Using the (project-local) iid is better than the id, because
      the receiving end won't have to check that someone is trying
      to cheat with a MR on another project and is anyway fast
      compared to the overall amount of process on its side.
      
      --HG--
      branch : heptapod-0-16
      bdec902e9e18
  8. 15 Nov, 2020 2 commits
    • Georges Racinet's avatar
      Mercurial native mode: configuring through WSGI environment · 018805dc73db
      Georges Racinet authored
      This is part of heptapod#364.
      
      Heptapod Workhorse will pass the `X-HEPTAPOD-HG-NATIVE` header
      with the appropriate value, and we use it to set configuration
      on the wished repository accordingly.
      
      We could have made the `env` argument of the `load_repo()` method
      optional (and hence hadn't needed to adapt existing tests), but
      nothing would then prove that it wasn't forgotten, even with coverage
      proving that `load_repo()` is indeed called (which it does).
      018805dc73db
    • Georges Racinet's avatar
      native mode: configuring through process environment variables · edbb23858466
      Georges Racinet authored
      This is part of heptapod#364.
      
      Heptapod Shell cannot pass `--config` command-line arguments,
      because that is rightfully considered a potential security
      breach (it would allow to register a hook, hence for arbitrary
      code execution).
      
      So we resort to an environment variable. It will actually
      also be more practical for the Rails app (only one method,
      the env creator, to patch)
      edbb23858466
  9. 14 Nov, 2020 2 commits
    • Georges Racinet's avatar
      Mercurial native mode: notifying GitLab with Mercurial SHAs · 31d7839fc26b
      Georges Racinet authored
      This is the first part of heptapod#364
      
      If the new `heptapod.native` config flag is set, payloads of
      GitLab hooks will be made of Mercurial SHAs instead of Git
      SHAs.
      
      This will be used for native Mercurial projects, for which
      obviously GitLab notification hooks must contain Mercurial SHAs,
      since these are the only ones the Rails app is supposed to be
      aware of.
      
      For now, there's no facility to set this flag automatically
      but it can be used for testing in developer setups (by putting
      it in `hdk.hgrc`).
      
      ## Implementation details:
      
      Instead of going over all the places were a SHA is recorded that
      will end up in a hook call, we convert back to Mercurial right
      before we send the hook. This is perhaps good enough, while we are
      in the transitional way of operation of still converting to Git.
      Things will be very different anyway when we don't do that any more.
      31d7839fc26b
    • Georges Racinet's avatar
      Heptapod CI: reallowing failure on hg default dev branch · 8ca8eb0bfc94
      Georges Racinet authored
      This was forgotten in the big refactor of the CI setup.
      (the tests are currently not passing with hg-default, seems to
      be quite normal, an API change)
      8ca8eb0bfc94
  10. 10 Nov, 2020 2 commits
  11. 01 Nov, 2020 5 commits
  12. 26 Oct, 2020 2 commits
  13. 16 Oct, 2020 2 commits
    • Georges Racinet's avatar
      Heptapod CI: triggering HGitaly build · c1603fffa2fb
      Georges Racinet authored
      Since py-heptapod also serves as a common library for HGitaly,
      it makes sense to check the impact of landed changes on HGitaly.
      
      This will also propagate scheduler or trigger builds. For example
      if there's a rebuild of hg-default, it should trigger the rebuild of
      py-heptapod, which will trigger that of HGitaly. We'll have a
      few redundant buils along the way (hg-current didn't change in that
      example), but that's tolerable for the time being and could probably
      be further optimized.
      c1603fffa2fb
    • Georges Racinet's avatar
      Heptapod CI: using DAG to run 'install' job in parallel · d23f2dbb4cfd
      Georges Racinet authored
      The install job is expected now to be slower than the other,
      at least if all Docker images are already downloaded.
      d23f2dbb4cfd
  14. 15 Oct, 2020 1 commit
  15. 14 Oct, 2020 2 commits
  16. 30 Sep, 2020 1 commit