Clone wiki

petsc / pull-request-instructions-mercurial

Creating a Pull Request for Your New Functionality using Mercurial

Use this method if you don't have write access to the PETSc repository. Sending a pull request requires a free account here at bitbucket, so please sign up if you haven't already.

Clone the Repository

If you haven't already, the first step is to obtain a recent copy of the PETSc repository:

 $> hg clone
 $> cd petsc-hg/

This creates a new folder 'petsc-hg' containing the development repository and changes right into it.

Start Cleanly

Make sure you start your development from the latest master branch by running

 $:petsc-hg> hg pull -u

Also, if you have already cloned the repository at some earlier stage and played around with it, but you don't want to keep any of your changes to files, reset the current work tree using

 $:petsc-hg> hg revert --all

To selectively bring files back to their original state, first run

 $:petsc-hg> hg status

to get a list of modified files (line starting with 'M'). For each file f to be reverted, issue

 $:petsc-hg> hg revert path/to/f

Apply your Changes

Start developing your feature in the cloned Mercurial repository. Ideally, apply self-contained commits once in a while using expressive commit messages. A single large commit at the end of the development process makes it much harder to track down any bugs showing up at a later point in time, particularly after your contribution is merged back to PETSc.

Commit your Changes

Once you completed updating the source tree, bring in the latest changes from the petsc-repository:

  $:petsc-hg> hg pull -u

Let's now check a summary of changed files:

  $:petsc-hg> hg status

If all the files shown as 'modified' should indeed be committed, commit you work using

  $:petsc-hg> hg commit -m "Your commit message here"

Otherwise, revert selected files as shown in 'Start Cleanly'

Fork the PETSc repository on Bitbucket

Once you completed your work with a final commit message, it is time to publish your contributions. Make sure you are logged in with your username on Bitbucket. You should then see the button Fork in the upper right, just next to 'Clone'. You will then see a form where you can set the name of your local fork. You can leave it unchanged, but you may also use a more descriptive name, e.g. 'petsc-hg-fork', which is used as the example repository name in the following.

Push your Feature to Bitbucket

After creating the fork, all you need to do is push your branch myFeature1 to the forked repository at Bitbucket. You can also run the first push at an earlier stage already, you don't need to wait for your feature to be complete. To create the remote branch on petsc-hg-fork, simply issue

  $:petsc-hg> hg push

To send us a pull request, click on the button Pull request near the upper right corner. Select your petsc-hg-fork-repository with branch master on the left, select the official PETSc repository petsc/petsc with branch master on the right, provide a short description of the new functionality and other changes, and click 'Create pull request'. We will be notified automatically, but you may also send a (probably more verbose) description of the pull request to