felipec / git

Fork of Junio Hamano's git for users
Other
204 stars 34 forks source link

Bookmarks on named branches #71

Closed minj closed 8 years ago

minj commented 9 years ago

I can't seem to figure out how to push git branches based on mercurial's named branches.

E. g. suppose we have freshly cloned a mercurial repo with several branches:

├── heads
│   └── master
├── hg
│   └── origin
│       ├── bookmarks
│       │   └── master
│       └── branches
│           ├── beta
│           ├── default
│           └── nightly
├── notes
│   └── hg
├── remotes
│   └── origin
│       └── HEAD
└── tags

How to make a bookmark 'featureA' on branches/nightly?

$ git co -b featureA remotes/origin/branches/nightly
$ echo featureA >> file
$ git ci -a -m 'implement A'
$ git push origin featureA

results in:

$ hg heads -r -1
changeset:   3:5f2e9010bd58
bookmark:    featureA
tag:         tip
user:        user <user@mail.com>
date:        Wed Mar 04 19:02:11 2015 +0200
summary:     implement A

Notice there is no 'branch' field, i. e. it's 'default'.

Same thing happens if you branch off from a named branch:

$ git co -b branches/nightly remotes/origin/branches/nightly
$ echo featureA-2 >> file
$ git ci -a -m 'implement A'
$ git push origin branches/nightly # this works as expected
$ git co -b featureB
$ echo featureB >> file
$ git ci -a -m 'implement B'
$ git push origin featureB branches/nightly # bookmark featureB has no named branch
felipec commented 8 years ago

Only branches named "branches/X" are treated as named branches.