mirror of
https://github.com/getsolus/packages.git
synced 2025-04-26 21:01:01 +03:00
62 lines
1.7 KiB
Diff
62 lines
1.7 KiB
Diff
# HG changeset patch
|
|
# User Matt Harbison <matt_harbison@yahoo.com>
|
|
# Date 1735114105 18000
|
|
# Wed Dec 25 03:08:25 2024 -0500
|
|
# Branch stable
|
|
# Node ID 51422b882ab10948043ba531e85a02b2b43a404c
|
|
# Parent ae2a656dc16741b44e253eaa4a879ecb87f24291
|
|
hglib: handle moving `mercurial.rcutil` to `mercurial.configuration.rcutil`
|
|
|
|
The goofy definition stub is so that pytype doesn't merge an unknown with the
|
|
function signature that it sees in the new module, and type it as `Any`. If the
|
|
real definition changes, it should type the symbol as a union of the two
|
|
signatures, and hopefully that's good enough to notice the change.
|
|
|
|
diff --git a/tortoisehg/util/hglib.py b/tortoisehg/util/hglib.py
|
|
--- a/tortoisehg/util/hglib.py
|
|
+++ b/tortoisehg/util/hglib.py
|
|
@@ -14,6 +14,7 @@
|
|
import shlex
|
|
import sys
|
|
import time
|
|
+import typing
|
|
|
|
from typing import (
|
|
cast,
|
|
@@ -39,7 +40,6 @@
|
|
patch as patchmod,
|
|
pathutil,
|
|
pycompat,
|
|
- rcutil,
|
|
revset as revsetmod,
|
|
revsetlang,
|
|
scmutil,
|
|
@@ -64,6 +64,20 @@
|
|
ngettext as _ngettext,
|
|
)
|
|
|
|
+# pytype: disable=import-error
|
|
+try:
|
|
+ from mercurial.configuration import rcutil
|
|
+ userrcpath = rcutil.userrcpath # defeat demandimport
|
|
+except (ImportError, AttributeError):
|
|
+ # hg < 7.0 (0a81f3ef054c)
|
|
+ from mercurial import rcutil
|
|
+ userrcpath = rcutil.userrcpath
|
|
+
|
|
+ if typing.TYPE_CHECKING:
|
|
+ def userrcpath() -> list[bytes]:
|
|
+ raise NotImplementedError
|
|
+# pytype: enable=import-error
|
|
+
|
|
TYPE_CHECKING = getattr(pycompat, 'TYPE_CHECKING', False)
|
|
|
|
if TYPE_CHECKING:
|
|
@@ -102,7 +116,6 @@
|
|
|
|
extractpatch = patchmod.extract
|
|
tokenizerevspec = revsetlang.tokenize
|
|
-userrcpath = rcutil.userrcpath
|
|
|
|
# TODO: use unicode version globally
|
|
def _(message: str, context: str = '') -> bytes:
|