Skip to content
Snippets Groups Projects
  1. Jul 19, 2023
  2. Jul 17, 2023
    • Georges Racinet's avatar
      CommitService.FindCommits: implement 'include_referenced_by' · b5e96533
      Georges Racinet authored
      The implementation itself is more general than `FindCommits`: we
      make it an option in `message.commit()`.
      
      For this, we need to read all state files. Because `FindCommits`
      may return lots of commits, we do it once and cache the reverse mapping
      on the repository object. Of course this is somewhat heavy if only
      one commit is being queried, especially if the pattern is about only
      one type of refs (e.g. branch refs, whose numbers are much less than all past
      special refs). An improvement would be to remember which type of file has
      been read already, and load the files on-demand. Another improvement would
      be to have an efficient format allowing to have all refs in one single db
      file.
      
      Since it is unlikely that keep-arounds
      would be asked in this way, we omit them for the time being.
      
      Most of the actual testing is done as a Gitaly Comparison test. We don't
      have a formal definition of the matching at the time being, so this is
      defined by the examples in the test (reading Git source code should provide
      better answers).
      
      Finally, RHGitaly should grow the `message.commit` equivalent, but it would not
      be useful right now. However, if `FindCommit` would turn out to also get this
      option, we'd have to do the Rust version.
      
      Closes #136
      b5e96533
  3. Jul 12, 2023
  4. Jul 11, 2023
    • Georges Racinet's avatar
      RepositoryService: implement RemoveAll · 1a6013fb
      Georges Racinet authored
      Actually, this method is called by `gitaly-backup` as of Gitaly 15.10 only
      (forwarded to the Rake task in upstream Git commit 4be1f22815bed, part of the
      15.11 development cycle, not imported in Heptapod Rails repo yet).
      
      Also, since for the time being an HGitaly storage always comes on top of
      a regular Gitaly storage at the same path, we will actually want *not* to
      call the HGitaly version for lots of time.
      1a6013fb
    • Georges Racinet's avatar
      RepositoryService: implement Get/SetCustomHooks · 9df798b0
      Georges Racinet authored
      According to Gitaly commits a87977cf909a4c2c5a3d7b53e21e3fdf2e5e5048
      and ebc3336284d9ef5f2242e47d433aa94e4093ec2a, this is indeed a simple
      renaming.
      
      We don't bother about deduplication in test fixture wrapping methods.
      After all, deprecation will lead to removal quite soon.
      
      Closes #140
      9df798b0
  5. Jul 08, 2023
    • Georges Racinet's avatar
      Merged stable branch into default · 49074aa6
      Georges Racinet authored
      Developments on stable branch were entirely driven by RHGitaly,
      leading to better matching of Gitaly in corner cases and errors.
      
      A change had to be made for Comparison tests to pass:
      the error message in `FindCommit` with no arguments at all is now
      the one about the `repository` argument missing instead of `revision`.
      This is so much a corner case that we don't bother matching and
      simply add `same_details=False`. The change may have happened anywhere
      between Gitaly v15.5 and v15.9.
      49074aa6
    • Georges Racinet's avatar
      Bump Gitaly protocol to v15.9 · 9898801b
      Georges Racinet authored
      9898801b
    • Georges Racinet's avatar
      CI/CD: work if Cargo is more globally available · da452a65
      Georges Racinet authored
      For GitLab 15.9, we'll take advantage of the fact that
      upstream CI image does have the Rust toolchain ( installed
      to `/usr/local`).
      However it did not keep `/root/.cargo/env`.
      da452a65
  6. Jul 05, 2023
  7. Jun 30, 2023
  8. Jun 29, 2023
    • Georges Racinet's avatar
      RHGitaly: CommitService.FindCommit implementation · 6e654158
      Georges Racinet authored
      This is now a direct application of `gitlab_revision_node_prefix()`.
      Perhaps worth of notice is the fact thay we stay purely async until
      the revision is resolved as a `NodePrefix`, and only spawn a thread
      once it is really needed (access to repository `Changelog`).
      6e654158
    • Georges Racinet's avatar
      CommitService.FindCommit: errors for corner cases · 5c477c33
      Georges Racinet authored
      As usual, the Rust reimplementation raises some questions, and we answer them.
      The case of empty (missing) revision was spotted because Gitaly returns
      the error about it even if the repo argument is missing.
      5c477c33
    • Georges Racinet's avatar
      RHGitaly: message::commit_for_node_prefix · 6b54aa74
      Georges Racinet authored
      This method is fairly simple, but it has the tremendous advantage
      to flatten three possible `RevlogError` into one, considerably
      simplifying error treatment for the caller.
      6b54aa74
    • Georges Racinet's avatar
      RHGitaly: repository loading helper for unary RPC methods · 8b6fdf35
      Georges Racinet authored
      This is in particular useful because it makes the return type of
      the `spawn_blocking` call explicit, a hint that the compiler would
      request even for so simple a method as `FindCommit`.
      
      Like `load_repo_and_stream()` it takes care of converting some errors
      into the proper `Status`, still letting the caller define what happens
      with `RepoSpecError`, which may have to differ from one request to the other.
      8b6fdf35
    • Georges Racinet's avatar
      RHGitaly: comment typo · 12caab4c
      Georges Racinet authored
      12caab4c
  9. Jun 16, 2023
    • Georges Racinet's avatar
      RHGitaly: GitLab revision resolution as node. · 734564f0
      Georges Racinet authored
      The `gitlab_revision_node_prefix()` function will be used in all
      gRPC methods that accept arguments that are single GitLab revisions.
      Even those that take ranges would use it, just less directly.
      
      `CommitService.FindCommit` would be the most straightforward case,
      but there are many more.
      
      Closes #126
      734564f0
    • Georges Racinet's avatar
      RHGitaly: reading the GitLab default branch file · c81b8f78
      Georges Racinet authored
      As noted in comment, this should really be in the `store` subdirectory,
      but that is a fight (data migration) for another day.
      c81b8f78
    • Georges Racinet's avatar
      RHGitaly: utilities to resolve refs as Nodes · 2c80b078
      Georges Racinet authored
      `gitlab::state::lookup_typed_ref_as_node` is the specialization of
      `map_lookup_typed_ref` to return `Node`s, hence it is working on a single
      stream of typed refs, whereas the higher level `gitlab::revision::full_ref_node`
      is the specialization of `map_full_ref` that works for any ref given by
      its full path.
      2c80b078
  10. Jun 15, 2023
  11. Jun 04, 2023
  12. Jun 14, 2023
    • Georges Racinet's avatar
      RHGitaly: gitlab::revision, only with `map_full_ref()` for now. · 5ac1a849
      Georges Racinet authored
      Of course it will grow the equivalenbt of Python's `gitlab_revision_changeset`,
      which is one of the most common helper functions in HGitaly, making
      the `FindCommit` gRPC method almost trivial.
      5ac1a849
    • Georges Racinet's avatar
      RHGitaly: reading keep-arounds state file · 725e8c52
      Georges Racinet authored
      This time, because there is no arbitrary name to consider, hence
      no bytes string, Tokio's `LinesStream` is perfectly suitable for
      our needs.
      725e8c52
    • Georges Racinet's avatar
      RHGitaly: reading GitLab ref files · bcab7028
      Georges Racinet authored
      This follows the file format and conventions defined in the server side
      `heptapod` Python package.
      
      Since everything is async, we actually provide Streams of TypedRef objects,
      and the `map_lookup_typed_ref` for the numerous use cases when one is looking
      for a specific ref.
      
      The file format is very primitive, so all we can do at this point is to
      perform a full scan, but it has room (version preamble) for more advanced
      formats in the future (e.g, append-only persistent hash map or similar).
      
      A preliminary version of this was using Tokio's `LineStream`, but this
      has several drawbacks:
      
      - it is unicode-centric, yielding `String`s
      - we had to implement our own `Stream`, keeping the `LineStream` as
        a field. Hence because `poll_next()` takes `&mut Pin<Self>` we had
        to write a pinning accessor, which is unsafe (see the doc for `std::pin`
        for more details).
      bcab7028
    • Georges Racinet's avatar
      RHGitaly: mapping file not found errors to `None` · 29fc9a2b
      Georges Racinet authored
      When a file contains a list of values, it is a common pattern that
      the absence of the file is equivalent to the list being empty.
      This `io_error_not_found_as_none` will help keeping duplication low
      (even if fairly trivial).
      29fc9a2b
  13. Jun 27, 2023
  14. Jun 11, 2023
Loading