Skip to content
Snippets Groups Projects
  1. Feb 28, 2024
  2. Jan 09, 2024
  3. Jan 05, 2024
    • Georges Racinet's avatar
      LastCommitForPath: implement wildcard pathspecs · 4bd70d208179
      Georges Racinet authored
      Actually, LastCommitForPath (LCFP) was behaving as if always called
      with the literal pathspecs option, so we had to implement the
      non-literal case, which is still not general enough, but handles cases
      with wildcards.
      
      The matching method is rather ugly, and done by trial and error, but
      Git reference code is not simple either, and the documentation is only
      partially true (does not mention implicit prefix behaviours, pretends
      that Git uses fnmatch(3), which is not true in my checkout of v2.40.0)
      
      Closes #165
      4bd70d208179
  4. Jan 03, 2024
  5. Sep 22, 2023
    • Georges Racinet's avatar
      CommitService.LastCommitForPath: improve testing and special cases · c77043842f65
      Georges Racinet authored
      There were no Gitaly Comparison tests for this method.
      Also, some special cases (e.g., empty `path`) were only
      tested indirectly by the fact that the current version of
      `ListLastCommitsForTree` uses the same internal function.
      
      As expected, this uncovers some minor bugs, such as error on
      unresolvable revision, which we fix right away
      c77043842f65
  6. May 03, 2023
    • Georges Racinet's avatar
      CommitService.CommitLanguages implementation with tokei · 77e37a03fcfe
      Georges Racinet authored
      This introduces a new binary dependency on the
      [Tokei](https://crates.io/crates/tokei) code statistics tool.
      
      The path to the Tokei executable is configurable
      as `hgitaly.tokei-executable`, defaulting to `tokei`.
      
      Strict comparison with Gitaly is not fully possible, as Tokei
      does not produce the very same results as GitHub Linguist (or
      `go-enry` which is the library Gitaly is currently moving to).
      For instance `robots.txt` is detected as the `robots.txt` language
      by Linguist and as `Plain Text` by tokei. That being said, we
      can compare more frequent results, namely Python and Ruby.
      
      We vendor the `languages.json` file from GitHub Linguist to add the
      color information (not part of Tokei results), with the same defaulting
      logic as Gitaly (see the detailed docstrings), based on a hash of the
      language name. We were lucky to find a programming language (COBOL) to
      base our tests on.
      
      It is important to sort the results in decreasing order, because
      the Rails app considers only the 5 most frequent languages in the
      repository, and does so by truncating at the 5 first elements.
      77e37a03fcfe
  7. Jul 17, 2023
    • Georges Racinet's avatar
      CommitService.FindCommits: implement 'include_referenced_by' · b5e96533e86f
      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
      b5e96533e86f
  8. Jul 08, 2023
    • Georges Racinet's avatar
      Merged stable branch into default · 49074aa6e1f7
      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.
      49074aa6e1f7
  9. Jul 05, 2023
  10. Jun 29, 2023
    • Georges Racinet's avatar
      RHGitaly: CommitService.FindCommit implementation · 6e6541585def
      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`).
      6e6541585def
    • Georges Racinet's avatar
      CommitService.FindCommit: errors for corner cases · 5c477c3311dd
      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.
      5c477c3311dd
  11. Jun 07, 2023
  12. Jun 06, 2023
    • Georges Racinet's avatar
      FindCommit comparison tests: ensure only GitLab state files are used · 3c6b018d3924
      Georges Racinet authored
      Previously, the test was passing because the Python reference implementation
      of HGitaly relies on `scmutil.revsingle` for revisions not found in GitLab
      state files, including tags given in simple form (e.g. `v1.2.3`).
      
      But RHGitaly will rely on the GitLab state files only, hence we need to
      ensure that the tags state file contains the one we introduce, which is
      shadowing in the short SHA case
      
      The added GitLab sync has the effect of removing directly set tags that have
      no Mercurial counterpart from the GitLab state file, that's why it has to occur
      before `write_ref()` in this test of collision/shadowing were Mercurial and Git
      tags must have different names.
      3c6b018d3924
    • Georges Racinet's avatar
      revision: precedence rules in case of collisions · bbca598ebf82
      Georges Racinet authored
      As illustrated with the new assertions in `test_compare_find_commit`,
      it turns out that in Gitaly, tags have precedence over branches
      (unsurprisingly) and over shortened commit ids, but not on full commit
      ids.
      bbca598ebf82
  13. May 16, 2023
  14. May 15, 2023
    • Georges Racinet's avatar
      revision: support fully qualified tag refs · 88981e79d7de
      Georges Racinet authored
      There was even an old TODO about that
      88981e79d7de
    • Georges Racinet's avatar
      FindCommit: initial Gitaly Comparison test · 364d32a1513c
      Georges Racinet authored
      This method of the `CommitService` had no Gitaly Comparison test,
      because it was implemented before these tests were even considered.
      
      Such a test will be the main testing of the upcoming RHGitaly
      implementation.
      
      It turns out that we found a missing case: tag in the fully qualified
      ref notation (chances are that clients woud rather use `RefService.FindTag`
      but one never knows.
      364d32a1513c
  15. Apr 13, 2023
  16. Apr 12, 2023
  17. Mar 24, 2023
  18. Mar 22, 2023
  19. Mar 12, 2023
  20. Nov 16, 2022
  21. Mar 13, 2022
  22. Feb 13, 2022
    • Georges Racinet's avatar
      CommitService.ListCommits: basic implementation · 56379b042cdd
      Georges Racinet authored
      This is obviously very partial given the list of request options
      and the fact that this is handed straight to git-rev-list, hence
      to be complete, we should implement all possible meaning of
      revisions, including mixing the `..` and `...` notation with simple
      commit ids and refs whenever Git accepts it.
      
      Still, current usage in GitLab is limited to `Repository#between`,
      hence revisions is `[^FROM, TO]`. Of course, more advanced cases
      can appear any time, but at least we'll have the proper harness
      to implement them.
      
      The ordering options cannot match exactly Gitaly's, see the
      lengthy explanation in docstring about this.
      
      closes #72
      56379b042cdd
  23. Mar 02, 2022
  24. Nov 03, 2021
    • Georges Racinet's avatar
      Commit gRPC messages: providing body_size · 286ac2f23b0e
      Georges Racinet authored
      This was a long standing TODO, and it finally had bad consequences,
      such as heptapod#554, because the Rails app introduced an early
      return if body size is 0 in upstream 13.3.0 (see heptapod@b937e23d5321).
      
      In turn, to test this in comparison with Gitaly, we have to make the
      ironing of differences that should not matter a bit smarter. The
      trailing line ending thing should be settled at some point, though.
      286ac2f23b0e
  25. Oct 24, 2021
Loading