3

Some years ago, Mercurial | TortoiseHG could exchange data bidirectionally easy with at least 2 Big Brothers:

Current (6.0 versions of family) state - the ordinary users have none:

  • hg-subversion is broken (extension can't be loaded), bundled with THG (Mercurial ???) extension not updated since 2019 hgsubversion: 6a6ce9d9da35 2019-04-19 (extraction from my TortoiseHg\extension-versions.txt), external SVN-bindings exist only for Python 2.7 (while py3-movement inside Mercurial is live and active)
  • hg-git got some big troubles, starting from THG 4.9 (manual patching of library.zip was required), on 6 version the situation has gotten better (no patching), but still unsatisfactory for the common user - installing Python 2.7 (for single-user) and using pip isn't The Right Way (tm)

Are there any comments, additions, clarifications, recommendations on how to do it (if what I am doing is wrong)?

Addition after some testing: special verson tortoisehg-6.0hggit-x64.msi from Matt Harbison at least allow using hg-git with ssh-transport (not http yet) and can be recommended for every-day usage by ordinary user.

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • As a workaround, in many cases one can still use much older versions of HG on a current repository. So if the need is just for a one-time conversion, that could suffice. – StayOnTarget Jan 03 '22 at 13:42
  • Your addition seems more like another answer than part of the Question... good find. – StayOnTarget Jan 08 '22 at 12:59
  • I found that `hg convert` requires Subversion bindings in Python that are found in the `python-subversion` Debian package for Python 2.x -- However, Debian 10 didn't have the corresponding `python3-subversion` package. Debian 11 and up do provide that so we upgraded. Not sure whether `hg-subversion` uses the same bindings or different ones. – ecm Mar 18 '22 at 15:21
  • Apparently `hg-subversion` can use either the `Subvertpy` bindings or the `SWIG` bindings. I believe the latter are what is provided in these Debian packages. – ecm Mar 18 '22 at 16:32
  • 1
    @ecm - from **user's POV** there is another *additional* problem here: any binding provided for Mercurial by additional extension, which have to be a) functional b) maintained and both conditions are **not met** now – Lazy Badger Mar 19 '22 at 09:03

2 Answers2

6

So, as a current maintainer of hg-git and former contributor to hgsubversion, I think I can provide some context here.

Regarding hgsubversion, the short answer that it is either dead or — at best — extremely dormant. Personally, I have not interacted with a Subversion repository in years, and that's a common experience. No-one has been sufficiently motivated to fix bugs, keep it working, and — last, but not least — make it work with Python 3.

For hg-git, a period of semi-dormant state meant that the TortoiseHg maintainers stopped bundling it. We now keep up with Mercurial releases, and I've requested that they reverse that decision. I believe they bundle Dulwich, but as I don't use Windows, I can't say for sure. That said, it's quite reasonable to want to use hg-git with TortoiseHg, and if you run into any specific issues, I'd suggest you file a bug with them — or perhaps add a comment to the bug I linked earlier.

Generally speaking, you should be able to use 0.10.x version of hg-git with most versions of TortoiseHg, as I believe they bundle Dulwich. In that case, enabling the extension should be as simple as:

hg clone -u 0.10.x http://foss.heptapod.net/mercurial/hg-git /path/to/repo

And then adding the following to your .hgrc:

[extensions]
hggit = /path/to/repo/hggit

Once TortoiseHg moves to Python 3.x, the default branch of hg-git will work with it again.

EDIT: I was wrong; they don't bundle Dulwich, it seems. On the bug for this, one of the maintainers posted a link to a packaged installer that includes hg-git & Dulwich. The next release, 6.1, should fix this. Please consider testing the installer, and report to the TortoiseHg maintainers whether it works as expected.

EDIT²: Please note that only SSH works with that installer, as they ran into some issues bundling urllib3, which is necessary for HTTP support.

  • thank you for confirmation of perspectives for hg-subversion, but I'm sorry - I haven't good news about hg-git. I **have** external hg-git from the times of THG 5.02, I **tried** both `0.10.3` and `tip`, now testing HEAD of `0.10.x` and get the same (for `tip`) `*** failed to import extension hggit from ...\hg-git\hggit: No module named dulwich`. I read **all** hg-git related issues on heptapod, didn't try yet only installing Python 2.7 for pip-based hg-git – Lazy Badger Dec 30 '21 at 11:57
  • @LazyBadger you probably saw this, which has some notes on hggit, but just in case you did not: https://stackoverflow.com/q/67859068/3195477 – StayOnTarget Jan 03 '22 at 13:44
  • @LazyBadger Ah, my assumption was incorrect! Fortunately, one of the maintainers created an installer that should work this in the meantime; I've edited the answer to reflect this. – Dan Villiom P. Christiansen Jan 04 '22 at 17:52
  • I'm testing the release, but I'm new to hggit. I'm trying the first example that appears with "hg help hggit" (cloning dulwich) but I'm getting a "No module named urllib3" error unless I use git:// instead of git+https:// . However I can't push to github if using git:// . Is this a bug or I'm doing something wrong? – KakCAT Feb 19 '22 at 14:41
  • 1
    @KakCAT Sadly, they ran into some issues bundling `urllib3` with Python 2.7, but SSH works. You can set up an SSH key and use SSH URIs; although this is suboptimal, only supporting SSH with Git is preferable to no support for Git at all. – Dan Villiom P. Christiansen Mar 04 '22 at 18:10
  • Thank you @DanVilliomP.Christiansen for your work. As a user not familiar with the Python ecosystem, the whole experience with hggit in the last few years has been pretty frustrating (after it suddenly stopped working out of the box after a THG update). I'll try that packaged installer for now, but I hope that you, the Dulwich and THG maintainers can get this back into a bundled working state where it "just works" - the documentation on https://hg-git.github.io/ is pretty misleading right now. – Lucero May 02 '22 at 11:55
  • 1
    @Lucero - at least now I can confirm: we got "work from a box" for ssh and https connections with bundled (into THG) hggit – Lazy Badger Oct 12 '22 at 06:24
  • Thank you @LazyBadger for the followup! I'll try the latest THG version then. :) – Lucero Oct 12 '22 at 09:45
1

TortoiseHG 6.2

Bundled hg-git works (at least with GitHub), but for now only for https:// repos:

old worked ssh-access failed with complaining about my keys With the new keypair (still RSA) and PageAnt-x64 (for THG-x64) I got both access-methods in game

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110