Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 140e0f862a
Fetching contributors…

Cannot retrieve contributors at this time

212 lines (186 sloc) 7.991 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Hg-Git Mercurial Plugin</title>
<script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="js/thickbox-compressed.js"></script>
<script type="text/javascript" src="http://github.com/javascripts/jquery.corner.js"></script>
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="css/print.css" type="text/css" media="print">
<!--[if IE]>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection">
<![endif]-->
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8"/>
<link rel="stylesheet" href="css/thickbox.css" type="text/css" media="screen"/>
</head>
<body>
<div class="container">
<h1 class="tbar"><small>the</small> Hg-Git <small>mercurial plugin</small></h1>
<p>
This is the Hg-Git plugin for Mercurial, adding the ability
to <strong>push to and pull from a Git server</strong>
repository from Mercurial. This means you can collaborate on Git
based projects from Mercurial, or use a Git server as a
collaboration point for a team with developers using both Git
and Mercurial.
</p>
<div class='section'>
<div class="title">The Big Idea</div>
<img style="float:right; padding:10px;" height="120" src="images/server.png">
<p>
The Hg-Git plugin can <strong>convert commits/changesets
losslessly</strong> from one system to another, so you can
push via a Mercurial repository and another Mercurial
client can pull it. In theory, the changeset IDs should
not change, although this may not hold true for complex
histories.
</p>
</div>
<div class='section'>
<div class="title">Commands</div>
<p>
You can clone a Git repository from Mercurial by
running <code>hg clone [url]</code>. It will create a
directory with the same name as the last path component. For
example, if you were to run <code>hg clone
git://github.com/schacon/munger.git</code> it would clone
the repository down into the directory 'munger.git', then
convert it to a Mercurial repository for you.
</p>
<pre>hg clone git://github.com/schacon/munger.git</pre>
<p>
If you are starting from an existing Mercurial repository,
you have to setup a Git repository somewhere that you have
push access to, and then run <code>hg push [path]</code>
from within your project. For example:
</p>
<pre>$ cd hg-git # (a Mercurial repository)
$ hg bookmark -r default master # make a bookmark of master for default, so a ref gets created
$ hg push git+ssh://git@github.com/schacon/hg-git.git
$ hg push</pre>
<p>
This will convert all our Mercurial data into Git objects
and push them up to the Git server. You can also put that
path in the <code>[paths]</code> section of .hg/hgrc and
then push to it by name.
</p>
<p>
Now that you have a Mercurial repository that can push/pull
to/from a Git repository, you can get updates
with <code>hg pull</code>.
</p>
<pre>$ hg pull</pre>
<p>
That will pull down any commits that have been pushed to the
server in the meantime and give you a new head that you can
merge in.
</p>
</div>
<div class='section'>
<div class="title">Installing</div>
<h3>Installing Hg-Git the easy way:</h3>
<p>
First, make sure that you have a working C compiler on your
system. On Windows, one option is the
free <a href="http://msdn.microsoft.com/en-us/express/future/bb421473">Microsoft
Visual C++</a>. (Be sure to install the 2008 version for
compatibility reasons.) On Debian-style Linux,
run <code>apt-get install python-dev</code>.
</p>
<p>
Secondly, run <code>easy_install hg-git</code>. If you don't
have easy_install available, you can get it as part of
Python's
<a href="http://pypi.python.org/pypi/setuptools">setuptools</a>
package.
</p>
<p>
Lastly, make sure the
following is in your <code>~/.hgrc</code>:
</p>
<pre>[extensions]
hgext.bookmarks =
hggit = </pre>
<p>
...and that's it!
</p>
<h3>Installing Hg-Git manually</h3>
<p>
Use this method if you'd like to install a clone of the Hg-Git
repository rather than a static package, or if you'd like to
install Hg-Git in a location you choose yourself.
</p>
<p>
First, install version 0.8.0 or newer of
<a href="http://pypi.python.org/pypi/dulwich">Dulwich</a>.
You can do
<code>easy_install 'dulwich>=0.8.0'</code> if you have
<a href="http://pypi.python.org/pypi/setuptools">setuptools</a>
installed. Next, clone
<a href="http://bitbucket.org/durin42/hg-git">the Hg-Git
repository</a>
somewhere. Lastly, make the 'extensions' section in your
'<code>~/.hgrc</code>' file look something like this:
</p>
<pre>[extensions]
hgext.bookmarks =
hggit = [path-to]/hg-git/hggit</pre>
<p>
That will enable the Hg-Git extension for you. The bookmarks
section is only required prior to hg 1.7. Bookmarks will be
translated to git heads when pushing.
</p>
</div>
<div class='section'>
<div class="title">Dependencies</div>
<p>
This plugin is known to work on Mercurial 1.7, and is
basically functional (with a couple of bugs) against hg 1.8
and 1.9. It also needs Dulwich version 0.8.0 or later; Dulwich
is a pure-Python implementation of the Git file formats and
protocols. There are <strong>no Git binary
dependencies</strong>: you do not need to have Git installed
on your system.
</p>
</div>
<div class='section'>
<div class="title">Sources</div>
<p>
Source available via
<a href="http://bitbucket.org/durin42/hg-git">hg</a>
(canonical repo) or
<a href="http://github.com/schacon/hg-git">git</a> (mirror
of hg). Patches preferred via email to
the <a href="http://groups.google.com/group/hg-git">hg-git
mailing list</a>.
</p>
</div>
<div class="span-21">
<div id="bottom">
This plugin was originally developed by the folks
at <a href="http://github.com">GitHub</a>, and is currently
maintained by Augie Fackler.
</div>
</div>
<div id="footer" class="span-21">
<div class="info span-12">
<div class="links">
<a href="http://groups.google.com/group/hg-git/">Google Group</a>
</div>
</div>
<div class="fork span-7">
This website is <a href="http://github.com/hg-git/hg-git.github.com">open source</a>.
Please help us by forking the project and adding to it.
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$('.title').corner();
$('.tbar').corner();
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.