Hg-git - PyPI

Có thể bạn quan tâm

Skip to main content Switch to mobile version Search PyPI Search hg-git 1.2.0

pip install hg-git Copy PIP instructions

Latest version

Released: Feb 8, 2025

push to and pull from a Git repository using Mercurial

Navigation

  • Project description
  • Release history
  • Download files

Verified details

These details have been verified by PyPI
Maintainers
Avatar for danchr from gravatar.com danchr Avatar for gracinet from gravatar.com gracinet Avatar for krbullock from gravatar.com krbullock Avatar for mjacob from gravatar.com mjacob

Unverified details

These details have not been verified by PyPI
Project links
  • Homepage
Meta
  • License: GPLv2
  • Author: Scott Chacon, Augie Fackler, Kevin Bullock and others
  • Maintainer: The hg-git maintainers
  • Tags hg , git , mercurial
  • Requires: Python >=3.9
Report project as malware
  • Project description
  • Project details
  • Release history
  • Download files

Project description

Hg-Git Mercurial Plugin

Homepage:

https://wiki.mercurial-scm.org/HgGit

Repository:

https://foss.heptapod.net/mercurial/hg-git

Old homepage, no longer maintained:

https://hg-git.github.io/

Discussion:

hg-git@googlegroups.com (Google Group) and #hg-git:matrix.org

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 a Mercurial 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, and you do not need to have Git installed on your system. The only dependencies are:

  • Mercurial 6.6

  • Dulwich 0.21.6

  • Python 3.8

Please note that these are the earliest versions known to work; later versions generally work better.

Installing

We recommend installing the plugin using your a package manager, such as pip:

python -m pip install hg-git

Alternatively, you can clone this repository somewhere and install it from the directory:

hg clone https://foss.heptapod.net/mercurial/hg-git/ cd hg-git python -m pip install .

And enable it from somewhere in your $PYTHONPATH:

[extensions] hggit =

Contributing

The primary development location for Hg-Git is Heptapod, and you can follow their guide on how to contribute patches.

Alternatively, you can follow the guide on how to contribute to Mercurial itself, and send patches to the list.

Usage

You can clone a Git repository from Mercurial by running hg clone <url> [dest]. For example, if you were to run:

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

Hg-Git would clone the repository and convert it to a Mercurial repository for you. Other protocols are also supported, see hg help git for details.

If you are starting from an existing Mercurial repository, you have to set up a Git repository somewhere that you have push access to, add a path entry for it in your .hg/hgrc file, and then run hg push [name] from within your repository. For example:

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

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

Now that you have a Mercurial 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-Git pushes your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks.

Hg-Git can also be used to convert a Mercurial repository to Git. You can use a local repository or a remote repository accessed via SSH, HTTP or HTTPS. Use the following commands to convert the repository, it assumes you’re running this in $HOME:

$ mkdir git-repo; cd git-repo; git init; cd .. $ cd hg-repo $ hg bookmarks hg $ hg push ../git-repo

The hg bookmark is necessary to prevent problems as otherwise hg-git pushes to the currently checked out branch, confusing Git. The snippet above will create a branch named hg in the Git repository. To get the changes in master use the following command (only necessary in the first run, later just use git merge or git rebase).

$ cd git-repo $ git checkout -b master hg

To import new changesets into the Git repository just rerun the hg push command and then use git merge or git rebase in your Git repository.

.gitignore and .hgignore

If present, .gitignore will be taken into account provided that there is no .hgignore. In the latter case, the rules from .hgignore apply, regardless of what .gitignore prescribes.

Please note that Mercurial doesn’t support exclusion patterns, so any .gitignore pattern starting with ! will trigger a warning.

This has been so since version 0.5.0, released in 2013.

Further reading

See hg help -e hggit and hg help hggit-config.

Alternatives

Since version 5.4, Mercurial includes an extension called git. It interacts with a Git repository directly, avoiding the intermediate conversion. This has certain advantages:

  • Each commit only has one node ID, which is the Git hash.

  • Data is stored only once, so the on-disk footprint is much lower.

The extension has certain drawbacks, however:

  • It cannot handle all Git repositories. In particular, it cannot handle octopus merges, i.e. merge commits with more than two parents. If any such commit is included in the history, conversion will fail.

  • You cannot interact with Mercurial repositories.

Another extension packaged with Mercurial, the convert extension, also has Git support.

Other alternatives exist for Git users wanting to access Mercurial repositories, such as git-remote-hg.

Project details

Verified details

These details have been verified by PyPI
Maintainers
Avatar for danchr from gravatar.com danchr Avatar for gracinet from gravatar.com gracinet Avatar for krbullock from gravatar.com krbullock Avatar for mjacob from gravatar.com mjacob

Unverified details

These details have not been verified by PyPI
Project links
  • Homepage
Meta
  • License: GPLv2
  • Author: Scott Chacon, Augie Fackler, Kevin Bullock and others
  • Maintainer: The hg-git maintainers
  • Tags hg , git , mercurial
  • Requires: Python >=3.9

Release history Release notifications | RSS feed

This version

1.2.0

Feb 8, 2025

1.2.0b1 pre-release

Nov 18, 2024

1.1.4

Nov 18, 2024

1.1.3

Jun 25, 2024

1.1.2

Jun 7, 2024

1.1.1

Mar 6, 2024

1.1.0

Jan 13, 2024

1.1.0b1 pre-release

Nov 8, 2023

1.0.5

Mar 6, 2024

1.0.4

Jan 13, 2024

1.0.3

Nov 7, 2023

1.0.2

Mar 6, 2023

1.0.1

Nov 4, 2022

1.0.0

Apr 2, 2022

1.0.0b2.post1 pre-release

Mar 10, 2022

1.0.0b2 pre-release

Mar 10, 2022

1.0.0b1 pre-release

Jan 26, 2022

0.10.4

Jan 26, 2022

0.10.3

Nov 16, 2021

0.10.2

Jul 31, 2021

0.10.1

May 13, 2021

0.10.0

Feb 1, 2021

0.9.0

Aug 6, 2020

0.9.0a1 pre-release

May 13, 2020

0.8.13

Nov 18, 2019

0.8.12

Oct 15, 2018

0.8.11

Feb 24, 2018

0.8.10

Nov 2, 2017

0.8.9

Aug 10, 2017

0.8.8

Jul 24, 2017

0.8.7

Jul 24, 2017

0.8.6

Apr 19, 2017

0.8.5

Feb 2, 2016

0.8.4

Jan 2, 2016

0.8.3

Nov 9, 2015

0.8.2

Aug 11, 2015

0.8.1

May 12, 2015

0.8.0

Jan 30, 2015

0.7.0

Nov 5, 2014

0.6.1

Aug 1, 2014

0.6.0

May 13, 2014

0.5.0

Dec 14, 2013

0.4.0

Mar 24, 2013

0.3.4

Nov 1, 2012

0.3.3

Aug 6, 2012

0.3.2

Jan 27, 2012

0.3.1

Sep 13, 2011

0.3.0

Sep 9, 2011

0.2.6

Mar 1, 2011

0.2.5

Nov 2, 2010

0.2.4

Aug 25, 2010

0.2.3

Jul 5, 2010

0.2.2

May 23, 2010

0.2.1

Dec 26, 2009

0.2.0

Dec 26, 2009

0.1.0

Oct 18, 2009

Download files

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

Source Distribution

hg_git-1.2.0.tar.gz (227.3 kB view details)

Uploaded Feb 8, 2025 Source

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more about wheel file names.

Copy a direct link to the current filters Copy

File name Interpreter Interpreter py3 ABI ABI none Platform Platform any hg_git-1.2.0-py3-none-any.whl (77.7 kB view details)

Uploaded Feb 8, 2025 Python 3

File details

Details for the file hg_git-1.2.0.tar.gz.

File metadata

  • Download URL: hg_git-1.2.0.tar.gz
  • Upload date: Feb 8, 2025
  • Size: 227.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for hg_git-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3ebfab364a81b9b565b100b2a9de6676bf03df9ec5cd27772aecf911679ecfc3 Copy
MD5 41ea97cb4d6f6408be884a201e115a4d Copy
BLAKE2b-256 717a916a612ed36d8a3006122091aa9de329e4ca02e8ff9505c4f6bb3517fa79 Copy

See more details on using hashes here.

File details

Details for the file hg_git-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hg_git-1.2.0-py3-none-any.whl
  • Upload date: Feb 8, 2025
  • Size: 77.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for hg_git-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70dd48341d7611c77f060ded66329cf8e4d86c4aa237e6cc5fd938b22a1d467c Copy
MD5 41e9d5ffb3f4ee98ca13d43b2c9019eb Copy
BLAKE2b-256 5c6e191d7afda7d6bb3fc29612686830462a1420eab402cbe110c79d2f22544e Copy

See more details on using hashes here.

  • English
  • español
  • français
  • 日本語
  • português (Brasil)
  • українська
  • Ελληνικά
  • Deutsch
  • 中文 (简体)
  • 中文 (繁體)
  • русский
  • עברית
  • Esperanto
  • 한국어

Supported by

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

Từ khóa » Hg 2 Git