This example will demonstrate how to create a Mercurial Repository at Sourceforge and how to push some existing Eclipse Projects into this remote Repository. We’ll use Push and Pull to solve this.
In part 4 of my DVCS blog series I demonstrated how to use BitBucket to access remote Repositories using HgEclipse (and also how to use EGit to access remote Repositories from GitHub). Another great source to host Open Source Projects is Sourceforge, wher you can use Mercurial or Git or even both together.
In this example we’ll create a Mercurial Repository at SourceForge – and in another part of this blog series I’ll blog how to convert the Mercurial repository into a Git Repository for the same Project – then it’s up to the user which to select.
Prepare your Sourceforge Account for ssh
Your Account must know your ssh public key. (If you don’t know how ssh works take a look at my blog here) Under Account – Services – Edit SSH Keys you can paste your public key.
As Project Admin under Feature Settings:
you can enable Mercurial (and also Git if you want)
Under Develop -> Code Sourceforge tells you how to access the Repositories using HTTP (read-only) or ssh (read-write):
If you try from Terminal to access the repository you can verify if the repository is there, but you have no access:
Prepare your Projects to be pushed to Sourceforge
We start with a workspace only containing the projects we want to push.
Now we create a new Repository Location at the root of the workspace:
As next we select Projects and then execute “Team… Share…” – HgEclipse tells you that there’s a Repository above, so you can select this easy:
HgEclipse can only share one Project at a time, so you have to Select a Project and Click “Share Project…” for all one by one:
Finally all Projects are shared:
As usual we have to add and commit:
Pushing to Sourceforge
Now we’re ready to push the Projects up to our remote Repository at Sourceforge using “Team Push…”
Paste the URI we copied from Sourceforge:
confirm the changes and you’re ready
Browse the Mercurial repository from Sourceforge
Select the Repository (here’s only one: “ekkescorner”):
and browse the code:
Clone from Sourceforge into another Workspace
Using Import – Mercurial – Clone we can clone the Repository back from Sourceforge:
Enter the URL:
Confirm the Branch:
and finally select the Projects:
You’re done. Now do some changes, commit to your local workspace repository and Push to the remote SourceForge Repository. (You already know how to do this 😉
Pull from Sourceforge to get changes from others
We switch back to workspace we used first to get the changes from Sourceforge. Its easy: Team Pull… is your friend:
You can click “Next” and inspect the changes or simply click “Finish” and you’re done.
That’s all for now: Pushing to Sourceforge Repositories and Pulling back works well.
In another part we’ll convert the Mercurial Repository into a Git Repository and use EGit to get it into your workspace.