Skip to content
Snippets Groups Projects
  1. Jan 06, 2024
    • Georges Racinet's avatar
      hg-evolve 11.1: working around half-patched wirepeer · da1e5a49
      Georges Racinet authored
      This fixes the only problem with hg-evolve 11.1 and Mercurial 6.6.
      
      Tests for the push-mirror feature were failing, and even tests about
      the sshd testing server because the `sshpeer` module gets imported by pytest
      before the parent class of `sshv1peer` is patched by `hgext3rd.topic.server`.
      Ironically the sequence of imports is:
      
         `hgitaly.gitlab_ref` > `heptapod.branch` > `hgext3rd.topic` (for fqbn methods).
           > `mercurial.hg`
      
      Upon push, the local mercurial sees the `exo-ext-tns-heads` capability and
      therefore expects a `tns_heads` method on the peer object, but it turns out
      that the `sshv1peer` (which itself inherits `wireprotov1.wirepeer`) has
      already been defined. Since that latter definition is static, we need to
      reload the enclosing module in order for the patched version to be executed.
      
      Fortunately, it turns out that reloading `sshpeer` from the tests is enough,
      which comes as a surprise in the case of service tests (usually monkey patches
      of the service code does not work from them).
      
      The sad part is that it is not possible to write functional tests for the
      push remote mirrors (the main consumer of these methods), because GitLab API
      does not expose setters for SSH details and pushing to localhost is more
      strictly prohibited in the Rails app (as of GitLab 16.3) than, e.g., in the
      case of Project imports.
      da1e5a49
    • Georges Racinet's avatar
      MercurialRepositoryService tests: using RepoWrapper.write_hgrc · 36af44ba
      Georges Racinet authored
      and separated the phases config fragment generation, as it will
      be useful for upcoming tests with successive pushes on peers
      with different capabilities.
      36af44ba
  2. Jan 05, 2024
  3. Dec 23, 2023
    • Georges Racinet's avatar
      Merged oldstable branch in stable · b62026a8
      Georges Racinet authored
      b62026a8
    • Georges Racinet's avatar
      RHGitaly: bump hg-core dependency to 6.5.3 · de615355
      Georges Racinet authored
      This matches the version used in Heptapod 0.40 and the future 0.41.
      
      HG: Enter commit message.  Lines beginning with 'HG:' are removed.
      HG: Leave message empty to abort commit.
      HG: --
      HG: user: Georges Racinet <georges.racinet@octobus.net>
      HG: topic 'bump-proto'
      HG: branch 'stable'
      HG: changed rust/Cargo.lock
      HG: changed rust/mercurial.rev
      de615355
    • Georges Racinet's avatar
      Bump Gitaly protocol to v16.3 · 9ae42b08
      Georges Racinet authored
      As often, it doesn't change in patch versions.
      9ae42b08
    • Georges Racinet's avatar
      DiffService.CommitDiff: fully implement whitespace options · 582aee6e
      Georges Racinet authored
      In Gitaly protocol 16.3, the `ignore_whitespace_changes` boolean
      disappears, being replaced with a 3-valued enum, corresponding
      to two levels of whitespace ignoring in Git.
      
      The disparition means that the attribute was long deprecated, and
      no upstream client had been using it for a while, so it was about
      time we implement the "new" `WhitespaceChanges` enum.
      
      Closes #137
      582aee6e
  4. Dec 20, 2023
  5. Dec 19, 2023
  6. Dec 17, 2023
    • Georges Racinet's avatar
      OperationService.UserFFBranch implementation · 12ed203c
      Georges Racinet authored
      Closes #164
      
      In the course of implementation, we introduce the new `changeset_by_commit_id`
      helpers which are useful in cases where the input is expected to be a full
      Node ID (instead of any Git revspec) and that is to be validated (because
      Gitaly does). Would need their separated testing to commit them separately,
      too lazy today for that.
      12ed203c
  7. Dec 19, 2023
  8. Dec 17, 2023
  9. Dec 14, 2023
    • Georges Racinet's avatar
      OperationService: implement UserSquash · ddc25d39
      Georges Racinet authored
      The breakthrough is that HGitaly is able to control internal Git mirroring
      and this can be tested from HGitaly (ordinary) integration tests.
      
      The presence of the `commit_author` and `timestamp` attributes raise some
      questions more explicitely than it was the case in the Rails app, where the
      feature has been implemented long ago by spawning a Mercurial subprocess.
      We decided to behave identically, and in particular to postpone the question of
      representing the difference between committer and author to another time,
      as such a distinction does not exist currently in Mercurial (could be an extension
      around providing that, though).
      
      The `UserSquash` method in itself was only chosen because it does not
      have many options and is at its core very simple to implement.
      
      Closes #163
      ddc25d39
    • Georges Racinet's avatar
      HGitalyServicer: loading repository for mutation · 15f7720b
      Georges Racinet authored
      The `HGitalyServicer` base class now provides a `for_mutation_by`
      optional argument that triggers the setting of all needed repository
      config items and environment variables as already in use when spawning
      Mercurial subprocesses from the Rails application: repository mode (nativity,
      with Git mirroring or not), link to MR to allow distinguishing between
      merge permissions and direct pushes, etc.
      
      The acting user is part of the request message in all examples we
      have considered so far, hence passed down by the caller (concrete
      service subclass). Other metadata are expected as invocation metadata
      (hence HTTP/2 headers, which matches what also happens between Workhorse
      and the Rails aplication).
      
      We had to add invocation metadata handling to the `FakeContext`
      to maintain coverage. The import path from `grpc` is probably
      instable, but we'll live with it.
      
      
      WIP implement UserSquash, with Git mirroring or not
      
      Needs lint to be ok, coverage to be 100%, a decision about
      itering on invocation metadata so much.
      
      The breakthrough is that HGitaly is able to control internal Git mirroring
      and this can be tested from HGitaly (ordinary) integration tests.
      At this point this does not implement passing of user information to internal API
      (can only be tested from functional tests, as it requires
      a fully working Heptapod instance).
      
      The `UserSquash` method in itself was only chosen because it does not
      have many options and is at its core very simple to implement.
      
      
      WIP to fold: refactoring putting mutation metadata in repo config/environ
      
      
      WIP first version working in functional tests
      
      
      WIP some linting (grpc import in tests will be used later)
      
      
      WIP added tests with Gitaly
      
      
      Almost complete (for_mr_iid missing) except coverage when skipping Gitaly Comparison
      
      
      accept_mr_iid
      
      
      Full coverage for UserSquash
      15f7720b
    • Georges Racinet's avatar
      HGitalyServicer: utility to call Mercurial commands · 6f9ca3f8
      Georges Racinet authored
      Very similar to what, e.g., mercurial-testhelpers and many
      similar tools do. This is as close to the CLI as possible, and
      suitable for methods that can be implemented in a single mutating command,
      as the command will typically enclose the actual mutation in its own
      transaction.
      
      Methods to be implemented as a succession of mutation commands should
      better manage a single transaction themselves, probably at the price
      of a greate duplication from Mercurial core.
      6f9ca3f8
  10. Nov 30, 2023
  11. Dec 12, 2023
  12. Nov 24, 2023
  13. Nov 22, 2023
  14. Nov 21, 2023
  15. Nov 20, 2023
    • Georges Racinet's avatar
      RemoveRepository: make repo name in trash unique · 00a51b36
      Georges Racinet authored
      In case a project id is reused (Heptapod application context, since the
      repo path is derived from the project id) or a repository path is reused
      (e.g. in RSpec tests), it is possible that a previous failed cleanup
      (crash or brutal stop before the final trashed repo `rmtree) would
      get in the way of the removal.
      
      Unlikely, but easy to prevent by making the name in trash unique (time-based,
      random would also have been good).
      00a51b36
    • Georges Racinet's avatar
      RemoveRepository: better robustness in intermediate situations · 10d6717c
      Georges Racinet authored
      It was a mistake to depend on `load_repo`, as it will fail if,
      e.g., the `.hg` sub directory does not exist (seen in Rails
      RSpec tests) and various corrupted cases that a *removal* should
      clean up.
      
      The price to pay is the transactionality of the roster, but we
      cannot lock it properly without a repo. In theory in should be
      possible to instantiate the `Vfs` separately, but it does not seem
      to matter so much.
      
      With this change, if removing the working directories fails, it
      will not prevent removing the trashed repository (but of course
      we risk a later collision in workdirs).
      
      Backs out in particular changeset 1c735d40cfe7
      10d6717c
  16. Nov 18, 2023
  17. Nov 15, 2023
    • Georges Racinet's avatar
      Fixing a startup problem · 2a621d00
      Georges Racinet authored
      The error message is
      
      ```
      *** failed to import extension "hgitaly": unicode '[OPTIONS]...' found in cmdtable.hgitaly-serve
      ```
      
      It is completely obscure why this has not been a problem before. Got this with
      Mercurial 6.4.5, then 6.4 on Python 3.9 (usually running with Python 3.10 if that
      makes any difference).
  18. Nov 13, 2023
Loading