Skip to main content

Tools to facilitate using hg git as a git client for hg

Project description

This app allows you to do local development in a git repository and push your changes to an upstream mercurial repository.

It tries not to affect the upstream mercurial repo in any way. Thus, only a restricted git workflow is available to you.

gitifyhg communicates between the two repos using patches. These are applied using hg export, hg import, git format-patch, and git am.

Currently, gitifyhg does import upstream hg branches at all and it’s primary purpose is to keep master synced up with default in the mercurial repository. It can rebase master onto the hg upstream, and it can push patches from master to upstream.

URLS

Dependencies

gitifyhg explicitly depends on:

These packages will be installed automatically by easy_install, pip, setup.py install, or setup.py develop.

gitifyhg also expects the following to be installed on your os:

Supports

gitifyhg has been tested to run on:

  • cPython 2.6

  • cPython 2.7

  • cPython 3.3

  • pypy

It has only been tested on Arch Linux. I expect all Linux operating systems to work fine with it and I suspect MacOS will also react well. All bets are off with Windows, but please let me know if it works or you fixed it.

Install

gitifyhg is a properly designed Python package. You can get it from pypi using either

pip install gitifyhg

or

easy_install gitifyhg

gitifyhg works in a virtualenv, but you’re probably just as well off to install it at the system level.

You can also install manually with

git clone https://github.com/buchuki/gitifyhg.git
python setup.py install

If you want to hack on it, use setup.py develop, instead. In this case, you probably are better off using a virtualenv.

Instructions

  • Get your Mercurial default branch into a reasonable state and push all your changes.

  • Run gitifyhg clone <mercurial repository url>. This will create a new git repository just like git clone. There will be a hidden .gitifyhg directory in there that holds a working mercurial clone of the upstream repo and an intermediate directory for patches.

  • cd repo_name

  • Set up your .gitignore. You’ll probably want to add .gitignore itself to the list of ignored files, as you don’t want to tip upstream off that you are using a superior DVCS. You’ll also want to add .gitifyhg, as well as any patterns that are in the .hgignore from the original repo. You can symlink .gitignore to .hgignore provided the .hgignore uses glob syntax. See http://www.selenic.com/mercurial/hgignore.5.html for more information.

  • git checkout -b working_branch_name. You can work directly on master, but I would avoid it to makes recovering from problems easier.

  • Use git however you see fit. Use git flow, use rebase -i, use commit --amend, use add -p. Use all the wonderful git tools that you have been aching to have available while being forced to work on mercurial repositories.

  • At some point, you’ll be ready to publish your changes to the hg repository. First run git hgrebase to pull in changes from mercurial default and have them appended to git master. If you have patches on master, they will be rebased onto the new patches from upstream.

  • Rebase your working branch onto master and then merge it into master (or use git-flow for more sensible commands):

    git checkout working_branch_name
    git rebase master
    git checkout master
    git merge master
  • git hgpush to push your patches upstream. It will present an error if there were upstream changes while you were doing the rebase step, so you don’t have to worry too much about merge fail.

License

gitifyhg is copyright 2012 Dusty Phillips and is licensed under the GNU General Public License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitifyhg-0.4.tar.gz (6.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page