It is possible to push Mercurial bookmarks to Bitbucket, but does anybody know how to create pull requests from them?
2 Answers
Based on information from this thread (thanks sirex for sum up). It is not user friendly, but possible.
- make sure you know
thename
of your bookmark - open https://bitbucket.org/yourname/yourproject/branch/thename
- note the hash
- push Pull request button and make sure the hash in drop down matches
- that's it

- 19,847
- 9
- 124
- 140
-
I just tried this and could NOT get it to work UNLESS the bookmark I'm trying to create a pull request for is itself a head. So if you have a linear change, say: A --- B (bookmarked feature-1) --- C (bookmarked feature-2) , you will not be able to create a PR for feature-1's hash (since it's not a head). – martian111 Jun 18 '15 at 08:01
I'm using bookmarks for pull requests quite actively with my team, for a few weeks. Here how it works for me:
Create bookmark, called
master
ondefault
branch:hg bo master -r default
If you don't do this, then after creating two branches on
default
, when one is named with bookmark, then other will be left as anonymous branch. Somaster
bookmark is needed to name this anonymous branch.Make this
master
branch public in your fork repository and in upstream repository:hg push -B master hg push upstream -B master
You can manage repository aliases in
.hg/hgrc
file (relative to your repository), example:[paths] default = ssh://hg@bitbucket.org/foo/upstream upstream = ssh://hg@bitbucket.org/upstream/upstream
Ask your team to pull
master
bookmark:hg pull -B master
Start to work on a feature, using bookmark:
hg bo feature-1 hg ci -m "Some changes." hg push
In Bitbucket, press "Pull request" button, or type "x" then "p".
On left side, select you branch, to create pull request from it. If your
default
has only one branch (to check that, seehg heads default
), then your bookmark branch will be displayed asdefault
, but if you have more than one branch ondefault
, then you will see some think like thisdefault (0932c9ab2029)
, you can find correct one by matching hash value fromhg bo
. After selecting branch, pull request title will be filled with last commit from selected branch.Press "Create pull request" button at the bottom, and that's it, your pull request will be created.
To create new pull request, first pull changes from upstream repository:
hg pull upstream
Update to
master
:hg up master
And start your new feature branch using bookmark:
hg bo feature-2
If you don't have possibility, to ask your team, to use master
bookmark as a bookmark to original default
, then I would suggest you to create you personal named branch for example named as your nickname, and work with bookmarks using your personal named branch instead of working on default
. In this case work flow will be this:
Create your personal named branch:
hg branch nickname hg ci -m "Starting my personal branch for feature branch management."
Create local
master
bookmark:hg bo master
Start to work on a feature, using bookmark:
hg bo feature-1 hg ci -m "Some changes." hg push
In Bitbucket, press "Pull request" button, or type "x" then "p".
On left side, select you branch, to create pull request from it. If your
nickname
named branch has only one head (to check that, seehg heads nickname
), then your bookmark branch will be displayed asnickname
, but if you have more than one branch onnickname
, then you will see some think like thisnickname (0932c9ab2029)
, you can find correct one by matching hash value fromhg bo
. After selecting branch, pull request title will be filled with last commit from selected branch.Press "Create pull request" button at the bottom, and that's it, your pull request will be created.
To create new pull request, first pull changes from upstream repository:
hg pull upstream
Update to
master
:hg up master
Merge
default
tomaster
hg merge default hg ci -m merge
And start your new feature branch using bookmark:
hg bo feature-2

- 4,593
- 2
- 32
- 21
-
It is much more recommended to use @ as the equivalent of master branch in Git. The @ bookmark is special because it is activated by default on new clones. – markand Aug 31 '16 at 14:12