A Scalable, User-Friendly Source Control System.
Go to file
Abderrahim Kitouni f6dc1c3540 revert the changes made in 1eaf107ee0e5 and cbd9deb7c675
Merges can be done in either git or hg, so we should not add information
in the git log.
2009-06-29 23:20:37 +01:00
dulwich remove profiling code and cache all trees more effectively 2009-06-03 13:29:28 -07:00
tests trying to fix some of the broken tests 2009-06-29 15:28:25 +01:00
unit-tests modified topological sort to be non-recursive 2009-05-09 22:52:30 -07:00
__init__.py Remove remotes support (use the paths section in hgrc instead) 2009-06-08 19:15:58 +01:00
.gitignore add .gitignore too. fun. 2009-04-28 17:50:23 -07:00
.hgignore Add a basic test for cloning. 2009-04-26 18:27:24 -07:00
COPYING add gpl file 2009-04-29 15:29:02 -07:00
DESIGN.txt cleaned up documentation, created initial branch policy 2009-04-28 18:55:14 -07:00
git_handler.py revert the changes made in 1eaf107ee0e5 and cbd9deb7c675 2009-06-29 23:20:37 +01:00
gitrepo.py Initial clone/pull/push support for git repositories 2009-06-03 21:15:43 +01:00
hgrepo.py revert the changes made in 1eaf107ee0e5 and cbd9deb7c675 2009-06-29 23:20:37 +01:00
lsprofcalltree.py fixed serious speed issue with rename detection 2009-06-03 09:22:27 -07:00
Makefile Fix single test running. 2009-04-28 12:13:16 -07:00
README.md README: minor fixes 2009-06-28 21:49:44 +01:00
TODO.txt fixed serious speed issue with rename detection 2009-06-03 09:22:27 -07:00
toposort.py modified topological sort to be non-recursive 2009-05-09 22:52:30 -07:00

Warning: This plugin is not yet stabilized. Use to help me identify bugs, but it will be a few weeks before its fully stable.

Project status as of 5/27: Pretty solid, but a bit slow - can losslessly convert most major scenarios and can handle projects up to several thousand commits. Submodules in Git are not handled. See TODO.txt for full list of things I'm working on.

Hg-Git Mercurial Plugin

This is the Hg-Git plugin for Mercurial, adding the ability to push and pull to/from a Git server repository from Hg. This means you can collaborate on Git based projects from Hg, or use a Git server as a collaboration point for a team with developers using both Git and Hg.

The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via an Hg repository and another Hg client can pull it and their changeset node ids will be identical - Mercurial data does not get lost in translation. It is intended that Hg users may wish to use this to collaborate even if no Git users are involved in the project, and it may even provide some advantages if you're using Bookmarks (see below).

Dependencies

This plugin is implemented entirely in Python - there are no Git binary dependencies, you do not need to have Git installed on your system. There are in fact no external dependencies currently other than Mercurial. The plugin is known to work on Hg versions 1.1 and 1.2.

Commands

You can clone a Git repository from Hg by running hg clone [url]. For example, if you were to run hg clone git://github.com/schacon/munger.git it would clone the repository down into the directory 'munger.git', then convert it to an Hg repository for you.

hg clone git://github.com/schacon/hg-git.git

If you want to clone a github repository for later pushing (or any other repository you access via ssh), you need to convert the ssh url to a format with explicit protocol prefix (mind the switch from colon to slash after the host!):

git clone git@github.com:schacon/hg-git.git
hg clone git+ssh://git@github.com/schacon/hg-git.git

If you are starting from an existing Hg repository, you have to setup a Git repository somewhere that you have push access to, add it as default path or default-push path in your .hg/hgrc and then run hg push from within your project. For example:

cd hg-git # (an Hg repository)
(edit .hg/hgrc and add the target git url in the paths section)
hg push

This will convert all your Hg data into Git objects and push them up to the Git server.

Now that you have an Hg repository that can push/pull to/from a Git repository, you can fetch updates with hg pull.

$ hg pull

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.

Hg Bookmarks Integration

If you have the bookmarks extension enabled, Hg-Git will use it. It will push your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks.

This is actually pretty cool, since you can use this extension to transfer your Hg bookmarks via the Git protocol, rather than having to scp them, as the Hg transfer protocol does not currently support transferring bookmarks.

Installing

Clone this repository somewhere and make the 'extensions' section in your ~/.hgrc file look something like this:

[extensions]
hgext.bookmarks =
hgext.hg-git = [path-to]/hg-git

That will enable the Hg-Git extension for you. The bookmarks section is not compulsory, but it makes some things a bit nicer for you.

Authors

  • Scott Chacon schacon@gmail.com - main development
  • Augie Fackler durin42@gmail.com - testing and moral support
  • Sverre Rabbelier sverre@rabbelier.nl - gexport, mode and i18n stuff and misc fixes
  • Dulwich Developers - most of this code depends on the awesome work they did.

Sponsorship

GitHub let me (Scott) work on this full time for several days, which is why this got done at all. If you're looking for a free Git host to push your open source Hg projects to, do try us out (http://github.com).