Skip to content

Add support for tracking topics as remote refs.#356

Open
riastradh wants to merge 1 commit intoglandium:masterfrom
riastradh:riastradh-issue326-topics
Open

Add support for tracking topics as remote refs.#356
riastradh wants to merge 1 commit intoglandium:masterfrom
riastradh:riastradh-issue326-topics

Conversation

@riastradh
Copy link
Copy Markdown

NOTE: New tests will require the hg-evolve extension to be installed and available. This change does not yet update the CI logic to make that happen, so I expect the new tests will fail until it is updated.

Like Mercurial branches, Mercurial topics are labels in the metadata of a changeset. While branches are meant for long-term history, topics are meant for short-term work-in-progress, like git feature branches for github pull requests. Once a topic is made public, the topic name is hidden by default. Each topic is associated with a branch; the fully-qualified name is written <branch>//<topic> when the branch is not implied.

This adds a new option 'topics' to the cinnabar.refs knob to expose topic T of branch B as any of

  • refs/heads/topics/<B>/<T>
  • refs/heads/topics/<B>/<T>/tip
  • refs/heads/topics/<B>/<T>/<SHA1>

depending on whether 'tips' or 'heads' is included too. When cinnabar.refs has 'topics' included, branch heads and bookmarks are also exposed under 'refs/heads/branches/...' and
'refs/heads/bookmarks/...' too like with certain other combinations of options.

Topics are detected using essentially the same method by which branches are detected. Once a topic is published, the corresponding refs/heads/topics/* refs will vanish.

When the remote hg server advertises support with the 'topics-namespaces' extension, use the 'branchmaptns' rather than 'branchmap' cmd to query the remote heads so we can distinguish between topics and branches.

By default, cinnabar.refs does not have 'topics' included, so there is no change to the semantics.

fix #326

@community-tc-integration
Copy link
Copy Markdown

No Taskcluster jobs started for this pull request

The allowPullRequests configuration for this repository (in .taskcluster.yml on the default branch) does not allow starting tasks for this pull request.

NOTE: New tests will require the hg-evolve extension to be installed
and available.  This change does not yet update the CI logic to make
that happen, so I expect the new tests will fail until it is updated.

Like Mercurial branches, Mercurial topics are labels in the metadata
of a changeset.  While branches are meant for long-term history,
topics are meant for short-term work-in-progress, like git feature
branches for github pull requests.  Once a topic is made public, the
topic name is hidden by default.  Each topic is associated with a
branch; the fully-qualified name is written <branch>//<topic> when
the branch is not implied.

This adds a new option `topics' to the cinnabar.refs knob to expose
topic T of branch B as any of

- refs/heads/topics/<B>/<T>
- refs/heads/topics/<B>/<T>/tip
- refs/heads/topics/<B>/<T>/<SHA1>

depending on whether `tips' or `heads' is included too.  When
cinnabar.refs has `topics' included, branch heads and bookmarks are
also exposed under `refs/heads/branches/...' and
`refs/heads/bookmarks/...' too like with certain other combinations
of options.

Topics are detected using essentially the same method by which
branches are detected.  Once a topic is published, the corresponding
refs/heads/topics/* refs will vanish.

When the remote hg server advertises support with the
`topics-namespaces' extension, use the `branchmaptns' rather than
`branchmap' cmd to query the remote heads so we can distinguish
between topics and branches.

By default, cinnabar.refs does not have `topics' included, so there
is no change to the semantics.

fix glandium#326
@riastradh riastradh force-pushed the riastradh-issue326-topics branch from 932e55b to f73dbda Compare December 8, 2025 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking topics as remote refs

1 participant