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. This workflow describes how to clone your workspace repository to another local repository:
The short story:
- Create and init the Local Repository (outside your Eclipse Workspace)
- Push your Workspace Repository to the Local Repository
- You’re done: your repository is available from a local repository
the long story:
1. Create and init the Local Repository outside your Eclipse Workspace
Open the View “Mercurial Repositories” and click on “Create Repository” :
Because we want to create a repository in our LAN, we need a Local URL – hitting “Local…” you can browse to the location and create / open a directory there. The Repository location is:
Please don’t forget to watch if the checkbox “Init Mercurial repository” is checked ! Click “Finish” and the Repository is visible in the View:
Above we see our workspace repository and below the empty local repository.
2. Push your Workspace Repository to the Local Repository
Now let’s try to push the content from your workspace repository to the local repository. “Team -> Push” opens this dialog:
The URL points to the Local Repository.
BTW: the URL combo was empty – would be good to get a selection of all repositories known to “Mercurial repositories” View there. (Opened CRQ 11019) Issue was fixed on 2010-03-13 – now you get the last used repository as default and also a list of all known repositories.
As next step we have to verify the changesets to be pushed:
as always selecting a changeset you can inspect the content and double-clicking on a single file you can compare the changes in detail. try it out…
Click “Finish” to push the changes.
uuups…. now there’s only the Local repository available from “Mercurial Repositories” View – our Workspace-Repository is missing:
Attention! HgEclipse by-magic changed the Repository our Workspace Projects are connected to. If looking at the Project Properties you’ll see this:
Resetting the Default Repository to the workspace repository fixes this:
Now the Mercurial Repositories View correct displays both Repositories again:
Created a Bug 11020 at HgEclipse.
3. You’re done: your repository is available from a local repository
If looking at the filesystem at the local repository:
Of course there’s only the repository at .hg, because its no workspace repository with some imported projects.
We can do a test, to see if our projects are really there. Let’s change one file in workspace and then “Push to” the local repository.
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.