Giter VIP home page Giter VIP logo

git-remote-hg's Introduction

'git-remote-hg' is the semi-official Mercurial bridge from 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:

wget https://raw.github.com/felipec/git-remote-hg/master/git-remote-hg -O ~/bin/git-remote-hg
chmod +x ~/bin/git-remote-hg

That’s it :)

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, specially if it’s a big one. Otherwise lots of space will be wasted.

The oldest version of mercurial supported is 1.9. For the most part 1.8 works, but you might experience some issues.

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.

However, some of these features require very new versions of 'git-remote-hg', so you might have better luck simply specifying the username and password in the URL.

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 the remote-helpers' framework apply. In particular, these commands don’t work:

  • git push origin :branch-to-delete

  • git push origin old:new (it will push 'old') (patches available)

  • git push --dry-run origin branch (it will push) (patches available)

Other projects

There are other 'git-remote-hg' projects out there, do not confuse this one, this is the one distributed officially by the Git project:

For a comparison between these and other projects go here.

Contributing

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

git-remote-hg's People

Contributors

felipec avatar rhansen avatar apelisse avatar pabs3 avatar tboegi avatar gitster avatar fingolfin avatar rudis avatar ambakshi avatar benabik avatar delcypher avatar zetten avatar artagnon avatar wking avatar jcb91 avatar

Watchers

James Cloos avatar pandyxu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.