BMO/ReviewBoard/DeveloperWorkflow

From MozillaWiki
< BMO
Jump to: navigation, search
Note: This document is a DRAFT and not yet complete

Followed wiki instructions for setup of development environment at https://etherpad.mozilla.org/developing-rbbz Sample of my home ~/.hgrc file:

 [ui]
 username = David Lawrence <dkl@mozilla.com>
 merge = internal:merge
 [diff]
 git = 1
 showfunc = 1
 unified = 8
 [defaults]
 commit = -v
 [extensions]
 rebase =
 histedit =
 rbclient = ~/devel/repos/hg/version-control-tools/hgext/reviewboard/client.py
 [bugzilla]
 username = dkl@mozilla.com
 password = PASSWORD
 [mozilla]
 ircnick = dkl

1. Add the following line to your .hg/hgrc file to add the review repo as a remote to your current checkout

 [paths]
 default = https://hg.mozilla.org/hgcustom/version-control-tools
 reviews = http://localhost/hg/version-control-tools

2. Create new bug in Bugzilla for doing the patch review such as bug 1004433

3. Create new bookmark in the repo you will be working from for the bug report

 $ cd ~/devel/repos/hg/version-control-tools
 $ hg bookmark bug-1004433
 $ hg up bug-1004433
 0 files updated,  0 files merged,  0 files removed,  0 files unresolved

4. Make the needed changes to the code files and commit

 $ vi pylib/rbbz/README.md
 $ hg commit -m "Bug 1004433 - my test bug" pylib/rbbz/README.md
 $ vi README.rst
 $ hg commit -m "Bug 1004433 - my test bug - another change" README.rst
 $ hg out
 comparing with http://localhost/hg/version-control-tools
 searching for changes
 changeset:   602:3e8233c53bdb
 user:        David Lawrence <dkl@mozilla.com>
 date:        Fri Jul 18 20:18:29 2014 +0000
 summary:     Bug 1004433 - my test bug
 changeset:   603:50be0b07409d
 bookmark:    bug-1004433
 tag:         tip
 user:        David Lawrence <dkl@mozilla.com> 
 date:        Fri Jul 18 20:19:23 2014 +0000
 summary:     Bug 1004433 - my test bug - another changepylib/rbbz/rbbz/extension.py.rej

5. Push the changes to the review repo using 'reviews' path name instead of the default

 $ hg push -r bug-1004433 reviews
 pushing to http://localhost/hg/version-control-tools
 searching for changes
 remote: adding changesets
 remote: adding manifests
 remote: adding file changes
 remote: added 2 changesets with 2 changes to 2 files
 submitting 2 changesets for review
 changeset:  602:3e8233c53bdb
 summary:    Bug 1004433 - my test bug
 review:     http://localhost/rb/r/23 (pending)
 changeset:  603:50be0b07409d
 summary:    Bug 1004433 - my test bug - another change
 review:     http://localhost/rb/r/24 (pending)
 review id:  bz://1004433
 review url: http://localhost/rb/r/22 (pending)
 $ hg phase -r 602::603
 602: draft
 603: draft

6. Go to the parent reviewboard request at http://localhost/rb/r/22 and add a reviewer name to the request and publish

  • This will change once bug 1034171 lands; you will go to the Commit view for the parent request and set the reviewers for each commit from there.

7. Observe that the attachment has been created in the related bug at https://bugzilla-dev.allizom.org/show_bug.cgi?id=1004433

 Attachments
 Review for review ID: bz://1004433 (28 bytes, text/plain)      dkl: review? (mcote)
 2014-07-18 13:44 PDT, David Lawrence [:dkl]

8. Make review comments in the review request finding issues which will need a new patch

  • For bonus points, use a different user.
 # Misspelling in pylib/rbbz/README.md

Comment is added to bug 1004433 stating a problem was found.

9. Revise patch and push again to the review repo

 $ vi pylib/rbbz/README.md
 $ hg commit -m "Bug 1004433 - my test bug - another change" pylib/rbbz/README.md 
 pylib/rbbz/README.md
 committed changeset 604:16b11bb254e6
 $ hg push -r bug-1004433 reviews
 pushing to http://localhost/hg/version-control-tools
 searching for changes
 remote: adding changesets
 remote: adding manifests
 remote: adding file changes
 remote: added 1 changesets with 1 changes to 1 files
 submitting 3 changesets for review
 changeset:  602:3e8233c53bdb
 summary:    Bug 1004433 - my test bug
 review:     http://localhost/rb/r/23 (pending)
 changeset:  603:50be0b07409d
 summary:    Bug 1004433 - my test bug - another change
 review:     http://localhost/rb/r/24 (pending)
 changeset:  604:16b11bb254e6
 summary:    Bug 1004433 - my test bug - another change
 review:     http://localhost/rb/r/25 (pending)
 review id:  bz://1004433
 review url: http://localhost/rb/r/22 (pending)
 $ hg phase -r 604
 604: draft

10. Observe that a new attachment has been created in bug 1004433

  • Existing review requests will be automatically updated if history changes (amended or rebased commits).

11. Newly revised changeset looks good and reviewer clicks "Ship It!" with a comment

12. Reviewer closes the review as 'submitted'

  • This action should also set r+ on the attachment in Bugzilla.

13. Developer pushes changeset to the public repo instead of review repo

 $ hg push -r bug-1004433
  • Note that you might get a warning about creating multiple heads if there had been a commit pushed between the time that you created your patch and tried to push it. In that case, you'd want to
 $ hg up my-tip
 $ hg pull -u
 $ hg up bug-1004433
 $ hg rebase -d my-tip
 (fix any conflicts).

14. Remove bookmark for the review/bug.

 $ hg up my-tip (or whatever you named it)
 $ hg bookmark -d bug-1004433

QUESTION: Can I just remove the bookmark while inside it and not have to specify a "master" bookmark to change to?

  • Hm, good question. If you just did a pull -u without going back to my-tip, it might not move my-tip up to the recent commit. So yes, you could delete the bookmark without going back to my-tip, but then you'd later have to move my-tip manually. I think. Regardless, switching back to my-tip is equivalent to changing back to the master branch in git, which is what you'd normally do (although at that point you would normally merge in your feature/bug branch).