CodePlex Mercurial Support for Forks

[Do you Tweet? Follow me on Twitter @matthawley]

We deployed the latest version of CodePlex software today. This release changes how the Patches feature works for Mercurial based projects by replacing it with Forks. A Fork is a branch of the project repository stored on our servers where you can make modifications and then the project owners can merge your changes back to the main project repository. If you are a Mercurial project owner, and need to get access to unapplied patches, please contact us.

Creating Forks / Pull Requests

The following steps are applicable to all registered CodePlex users.

Step 1: Create a new Fork of a Project

Go to the Source Control tab of a Mercurial project. And click on the “Create Fork” link. Specify a name that will distinguish your intentions, and optionally enter in a description of what the fork is used for.

clip_image002

Once the fork has been created, you’ll be redirected to the “My Forks” view of that project. At this point, you can toggle the view to see “All Forks” or “My Forks” (the toggle will only be visible if you have existing forks in the project).

clip_image004

Step 2: Fork Clone, Commit, and Push

On the page listing for the forks, you will see a Clone URL.

clip_image006

Use your favorite Mercurial tool (we recommend TortoiseHg), to create a local clone of the repository.

clip_image008

Since this is your repository, you have full capabilities of committing locally, and pushing changes back up to the central server. This is a key distinction for forks, as the changes in your fork ARE NOT pushed into the central project repository.

clip_image010

Step 3: Create a Pull Request

Once you have pushed all of your changes to your fork (as well as making sure you have pulled the latest changes from the central repository), you’re ready to create a pull request. When viewing “My Forks”, you’ll see some actions. Click on “Send Pull Request”, enter your comments and click “Send”.

clip_image012

At this point, your pull request is waiting to be applied by project coordinators or developers. Once they have applied or denied your pull request, you will receive an email with their comments.

Applying Pull Requests

The following steps are applicable to project coordinators or developers for a project only.

Step 1: Reviewing / Apply Pull Request

As a project contributor, when you visit the forks page, you’ll see that you have the ability to subscribe to pull request notifications. When a user submits a pull request, you’ll receive an email with their comments and a link to the Fork.

clip_image014

Once a pull request has been submitted, you’ll want to pull those changes into your local project repository. Note: It is recommended that you get fresh clone in case you wish to not accept the changes.

clip_image016

Once pulled, click the Refresh button in the Repository Explorer to see the new changeset(s).

clip_image018

At this point, you should review the changes and determine if you’d like to accept them. If you do not wish to accept the changes, you can simply delete your local repository and re-clone it. If you do accept the changes, push them to the central project repository.

clip_image020

Step 2: Closing the Loop

No matter if you applied or declined the pull request, you should close the loop. This gives the user the reassurance that the pull request was noticed and acted upon. To do this, visit the Forks page again. You’ll notice that we pop all pending pull requests on to the top so it’s easy to get access to them. Find the pull request you just applied, and click “Apply Pull Request”. Type a message and click Send.

clip_image022

Note: It’s courteous to give really good feedback when declining a pull request. The user is now able to send another pull request with new changes they’ve made to their fork.