[null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-9e10c850cbeee6c0678d437b6f71914779e667ba.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-9e10c850cbeee6c0678d437b6f71914779e667ba.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-4aa351d8209252a7da91cd7ac4812cafcbde6622.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-4aa351d8209252a7da91cd7ac4812cafcbde6622.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-de51b324268b3fe4ae3f6453ab58ab8c8fa0c257.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-de51b324268b3fe4ae3f6453ab58ab8c8fa0c257.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-a29ca3591c42965598e4b696c7f51c1c6c14c976.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-a29ca3591c42965598e4b696c7f51c1c6c14c976.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-226ac85191f749b777dbbb0873abdb83577b00a4.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-226ac85191f749b777dbbb0873abdb83577b00a4.png"}, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-2ecd28f7d619635a2043aa65b0933235fe91f0c4.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-2ecd28f7d619635a2043aa65b0933235fe91f0c4.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d3a0a70ccdf6f6ea0e0b35471c31ee2f8f2562a2.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d3a0a70ccdf6f6ea0e0b35471c31ee2f8f2562a2.png"}, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-85ef343c0af5f3d9758eecafcd22b4454dbac3ef.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-85ef343c0af5f3d9758eecafcd22b4454dbac3ef.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-dde5de5e3863ab09c8c5f286ed0262de3676e5e9.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-dde5de5e3863ab09c8c5f286ed0262de3676e5e9.png"}, null, null, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d2bdb97ace49413f5991dc3d6ec727a43845f640.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d2bdb97ace49413f5991dc3d6ec727a43845f640.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ce58acc91fed69fae368b972e72a6d5c93d9e5b0.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ce58acc91fed69fae368b972e72a6d5c93d9e5b0.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png"}, null, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ee335b89f8e1ce522e753285412b1ca3b2729cf7.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ee335b89f8e1ce522e753285412b1ca3b2729cf7.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-92ce9c59cafca4da04d8d0d5b3e484dbe6d3dc82.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-92ce9c59cafca4da04d8d0d5b3e484dbe6d3dc82.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-2a9d193ce1d6bf093b8c6d4289d558b7abaebb6c.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-2a9d193ce1d6bf093b8c6d4289d558b7abaebb6c.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5fca2cb92c9dc5c7e074d4d3756ec26d607da0ec.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-7821ef62ec9ba7f39cfacbb46cabb9c0f6082ba5.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-7821ef62ec9ba7f39cfacbb46cabb9c0f6082ba5.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-b5c459cbe1b9b78689d1bd4c4949d6b0deb1b9e0.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-b5c459cbe1b9b78689d1bd4c4949d6b0deb1b9e0.png"}, null, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ce58acc91fed69fae368b972e72a6d5c93d9e5b0.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-ce58acc91fed69fae368b972e72a6d5c93d9e5b0.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-599d6d127ac718cd580fc77ea9bbe66c1f8ddd60.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-599d6d127ac718cd580fc77ea9bbe66c1f8ddd60.png"}, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-9d4801bcc28da99faab02b9ba208fc748c022d51.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-9d4801bcc28da99faab02b9ba208fc748c022d51.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-c4328a1907757b8203c92d73f4a44f2c0b5cfc9b.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-c4328a1907757b8203c92d73f4a44f2c0b5cfc9b.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-97db13ae5b4fc8f12b34eb2131ae716d8c98e29e.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-97db13ae5b4fc8f12b34eb2131ae716d8c98e29e.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-35a327f3b14049ed8f8efa390c591c95a6f16909.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-35a327f3b14049ed8f8efa390c591c95a6f16909.png"}, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5660fd3097e80605efb251573cf178bfb133a2b1.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-5660fd3097e80605efb251573cf178bfb133a2b1.png"}, null, {"document_url": "https://www.mercurial-scm.org/wiki/TopicPlan", "unformatted_src": "/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d914330a4a9a2365d81960f95d9be426eefec145.png", "src": "https://www.mercurial-scm.org/wiki/TopicPlan?action=AttachFile&do=get&target=autogenerated-d914330a4a9a2365d81960f95d9be426eefec145.png"}, null]
1. Problem Statement

The Mercurial community has been struggling for years to define a nice way to handle 'topic' branches (sometimes also called 'feature' branches), especially when it comes to sharing them with other people (mainly for code review or other collaboration.)

Bookmarks are a clone of git's refs, which seems to work more poorly in Mercurial than they do in Git, in part because the synchronization parts of bookmarks aren't really done. Adding the remaining bits of git's refs to Mercurial has been controversial, and may represent enough of a behavior change that it's infeasible.

Named branches are visible forever in the revision history, which makes them unsuitable for feature branch work as the feature branch names rapidly pollute the output of things like hg branches.

2. Current Target

This describe the target semantic and behavior for topics. Of course some adjustement can be built.

2.1. General semantics

TL;DR; topic are an extra "light-branch" data relevant to draft changesets.

2.2. General effect on named branch

Changeset with topic are only aspiring to be part of the named branch, but not fully in that branch yet. When you have branch foo name foo is resolved to the heads of foo with no topic.

There is a couple of examples: Multiple heads are not longer ambiguous, Partial data does not have radical change on the definition, Usual traversal rules apply:

2.3. Behavior for update

(This implies change in hg update behavior (but are not super relevant))

2.3.1. Case 1: active branch 2.3.2. Case 2: active topic 2.3.3. Case 3: active topic, lagging behind

W was on topic bar, but it is now public so bar does not apply to W. However, the working copy is still having an active topic. Classical case for getting in that situation is to hg up bar that bring you on W with bar active, then pull that bring you B, C, X, Y and turn W public.

The intent here is to work on topic bar and hg update should make you up-to-date in the bar context.

Alternatively we could requires more data from the user.

2.3.4. Case 4: active topic, topic is closed

W was on topic bar, but it is now public so bar does not apply to W anymore. Classical case for getting in that situation is to be working on topic bar then bar got 'accepted' and get public. As you former bar is not the new head of foo, people merge/rebase and publish more changesets on top of that.

In that case inferring that you topic is "done" and being up to date mean "bring me to the latest of my branch" seems to make sense.

A possible issue, hg update; hg pull can provide different from hg pull; hg update, in the case where hg update is bringing changeset on the bar topic again.

Alternatively we could not update, pointing at a command to disable the topic.

2.4. Behavior for push to publishing (default)

Mercurial will keep enforcing a single head for each name:

2.4.1. Case A: pushing multiple topological branch Pushing the following to a publishing server would make X and Y public, fading their bar topic making them plain member of branch foo, creating a new head.

2.4.2. Case B: pushing a merged topic

User can then merge/rebase push is accepted, all X, Y, Z changeset become public and new single head of branch foo in Z.

2.4.3. Case C: linear push but remote unsynched heads Push fail as Y creating a new head on branch foo.

User have to pull and merge as usual.

2.4.4. Case D: linear push while in sync 2.4.5. Case E: new named branch 2.5. Behavior for push to non-publishing repo

2.5.1. New topic 2.5.2. New topic on a topological branch (1) 2.5.3. New topic on a topological branch (2) 2.5.4. New topic on a topological branch (3) 2.5.5. New head on topic 2.5.6. Conflicting unrelated topic 2.5.7. New head on branch fail, creating new head B on branch foo

2.5.8. New topic on new branch 2.6. Behavior for merge

(We won't discuss hg rebase, assuming it will behave the same in 3.7)

2.6.1. Two heads on topic 2.6.2. Topic has three heads 2.6.3. Topic has one head and include branch head 2.6.4. Topic has one head and is behind compared to branch head 2.6.5. Topic has one head, branch has multiple heads 2.7. Stacked diffs workflow

2.8. User Transition

3. Pro and Cons

4. Other questions

5. Open ideas

This is a list of idea that emerged while brainstorming. This served as base for the current things.

6. Current Implementation

Assign topics to non-public changesets. A topic is like a named branch, in that it is a label stored in a changeset's extra, but that topics just disappear when the change moves to public phase (the data still exists, it's just not shown.)

Code is available at https://www.mercurial-scm.org/repo/topic-experiment.

6.0.1. Non-Goals

6.1. Open Questions

7. See also

CategoryDeveloper and CategoryNewFeatures

TopicPlan (last edited 2017-07-11 10:00:42 by PulkitGoyal)