-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking topics as remote refs #326
Comments
It already does... except git doesn't like it:
The problem is mercurial exposes topics as branches with
So I guess the only thing really needed is to translate |
(and obviously, since a branch can already be named with |
It looks like if you create a branch with // in its name, like Presumably you can tell which interpretation to use by the |
Mercurial does, however, forbid topics with // in their names. |
So... the weird thing is that branchmap apparently only exposes one topic. At least that's the behavior I'm seeing. There's a separate branchmaptns command that has all topics, but again it doesn't allow to distinguish between topics and branches with weird names. That branchmap exposes one topic seems like a bug, actually. |
It looks like branchmap has some state in .hg/cache/branch2-served which causes its output to change. I don't know what's supposed to happen with it, but cursory review of the hg-evolve code suggests one should use branchmaptns for topics anyway if the topics-namespaces capability is advertised. I tried creating two topics
So, empirically, with my small sample size, it looks like it is distinguishable: trailing By code inspection, I see logic that appears to make this intentional in hg-evolve: The documentation also suggests this is intentional:
|
So, apart from the refs problem, the thing about topic changesets is that, like for branch names, the topic name is hardcoded in the changeset itself, not as separate metadata. That data is, like for branch names, again, not represented in the git commit that would be created for it. As I understand it, once a topic is "promoted" to a non-draft state, a fresh changeset is created again without the topic name in it, which means that new changeset would map to the same git commit, which would conflict and break idempotency. So, this is not, in fact, as simple as exposing the refs somehow. |
I think this not accurate. The topic information remains encoded and the changeset identity does not change. Although |
Filed a Mercurial bug report about the confusing cmd=branchmap behaviour: https://bz.mercurial-scm.org/show_bug.cgi?id=6890 But I would guess that doesn't need to get in the way here, since it looks like a topic-aware client should just use cmd=branchmaptns anyway. |
That's not what their wiki was saying :( |
Can you be more specific? Which part of the wiki? |
https://wiki.mercurial-scm.org/TopicPlan |
I think that's consistent with hg log ceasing to display it, no? hg hides, rather than discards, historical records. See also, e.g., Sec. 2.4.4 "Case 4: active topic, topic is closed" which shows the topic in a commit as faded, not deleted, or:
Nothing in the plan or the implementation that I see indicates altering changeset identity or discarding the topic-labelled changesets when topics are merged and published. (When changesets are rewritten via changeset evolution, yes, changeset identity changes and there are obsolescence markers published to map old changesets to new changesets. But, while it would be nice for git to take advantage of that, that's not the issue here.) |
Can git-cinnabar be convinced to track topics as remote refs, for repositories that use the hg topic extension?
For example, perhaps the most recent head of a topic T on a branch B could be exposed via refs/heads/branches/B/topics/T, even if git-cinnabar doesn't do anything with obsolete markers.
The text was updated successfully, but these errors were encountered: