Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
heptapod
heptapod
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 4
    • Merge Requests 4
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

  • heptapod
  • heptapodheptapod
  • Issues
  • #431

Closed
Open
Created Mar 01, 2021 by Georges Racinet@gracinet🦑Owner9 of 9 tasks completed9/9 tasks

Special refs for native Mercurial repositories

Special refs in GitLab

GitLab stores interesting pointers, related as special refs in the Git repository, at least these prefixes:

class Repository
  REF_MERGE_REQUEST = 'merge-requests'
  REF_KEEP_AROUND = 'keep-around'
  REF_ENVIRONMENTS = 'environments'
  REF_PIPELINES = 'pipelines'

  ARCHIVE_CACHE_TIME = 60 # Cache archives referred to by a (mutable) ref for 1 minute

(from the Repository model)

Here's an example usage in Merge Requests:

  def ref_path
    "refs/#{Repository::REF_MERGE_REQUEST}/#{iid}/head"
  end

  def merge_ref_path
    "refs/#{Repository::REF_MERGE_REQUEST}/#{iid}/merge"
  end

  def train_ref_path
    "refs/#{Repository::REF_MERGE_REQUEST}/#{iid}/train"
  end

(from the MergeRequest model)

What to do for native Mercurial repositories

We don't have Mercurial equivalents. This is not a problem for hg-git based repositories, because those refs will be entirely managed within the Git repository, but it leads to problems with native repositories, such as #423 (closed) (cleanup of obsolete head and merge MR refs).

Also, we don't have currently a practical problem: clearly the Rails app has fallbacks if, e.g, the merge MR ref is nil, on a merged MR, but we shouldn't rely on such resilience for a condition that is clearly exceptional from upstream GitLab point of view.

Perhaps we could use local tags to represent them. Bookmarks are probably not appropriate, because they could be mixed with regular, user set, ones. That would be a bit as if the special refs were in the refs/heads namespace for a Git repository.

The case of "keep-arounds" is special. There sole purpose is to avoid the target Git commits to be garbage collected. we don't need them We need them just in case some kind of garbage collecting is introduced in the future for Mercurial obsolete changesets. What we do need right now is HGitaly being able to serve obsolete changesets if specified by a full hash, and that's what we are doing already.

Sub Tasks

(only for native projects in Heptapod 0.20 series)

  • py-heptapod!52 (merged): primitives to store/manage/ensure from Git all special refs
  • py-heptapod: ensure from Git in all Mercurial transactions. Edit: only for branches and tags
  • #439 (closed) (Rails): backup and restore all GitLab ref state files
  • heptapod (Rails): ensure all GitLab ref state files from Git prior to backups
  • hgitaly#52 (closed): RefExists for special refs
  • hgitaly#48 (closed): WriteRef for special refs
  • hgitaly#49 (closed): DeleteRefs for special refs
  • hgitaly#50 (closed): ensure from Git in all read operations involving any kind of ref
  • heptapod (Rails): perform all special ref writes and deletions on both sides by calling Gitaly and HGitaly. Special case for Merge Request creation (FetchSourceBranch)
Edited Mar 12, 2021 by Georges Racinet
Assignee
Assign to
Heptapod 0.20.2
Milestone
Heptapod 0.20.2
Assign milestone
Time tracking
None
Due date
None