clone from local Mercurial repository into your workspace using HgEclipse

This workflow is part of my DVCS blog series. If you don’t understand some steps, please read the first parts of the series.

The goal: Clone a Workspace Mercurial Repository to local Repository with HgEclipse

Imagine you have created a multi-project repository in your workspace. (If you don’t know how to create multi-project repositories in your workspace – here’s the workflow how to do this using HgEclipse and Mercurial) Now you need access to this repository from another client in your LAN. So what to do ? One way could be to create a Local repository on a server, so the other client can clone from there. There’s already a workflow desribing how to clone your workspace repository to another local repository here. Now let’s do the last step in this scenario:

Switch to an empty workspace and  import (clone) from the the local repository we created and pushed to from another workspace before:

The short story:

  1. Import / Clone from the Local Repository into your Eclipse Workspace.
  2. You’re done: your cloned repository is part of your workspace

the long story:

1. Import / Clone from the Local Repository into your Eclipse Workspace.

Import -> Mercurial -> Clone Existing Mercurial Repository” – there’s also an “Import -> Mercurial -> Projects from Local Mercurial Repository” we’ll explain later talking about “Management of Local Repositories”.

Now select the Repository Location from where we want to clone a repository. Please check the checkbox “Checkout as projects in the workspace” and take a look at the Directory name of the clone:

verify the projects which should be imported:

Click “Finish” – now you got a cloned repository inside your workspace and also the projects imported.

If you take a look at the “Mercurial Repositories” View, then you’ll only see the Repository you cloned from, but not the new created Repository inside your workspace.
There’s a bug at HgEclipse: Bug 11020 I reported. The cloned Repository is missed and the projects are connected to the repository we cloned from instead of our workspace- repository.

Workaround: Create a new Repository Record (without checking “init” in this case !) and Browse to the repository inside your workspace:

Then open Project -> Properties -> Mercurial and set the workspace repository as default:

Open the View “Mercurial Repositories” and verify that now both Repositories are there :

2. You’re done: your cloned repository is part of your workspace

If looking at the filesystem into your workspace:

There’s the cloned Repository and inside the two projects. Now we have two clients, each with a cloned repository in their workspace and also a local repository where both can Push to / pull from.

There’s another workflow here explaining push to / pull from.

This workflow is part of my DVCS blog series – an overview of all workflows can be found here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s