Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create pull request from Mercurial bookmark on Bitbucket?

It is possible to push Mercurial bookmarks to Bitbucket, but does anybody know how to create pull requests from them?

like image 614
anatoly techtonik Avatar asked Feb 12 '14 11:02

anatoly techtonik


People also ask

How do I mark a pull request as approved in Bitbucket?

To review a pull request, select either Approve or Needs work within the header of a pull request. Click the button again or click a different one to change your status. Approving a pull request lets the author know you reviewed their changes and that you feel the work can be merged with the target branch.


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

bookmark hash

  • push Pull request button and make sure the hash in drop down matches
  • that's it
like image 118
anatoly techtonik Avatar answered Nov 01 '22 17:11

anatoly techtonik


I'm using bookmarks for pull requests quite actively with my team, for a few weeks. Here how it works for me:

  1. Create bookmark, called master on default 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. So master bookmark is needed to name this anonymous branch.

  2. 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://[email protected]/foo/upstream
    upstream = ssh://[email protected]/upstream/upstream
    
  3. Ask your team to pull master bookmark:

    hg pull -B master
    
  4. Start to work on a feature, using bookmark:

    hg bo feature-1
    hg ci -m "Some changes."
    hg push
    
  5. In Bitbucket, press "Pull request" button, or type "x" then "p".

  6. On left side, select you branch, to create pull request from it. If your default has only one branch (to check that, see hg heads default), then your bookmark branch will be displayed as default, but if you have more than one branch on default, then you will see some think like this default (0932c9ab2029), you can find correct one by matching hash value from hg bo. After selecting branch, pull request title will be filled with last commit from selected branch.

  7. Press "Create pull request" button at the bottom, and that's it, your pull request will be created.

  8. To create new pull request, first pull changes from upstream repository:

    hg pull upstream
    
  9. Update to master:

    hg up master
    
  10. 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:

  1. Create your personal named branch:

    hg branch nickname
    hg ci -m "Starting my personal branch for feature branch management."
    
  2. Create local master bookmark:

    hg bo master
    
  3. Start to work on a feature, using bookmark:

    hg bo feature-1
    hg ci -m "Some changes."
    hg push
    
  4. In Bitbucket, press "Pull request" button, or type "x" then "p".

  5. On left side, select you branch, to create pull request from it. If your nickname named branch has only one head (to check that, see hg heads nickname), then your bookmark branch will be displayed as nickname, but if you have more than one branch on nickname, then you will see some think like this nickname (0932c9ab2029), you can find correct one by matching hash value from hg bo. After selecting branch, pull request title will be filled with last commit from selected branch.

  6. Press "Create pull request" button at the bottom, and that's it, your pull request will be created.

  7. To create new pull request, first pull changes from upstream repository:

    hg pull upstream
    
  8. Update to master:

    hg up master
    
  9. Merge default to master

    hg merge default
    hg ci -m merge
    
  10. And start your new feature branch using bookmark:

    hg bo feature-2
    
like image 35
sirex Avatar answered Nov 01 '22 17:11

sirex