2

I noticed a problem:
In Mercurial bookmarks are intended to be used for feature-branches and be the equivalent of branches in Git. But In Git revision is always has an information about to which branch it belongs. So in Git we are always can say when work on feature is started and when - finished.

In Mercurial - bookmark points to just one commit, so we cant say where feature branch actually starts, and we cannot merge that feature branch back (because the revision will belong to the same branch as that revision we want to merge with). That is only possible if use named branches, but they are to 'heavy' for feature branches, while bookmarks seems to be too 'lightweight'.

What are common solutions of that problem and how proper feature-branching happens in Mercurial?

upd:
Approximate workflow for want I want to achieve is:
- Make new meaningless commit to default
- Update to previous commit, and make commits related to the feature
- Then merge with meaningless commit, and amend it with results of merge.

Gill Bates
  • 14,330
  • 23
  • 70
  • 138
  • > So in Git we are always can say when work on feature is started and when - finished. → How? – Ringding Sep 27 '13 at 15:17
  • @Ringding Start of work will be at first revision of a feature branch. And in Mercurial it will be just one branch where bookmark will point to an end of work on a feature-branch. – Gill Bates Sep 27 '13 at 15:45
  • To me, they are exactly the same. I still don't get what you think is different. – Ringding Sep 28 '13 at 15:34

1 Answers1

3
  1. Git's "branches" and Mercurial's bookmarks are totally equivalent, with single small exception (unrelated to "lightweight branching"): Git branches pulled|pushed by default, Mercurial bookmarks are local and can be pulled|pushed only if it explicitly defined
  2. You are misinformed about metadata of Git-changesets - they does not contain branch-name, to which non-tip changeset belongs
  3. You can always merge bookmark to any other HEAD (or not head) of any branch and you haven't to know starting-point of feature-branch in order to do it: just up to merge-point and hg merge <bookmark>
  4. Read Steve Losh's "A Guide to Branching in Mercurial" in a part of "Branching with Bookmarks"
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • 1
    Well, other exception: hg bookmark behavior on pull is different (no renaming to "remote bookmark"), which is actually pretty significant in terms of how one goes about using them. – torek Sep 27 '13 at 21:50
  • Yeah, you right. It turned out that named branches are best suited for what I want. – Gill Bates Sep 28 '13 at 17:55