part 1 of this DVCS – blogseries described how to install Git and Mercurial together with Eclipse Team provider Plugins EGit and HgEclipse, part 2 demonstrated initializing of and importing from local repositories.
Update: 2010-02-22 (more info at the bottom)
Now let’s take a look at the Team… options EGit and HgEclipse are providing and let’s do some simple things (committing changes to the local repositories we created and initialized in part 2)
Team… options of EGit and HgEclipse
Team… options at Project level
Here’s a first overview of the options you get from “Team…” for a project under control from EGit:
…and from HgEclipse:
We’ll go through the different options in this and following parts of my blog series about DVCS using concrete tasks to do.
Team… options at single-resource – level
If you take a look at the “Team…” options of a single resource you’ll get this from EGit:
and from HgEclipse:
as above – we’ll go thru the options later – this should give you only a first overview of the possibilities.
EGit – and HgEclipse Views or Perspectives ?
If I’m exploring new things I always take a look if there are special Perspectives or Views provided. In case of aVCS – Team Provider Plug-in from my experiences using CVS I expected that there would also be a Perspective for Git or Mercurial repositories. But both Plug-ins don’t provide an own perspective.
Next step I take a look at the Views and found that HgEclipse provides some extra Views:
Later we’ll take a detailed look at “Mercurial Merge” and “Mercurial Patch Queue“. Of course I was interested into “Mercurial Repositories” and opened the View:
The View was empty – even after hitting “Refresh“. I have thought that my cloned Repositories inside my workspace and also the local Repository we imported from would be visible.
But the “New” looks interesting 😉
Hey – I can create a Repository ! Let’s try to create a new Local repository:
uuups – it doesn’t work this way. My wish: Here I should be able to create and init a new Repository and then add Eclipse projects to this Repository.
HgEclipse team fixed Issue 10961 – now I’m able to create AND to init a Repository outside Eclipse workspace, simply checking the new box:
this simplifies some workflows.
Double clicking on the Repository entry I get this View:
“Create Repository” means to create a record in a store for Repository Locations and Login / Password – values. Checking “init” also creates the repository itself.
The next part of this blog series will use this to get easy access to remote repositories.
Committing changes using EGit and HgEclipse
Now let’s do a very easy thing: change some code and commit to Git using EGit and commit to Mercurial using HgEclipse.
Simply one word was inserted. Now the project was decorated to reflect that there’s something uncommitted.
Both do the same: decorating the complete tree from Project to modified Class.
OK – let’s commit this to the repository -. in both cases using “Team… -> Commit“.
EGit let’s you enter different values for the “Author” and the “Committer“. If checking “Amend previous commit” you “overwrite” your previous commit – sometimes makes sense to correct mistakes before pushing to other repositories.
Mercurial Commit has no way to “overwrite” previous commits.
HgEclipse and EGit allow double-clicking on a changed File and provide a View to see the differences.
Pushing changes to a Local Repository
Now the last task: we want to push the changes back to the Local Repository from where we imported / cloned.
EGit uses “Team… -> Push to…” and routes you through some Dialogs:
EGit remembers the origin Repository we imported from – so in this case (pushing changes back) we only need to hit “Next”
All Combos (Source ref, Destination ref) are empty and we have to click to get the master entry. Then we have to hit “Add spec” to get the Specifications for push (displayed in the table). Now we can “Finish” or “Next“. Hitting “Next” we can get a “Push Conformation“:
hitting “Finish” finally displays the “Push Results“:
HgEclipse uses “Team… -> Push…” and displays two Dialogs:
The URL is known from last time or can easy be selected through the “Local…” file browser. If you know what you’re doing, you can now hit “Finish” or “Next” to see the “Outgoing changesets“:
You can click on a changeset to see the files and you can double-click on a file to see the differences.
My first impression: Committing changes is nearly the same using EGit or HgEclipse. Pushing seems to be easier using HgEclipse: less Views, less Clicks and possibility to look into the changesets. But I think I have to work more with both PlugIns to decide what’s better.
View the changes at Local Repository
You know, DVCS is new to me, so it would be good to verify if the changes are correctly pushed into the Local Repository. I didn’t find any Viewer at EGit.
Perhaps http://viewgit.sourceforge.net/ could be helpful, but I didn’t tried it yet.
HgEclipse provides an easy way to view your Mercurial Repositories from a browser.
“Team… -> Serve…” does the job:
If it’s ok to use Port 8000, then hit “Finish“. Now this projects can be viewed from a Browser at http://127.0.0.1:8000:
Hint: As I already told you I’m just starting using DVCS -please correct me and add comments if there are better ways to do this work. thanks.
Update 2010-02-22 Thx to HgEclipse team fixing Issue 10961 we now can create and init repositories outside eclipse workspace.
The overview of this blog series can be found here: https://ekkescorner.wordpress.com/blog-series/git-mercurial/. The next part we will do some work using remote repositories.