[PATCH 1 of 8] ci: install `uv` to build Mercurial

7 views
Skip to first unread message

Matt Harbison

unread,
Jun 12, 2026, 10:46:20 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781299890 14400
# Fri Jun 12 17:31:30 2026 -0400
# Branch stable
# Node ID 8859294b955ec3ccc498e78e4c6a217e56307616
# Parent 133e58bf58fd2aef8d8bfe41da8132dd314e8f79
# EXP-Topic ci-uv
ci: install `uv` to build Mercurial

This is a short term hack until the CI image can be updated. The version of
`uv` that gets installed seems to default to Python 3.12 when building
Mercurial, so explicitly request `python3.11` to maintain the previous
configuration, and so the cext modules will load when running with `python3`.

The pytype setup script was deleted upstream, so it can't be called.

There's still a failure with the version number being invalid (something doesn't
like the old style `+{node|sort}` any longer), so to use CI at this point,
`setup.py` needs to be hacked to write out `__version__.py` with a fixed X.Y.Z
format for now. That's not done here.

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@

image: registry.heptapod.net/mercurial/ci-images/thg-pyqt5:$THG_CI_IMAGE_TAG
variables:
- PYTHON: python3
+ PYTHON: python3.11
THG_CI_IMAGE_TAG: v2.1
tests-hg-6.3:
script:
@@ -83,6 +83,8 @@
- hg -R /ci/repos/mercurial pull https://repo.mercurial-scm.org/hg
- hg -R /ci/repos/mercurial update stable
- hg -R /ci/repos/mercurial summary
+ - pipx install uv==0.11.21
+ - export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
@@ -95,6 +97,8 @@
- hg -R /ci/repos/mercurial pull https://repo.mercurial-scm.org/hg
- hg -R /ci/repos/mercurial update default
- hg -R /ci/repos/mercurial summary
+ - pipx install uv==0.11.21
+ - export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
@@ -108,10 +112,11 @@
- hg -R /ci/repos/mercurial pull https://repo.mercurial-scm.org/hg
- hg -R /ci/repos/mercurial update stable
- hg -R /ci/repos/mercurial summary
+ - pipx install uv==0.11.21
+ - export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
- - PYTHON=$PYTHON /ci/repos/mercurial/contrib/setup-pytype.sh
- ln -svf $(pwd)/contrib/typehints/* $($PYTHON -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs/
- make pytype PYTHON=$PYTHON HGPATH=/ci/repos/mercurial PYTHON_VERSION=3.11
allow_failure: true
@@ -123,10 +128,11 @@
- hg -R /ci/repos/mercurial pull https://repo.mercurial-scm.org/hg
- hg -R /ci/repos/mercurial update default
- hg -R /ci/repos/mercurial summary
+ - pipx install uv==0.11.21
+ - export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
- - PYTHON=$PYTHON /ci/repos/mercurial/contrib/setup-pytype.sh
- ln -svf $(pwd)/contrib/typehints/* $($PYTHON -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs/
- make pytype PYTHON=$PYTHON HGPATH=/ci/repos/mercurial PYTHON_VERSION=3.11
allow_failure: true

Matt Harbison

unread,
Jun 12, 2026, 10:46:20 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781300213 14400
# Fri Jun 12 17:36:53 2026 -0400
# Branch stable
# Node ID 5a7e5cb94209d538dfd923f350b9497bc8ecbd6f
# Parent 8859294b955ec3ccc498e78e4c6a217e56307616
# EXP-Topic ci-uv
typing: disable checks for a handful of imports from before hg 7.2

diff --git a/tortoisehg/util/hglib.py b/tortoisehg/util/hglib.py
--- a/tortoisehg/util/hglib.py
+++ b/tortoisehg/util/hglib.py
@@ -76,7 +76,6 @@
if typing.TYPE_CHECKING:
def userrcpath() -> list[bytes]:
raise NotImplementedError
-# pytype: enable=import-error

try:
# mercurial >= 7.2
@@ -89,6 +88,7 @@
from mercurial.dispatch import request
from mercurial.dispatch import _parseconfig as parse_config_opts
from mercurial.dispatch import _earlyparseopts as early_parse_opts
+# pytype: enable=import-error

if typing.TYPE_CHECKING:
from typing import (

Matt Harbison

unread,
Jun 12, 2026, 10:46:21 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781302059 14400
# Fri Jun 12 18:07:39 2026 -0400
# Branch stable
# Node ID b514aa50b0771afea8c60fbf0b4c4672a09de070
# Parent ca6d036370363ebe7a322e7768368255e141961f
# EXP-Topic ci-uv
typing: disable incorrect `wrong-arg-types` errors in `graphopt.py`

diff --git a/tortoisehg/hgqt/graphopt.py b/tortoisehg/hgqt/graphopt.py
--- a/tortoisehg/hgqt/graphopt.py
+++ b/tortoisehg/hgqt/graphopt.py
@@ -202,10 +202,14 @@
min(self._clean_revset_set) - 1)
if None not in self._revset_set:
return revs
+
+ # Mixed types of iterator elements (None vs int) are allowed here.
+ # pytype: disable=wrong-arg-types
return itertools.chain([None], revs)
+ # pytype: enable=wrong-arg-types
else:
revs = revset.spanset(self._repo, len(self._repo) - 1, -1)
- return itertools.chain([None], revs)
+ return itertools.chain([None], revs) # pytype: disable=wrong-arg-types

def _filter_parents(self, p1, p2):
"""omit parents not in revset as well as degenerate repository cases"""

Matt Harbison

unread,
Jun 12, 2026, 10:46:23 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781302848 14400
# Fri Jun 12 18:20:48 2026 -0400
# Branch stable
# Node ID c9270906e6c27615247ea18ed645139fbe5b3f66
# Parent b514aa50b0771afea8c60fbf0b4c4672a09de070
# EXP-Topic ci-uv
ci: don't run `hg version` in the repository for `uv` based builds

The `uv` builds changed things around so that local builds now need to run
something like `.local-venv/bin/hg version`, but that's run as part of the
`make local` command.

Funny enough, this removed command prints the expected version, but the correct
command prints the system installed version because "using both
--system-site-packages and --editable is completly borked in Python" according
to marmoute. But, this is the one he said to run.

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -86,7 +86,6 @@
- pipx install uv==0.11.21
- export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- - /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
- xvfb-run make tests PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
allow_failure: false
@@ -100,7 +99,6 @@
- pipx install uv==0.11.21
- export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- - /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
- xvfb-run make tests PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
allow_failure: true
@@ -115,7 +113,6 @@
- pipx install uv==0.11.21
- export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- - /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial
- ln -svf $(pwd)/contrib/typehints/* $($PYTHON -c "import pytype; print(pytype.__path__[0])")/typeshed/stubs/
- make pytype PYTHON=$PYTHON HGPATH=/ci/repos/mercurial PYTHON_VERSION=3.11
@@ -131,7 +128,6 @@
- pipx install uv==0.11.21
- export PATH="$PATH:/home/ci-runner/.local/bin"
- make -C /ci/repos/mercurial local PYTHON=$PYTHON
- - /ci/repos/mercurial/hg version --debug
- make local PYTHON=$PYTHON HGPATH=/ci/repos/mercurial

Matt Harbison

unread,
Jun 12, 2026, 10:46:24 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781303610 14400
# Fri Jun 12 18:33:30 2026 -0400
# Branch stable
# Node ID db0221452dc7a94b2d0387cd63a1caa5a41b3ffa
# Parent c9270906e6c27615247ea18ed645139fbe5b3f66
# EXP-Topic ci-uv
typing: disable an incorrect `attribute-error` when fetching the username

This function comes from the `thgrepository` class that extends all of the core
repository instances. So the type in the argument list is too broad, but I
can't fix that directly because the `thgrepo` module imports `qtlib` already, so
importing the former here will create a cycle. Someday we can use a protocol
class instead.

diff --git a/tortoisehg/hgqt/qtlib.py b/tortoisehg/hgqt/qtlib.py
--- a/tortoisehg/hgqt/qtlib.py
+++ b/tortoisehg/hgqt/qtlib.py
@@ -1536,7 +1536,7 @@
from tortoisehg.hgqt.settings import SettingsDialog
dlg = SettingsDialog(False, focus='ui.username')
dlg.exec()
- repo.invalidateui()
+ repo.invalidateui() # pytype: disable=attribute-error
return hglib.tounicode(hglib.configuredusername(repo.ui))

class _EncodingSafeInputDialog(QInputDialog):

Matt Harbison

unread,
Jun 12, 2026, 10:46:25 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781308508 14400
# Fri Jun 12 19:55:08 2026 -0400
# Branch stable
# Node ID fd46d442710ba9e9c59115a5f2e3bceaccd0e2ec
# Parent db0221452dc7a94b2d0387cd63a1caa5a41b3ffa
# EXP-Topic ci-uv
typing: disable incorrect `attribute-error` in the visdiff module

These should also be `thgrepository` instances.

diff --git a/tortoisehg/hgqt/visdiff.py b/tortoisehg/hgqt/visdiff.py
--- a/tortoisehg/hgqt/visdiff.py
+++ b/tortoisehg/hgqt/visdiff.py
@@ -449,7 +449,9 @@
label1b += b'[other]'
label2 += b'[merged]'

+ # pytype: disable=attribute-error
repoagent = repo._pyqtobj # TODO
+ # pytype: enable=attribute-error

# TODO: sort out bytes vs str
replace: Dict[str, Union[bytes, str]] = {
@@ -519,7 +521,11 @@
self.setWindowTitle(title)

self.resize(650, 250)
+
+ # pytype: disable=attribute-error
repoagent = repo._pyqtobj # TODO
+ # pytype: enable=attribute-error
+
self.reponame = hglib.fromunicode(repoagent.displayName())

self.ctxs = (ctx1a, ctx1b, ctx2)

Matt Harbison

unread,
Jun 12, 2026, 10:46:26 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781310847 14400
# Fri Jun 12 20:34:07 2026 -0400
# Branch stable
# Node ID ebd85c119441abfae43c79987e53a38ef25f9d41
# Parent fd46d442710ba9e9c59115a5f2e3bceaccd0e2ec
# EXP-Topic ci-uv
typing: disable incorrect `attribute-error` in the commit module

These should also be `thgrepository` and `thgchangectx` instances.

diff --git a/tortoisehg/hgqt/commit.py b/tortoisehg/hgqt/commit.py
--- a/tortoisehg/hgqt/commit.py
+++ b/tortoisehg/hgqt/commit.py
@@ -363,7 +363,7 @@
vbox.addLayout(hbox, 0)
self.buttonHBox = hbox

- if b'mq' in self.repo.extensions():
+ if b'mq' in self.repo.extensions(): # pytype: disable=attribute-error
self.hasmqbutton = True
pnhbox = QHBoxLayout()
self.pnlabel = QLabel()
@@ -818,13 +818,13 @@
@pyqtSlot()
def reload(self) -> None:
'User has requested a reload'
- self.repo.thginvalidate()
+ self.repo.thginvalidate() # pytype: disable=attribute-error
self.refresh()
self.stwidget.refreshWctx() # Trigger reload of working context

@pyqtSlot()
def refresh(self) -> None:
- ispatch = self.repo[b'.'].thgmqappliedpatch()
+ ispatch = self.repo[b'.'].thgmqappliedpatch() # pytype: disable=attribute-error
if not self.hasmqbutton:
self.commitButtonEnable.emit(not ispatch)
self.msgte.refresh(self.repo)
@@ -1110,7 +1110,7 @@
self.addUsernameToHistory(user)

checkedUnknowns = self.stwidget.getChecked('?I')
- if checkedUnknowns and b'largefiles' in repo.extensions():
+ if checkedUnknowns and b'largefiles' in repo.extensions(): # pytype: disable=attribute-error
result = lfprompt.promptForLfiles(self, repo.ui, repo,
checkedUnknowns)
if not result:

Matt Harbison

unread,
Jun 12, 2026, 10:46:28 PM (12 days ago) Jun 12
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1781314242 14400
# Fri Jun 12 21:30:42 2026 -0400
# Branch stable
# Node ID e67285613b63e494f6768c196eeaccd53ff1fd51
# Parent ebd85c119441abfae43c79987e53a38ef25f9d41
# EXP-Topic ci-uv
typing: update `matchmod.basematcher` types to use the core protocol class

diff --git a/tortoisehg/hgqt/manifestmodel.py b/tortoisehg/hgqt/manifestmodel.py
--- a/tortoisehg/hgqt/manifestmodel.py
+++ b/tortoisehg/hgqt/manifestmodel.py
@@ -62,6 +62,9 @@
from mercurial import (
localrepo,
)
+ from mercurial.interfaces.types import (
+ MatcherT,
+ )
from .qtcore import (
QObject,
)
@@ -598,7 +601,7 @@
def _makematcher(repo: localrepo.localrepository,
ctx: ThgContext,
pat: bytes,
- changedonly: bool) -> matchmod.basematcher:
+ changedonly: bool) -> MatcherT:
cwd = b'' # always relative to repo root
patterns = []
if pat and b':' not in pat and b'*' not in pat:
@@ -671,7 +674,7 @@
repo: localrepo.localrepository,
nodeop,
statusfilter: str,
- match: matchmod.basematcher) -> None:
+ match: MatcherT) -> None:
# TODO: replace 'Any' with structural typing for _treenodeop/_listnodeop
if 'S' in statusfilter:
_populatesubrepos(roote, repo, nodeop, statusfilter, match)
@@ -704,7 +707,7 @@
repo: localrepo.localrepository,
nodeop,
statusfilter: str,
- match: matchmod.basematcher) -> None:
+ match: MatcherT) -> None:
# TODO: replace 'Any' with structural typing for _treenodeop/_listnodeop
ctx = roote.ctx
pctx = roote.pctx
@@ -749,7 +752,7 @@
repo: localrepo.localrepository,
nodeop,
statusfilter: str,
- match: matchmod.basematcher) -> None:
+ match: MatcherT) -> None:
# TODO: replace 'Any' with structural typing for _treenodeop/_listnodeop
ctx = roote.ctx
stat = ctx.changesToParent(0) # pytype: disable=attribute-error

Yuya Nishihara

unread,
Jun 13, 2026, 9:06:22 AM (11 days ago) Jun 13
to Matt Harbison, thg...@googlegroups.com
On Fri, 12 Jun 2026 22:46:02 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_h...@yahoo.com>
> # Date 1781299890 14400
> # Fri Jun 12 17:31:30 2026 -0400
> # Branch stable
> # Node ID 8859294b955ec3ccc498e78e4c6a217e56307616
> # Parent 133e58bf58fd2aef8d8bfe41da8132dd314e8f79
> # EXP-Topic ci-uv
> ci: install `uv` to build Mercurial

Queued, thanks.

Matt Harbison

unread,
Jun 16, 2026, 11:19:26 PM (8 days ago) Jun 16
to TortoiseHg Developers
I think we're ready for a 7.2.2 tag.  I'll hold off on the Windows installer until the hg-git stuff gets sorted out.

Yuya Nishihara

unread,
Jun 20, 2026, 11:01:17 PM (4 days ago) Jun 20
to 'Matt Harbison' via TortoiseHg Developers
On Tue, 16 Jun 2026 20:19:26 -0700 (PDT), 'Matt Harbison' via TortoiseHg Developers wrote:
> I think we're ready for a 7.2.2 tag. I'll hold off on the Windows
> installer until the hg-git stuff gets sorted out.

Tagged, but it seems that I can no longer ssh into mercurial-scm.org.
Can you upload tarball?
Reply all
Reply to author
Forward
0 new messages