Named branches issue - Kiln Knowledge Exchange most recent 30 from http://kiln.stackexchange.com 2013-05-19T19:58:26Z http://kiln.stackexchange.com/feeds/question/2563 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://kiln.stackexchange.com/questions/2563/named-branches-issue Named branches issue bradley 2010-11-23T17:46:35Z 2010-12-02T17:52:00Z <p>Ok I know there's lots of controversy surrounding named branches, whether to use them or not, blah blah blah.</p> <p>I'm coming from git, so named branches seem to me to be a bit like git branches which I like.</p> <p>Now, we're also using repo branches as our deployment stages, so we have 3 repo branches for each app [development, staging, default]. </p> <p>So locally I work on the development branch, but use a named branch within that repo for features, then i merge back to default (on development) and push. Once I'm done with a named branch I close it.</p> <p>Now however, when I pull my development branch repo into my staging branch repo and do a push, it gives me the:</p> <blockquote> <p>abort: push creates new remote branches: some_branch! (use 'hg push --new-branch' to create new remote branches)</p> </blockquote> <p>But I already closed this branch on the development branch repo before pulling it in. What's the deal?</p> <p>In my staging branch repo, after the pull, <code>hg heads</code> shows one head, <code>hg branches</code> shows one branch so I'm at a loss as to where this named branch (<code>some_branch</code>) actually exists??</p> http://kiln.stackexchange.com/questions/2563/named-branches-issue/2576#2576 Answer by Rob Sobers for Named branches issue Rob Sobers 2010-11-26T22:02:38Z 2010-11-26T22:02:38Z <p>This is expected behavior in Mercurial. Even though <code>some_branch</code> is closed, it still exists in the repository's history and has changesets associated with it. As a result, by pushing, the named branch will be created in the remote repository and closed, just as it was in your local clone.</p> <p>Even though a branch is closed, it still <em>exists</em>, but you won't be able to see it in <code>hg branches</code> because that would clutter things up.</p> http://kiln.stackexchange.com/questions/2563/named-branches-issue/2599#2599 Answer by jkerian for Named branches issue jkerian 2010-12-02T17:52:00Z 2010-12-02T17:52:00Z <p>You've basically hit the reason named branches are frowned on somewhat with hg. "named branches are forever" Which does not seem to be the case with the normal git development model.</p> <p>The normal hg development model is to use anonymous heads for working on your changes (and merge your repo to a single head before pushing).</p> <p>The git every-branch-has-a-name workflow has one advantage... in that your current progress is easily tracked by-name on that feature/bug/whatnot. The disadvantage is that the name disappears into the mists of time after trunk checkin. (ie, the thing you've been using to refer to the feature for the time when you're actively working on it is suddenly not a useful way of finding the csets) If this doesn't bother you, use a cloned repo, it has exactly the same feature and disadvantage. In particular, take advantage of Kiln's "branch repositories" feature to publicly track your development.</p> <p>Part of the issue is that svn made no distinction between "feature branches" and "tagging branches" (Branches that needed to be tracked years later). git complicates this situation by explicitly using "feature branches" as part of the workflow. hg named branches are "tagging branches".</p> <p>Named branches ARE useful in mercurial, any time you have a branch that really does need to live forever. In our case, code releases are tagged, but occasionally a customer wants "one little change" to tag "v1.3" (and won't take the up-to-date code 'v4.22')... in that case we fire off a named branch named 'v1.3-branch' and are able to track which patches are cherry-picked back to the branch. (We use 'destructive merges' to make the merge machinery work for us even in this case). All of these named branches (and release tags) are in a single "ReleaseRepository".</p>