Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felipec/git-remote-hg
Transparent bidirectional bridge between Git and Mercurial for Git
https://github.com/felipec/git-remote-hg
Last synced: 7 days ago
JSON representation
Transparent bidirectional bridge between Git and Mercurial for Git
- Host: GitHub
- URL: https://github.com/felipec/git-remote-hg
- Owner: felipec
- License: gpl-2.0
- Created: 2014-05-09T14:05:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-03-07T07:08:50.000Z (8 months ago)
- Last Synced: 2024-10-13T17:19:52.625Z (28 days ago)
- Language: Shell
- Size: 257 KB
- Stars: 365
- Watchers: 30
- Forks: 86
- Open Issues: 28
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
`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 https://mercurial-scm.org/wiki/SchemesExtension[schemes extension]:
--------------------------------------
[auth]
bb.prefix = https://bitbucket.org/user/
bb.username = user
bb.password = password
--------------------------------------Finally, you can also use the
https://pypi.org/project/mercurial_keyring[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 (https://github.com/felipec/git/issues/65[Bug #65]).Limitations of Git's https://git-scm.com/docs/gitremote-helpers[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:
https://github.com/mnauw/git-remote-hg[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
https://github.com/felipec/git/wiki/Comparison-of-git-remote-hg-alternatives[here].== Contributing ==
Send your patches to the mailing list [email protected] (no need to
subscribe).