• Stars
    star
    365
  • Rank 116,851 (Top 3 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Transparent bidirectional bridge between Git and Mercurial for Git

git-remote-hg is the semi-official Mercurial bridge from the Git project, once installed, it allows you to clone, fetch and push to and from Mercurial repositories as if they were Git ones:

git clone "hg::http://selenic.com/repo/hello"

To enable this, simply add the git-remote-hg script anywhere in your $PATH:

curl https://raw.githubusercontent.com/felipec/git-remote-hg/master/git-remote-hg -o ~/bin/git-remote-hg
chmod +x ~/bin/git-remote-hg

That’s it :)

Obviously you will need Mercurial installed.

Configuration

If you want to see Mercurial revisions as Git commit notes:

% git config core.notesRef refs/notes/hg

If you are not interested in Mercurial permanent and global branches (aka. commit labels):

% git config --global remote-hg.track-branches false

With this configuration, the 'branches/foo' refs won’t appear.

If you want the equivalent of hg clone --insecure:

% git config --global remote-hg.insecure true

If you want git-remote-hg to be compatible with hg-git, and generate exactly the same commits:

% git config --global remote-hg.hg-git-compat true

Notes

Remember to run git gc --aggressive after cloning a repository, especially if it’s a big one. Otherwise lots of space will be wasted.

The newest supported version of Mercurial is 6.2, the oldest one is 4.0.

Pushing branches

To push a branch, you need to use the 'branches/' prefix:

% git checkout branches/next
# do stuff
% git push origin branches/next

All the pushed commits will receive the "next" Mercurial named branch.

Note: Make sure you don’t have remote-hg.track-branches disabled.

Cloning HTTPS

The simplest way is to specify the user and password in the URL:

git clone hg::https://user:[email protected]/user/repo

You can also use the schemes extension:

[auth]
bb.prefix = https://bitbucket.org/user/
bb.username = user
bb.password = password

Finally, you can also use the keyring extension.

Caveats

The only major incompatibility is that Git octopus merges (a merge with more than two parents) are not supported.

Mercurial branches and bookmarks have some limitations of Git branches: you can’t have both 'dev/feature' and 'dev' (as Git uses files and directories to store them).

Multiple anonymous heads (which are useless anyway) are not supported: you would only see the latest head.

Closed branches are not supported: they are not shown and you can’t close or reopen. Additionally in certain rare situations a synchronization issue can occur (Bug #65).

Limitations of Git’s remote-helpers framework apply.

Other projects

There are other git-remote-hg projects out there, but this is the original, which was distributed officially in the Git project.

Over the years many similar tools have died out, the only actively maintained alternative is mnauw’s fork of this project: mnauw/git-remote-hg. I’ve merged some of his patches, and he has merged some of my patches, so the projects are mostly in sync, but not quite. In particular Nauwelaerts' fork has many administrative extensions, which although useful to some people, I don’t believe they belong in the core.

For a comparison between these and other projects go here.

Contributing

Send your patches to the mailing list [email protected] (no need to subscribe).

More Repositories

1

sharness

Shell library to test your tools like Git does
Shell
373
star
2

notmuch-vim

Text-based mail user agent in vim using notmuch.
Vim Script
87
star
3

git-remote-bzr

Transparent bidirectional bridge between Git and Bazaar for Git
Python
75
star
4

git-related

Find related people and commits on a set of changes
Shell
68
star
5

vim-felipec

Vim color scheme: dark, bright, simple.
Vim Script
52
star
6

finit

Simple init system
Ruby
51
star
7

soap4r

SOAP4R is an implementation of SOAP 1.1 (W3C Note) for Ruby
Ruby
47
star
8

msn-pecan

MSN Messenger library in C
C
43
star
9

libpurple-mini

libpurple separate from pidgin.
C
33
star
10

git-completion

Git completion stuff
Shell
33
star
11

libomxil-bellagio

Bellagio OpenMAX IL
C
31
star
12

gst-openmax

GStreamer OpenMAX IL plug-in
C
31
star
13

vim-sanegx

Makes gx work correctly.
Vim Script
27
star
14

git-reintegrate

Tool that allows the regeneration of integration branches
Shell
22
star
15

xz-min

Minimal setup to trigger the xz backdoor
C
21
star
16

gst-dsp

GStreamer elements for TI's OMAP DSP
C
21
star
17

gst-player

Simple media player using GStreamer
C
16
star
18

gst-av

Some wrappers for libav
C
15
star
19

maemo-scrobbler

Maemo scrobbler
C
13
star
20

dotfiles

My config files
Ruby
13
star
21

xfce-config-helper

Helper to manage Xfce configurations
Ruby
12
star
22

good-taste

An illustration of good taste in code
SCSS
10
star
23

git-smartlist

Shell
9
star
24

ripary

Codeswarm rewrite in ruby
Ruby
8
star
25

math-notepad

Very simple math.js editor
JavaScript
7
star
26

dsp-dummy

A dummy dsp node; good example of how to write one
C
6
star
27

gst-transcode

GStreamer tools to help transcoding
6
star
28

git-send-series

A tool to help maintain patch series
Shell
5
star
29

dsp-tools

Miscellaneous utilities for TI's C64x+ DSP
C
5
star
30

libmsn-pecan

Library for MSN instant messaging protocol
C
4
star
31

gst-omapfb

GStreamer plug-in for omapfb rendering.
C
4
star
32

libomxil-g

Experimental OpenMAX IL implementation.
4
star
33

hexclock

A visualization of a hexclock (a true binary clock)
JavaScript
4
star
34

pidgin-git-import

Scripts to convert pidgin's mtn repo to git
Ruby
4
star
35

dot-team

Distributed collaborative dotfiles
Shell
3
star
36

libmtag

Simple yet useful tagging library for music.
C++
3
star
37

telepathy-msn-pecan

Telepathy CM using libmsn-pecan
C
2
star
38

ruby-parseopt

A simple yet powerful option parser
Ruby
2
star
39

dot-tools

Tools for managing dotfiles using git
Shell
2
star
40

wd-persistent-ssh

Saves .ssh folder on WD MyCloud devices
Makefile
2
star
41

gst-maemo-xiph

Parsers for ogg/flac, used for Maemo
C
2
star
42

notmuch-tools

My notmuch tools
Ruby
2
star
43

twitter-client

Simple twitter client using twitter-glib
C
2
star
44

liblzma

Simple build system for liblzma
Makefile
2
star
45

purple-msn-pecan

A libpurple plug-in that uses libmsn-pecan.
1
star
46

libmtag-ruby

Ruby bindings for mtag.
C
1
star
47

gst-xssim

Efficient SSIM element
C
1
star
48

milaatu

Simple test framework
Python
1
star
49

libtidsp

Library for tidspbridge
C
1
star
50

libmtag-python

Python bindings for mtag.
C
1
star
51

libgmsn

An asynchronous library designed to handle communication using the MSN protocol using GObject.
C
1
star
52

xz-hack-refactor

An attempt to simplify the xz backdoor to understand what it does
LLVM
1
star
53

ace-list

Examples of the best ways to write linked lists
Go
1
star
54

libproxy-simple

Simple replacement for libproxy
C
1
star