DZone
Cloud Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Cloud Zone > Migrating to Git thanks to CloudBees

Migrating to Git thanks to CloudBees

Łukasz Budnik user avatar by
Łukasz Budnik
·
Jun. 27, 12 · Cloud Zone · Interview
Like (0)
Save
Tweet
4.34K Views

Join the DZone community and get the full member experience.

Join For Free

I got a free account (FOSS account) on CloudBees.com for my open source project (Qualitas). I decided to use the Maven and Jenkins parts of the CloudBees (for now), but was quite dissapointed when I saw that CloudBees' Jenkins supported only Git and SVN. My project used Hg. I wasn't emotionally attached to Hg so I decided to migrate my Hg repository to Git. Thankfully Google Code gave my a hint to use hg-fast-export tool. See below how easy it is to migrate your Hg repository to Git.

Installing Git

OK, first you have to install Git on your machine (if you don't have it already). If you're on Linux with yum installed, execute the following command:

yum install git


Installing hg-fast-export

Just clone their repo (Git repo of course :) ):

git clone git://repo.or.cz/fast-export.git

There will some shell and some Python scripts in there. Names indicate what they do.

Migrating repositories

OK. So to migrate my Hg repo I had to execute the following commands (change names of directories and you should be fine):

cd /work/qualitas/repository/qualitas
hg pull # just to make sure there are no pending changes in master repository
cd ..
mkdir tmp-qualitas-git
cd tmp-qualitas-git
git init
/your-path-to/hg-fast-export.sh -r ../qualitas

See the log for any errors.

Now clone tmp-qualitas-git and verify if both repositories are the same:

git clone tmp-qualitas-git qualitas-git
diff --brief -r qualitas qualitas-git

You should see only the differences in all files which were added to .hgignore. If there are differences in other files then something went wrong... which thankfully was not my case :)

Last step was to move .hgignore and tags files.

Migrating tags

Hg stores tags in .hgtags file. hg-fast-export took care of that and if you execute:

git tag


you will see all original tags copied from the Hg repo.

Migrating .hgignore

Migrating .hgignore to .gitignore is just a matter of copying and renaming the file :)

Summary

That's all, childishly simple.

Cloudbees.com I'm comming!

 

Git

Published at DZone with permission of Łukasz Budnik, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Ensure API Consistency and Security With Anypoint API Governance
  • Basic Convolutional Neural Network Architectures
  • Modernize Legacy Code in Production: Rebuild Your Airplane Midflight Without Crashing
  • Servlets Listeners Introduction and Examples

Comments

Cloud Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo