6 Commits

Author SHA1 Message Date
Mark Nauwelaerts
426ed618b2 Release v1.0.4 2022-12-07 19:10:40 +01:00
Mark Nauwelaerts
5f34d049b9 test: adjust configuration to recent git
... to allow file protocol

Fixes mnauw/git-remote-hg#53
2022-12-06 22:57:29 +01:00
Mark Nauwelaerts
ea7e9bf31a helper: align getenv compatibility helper 2022-10-22 18:46:52 +02:00
Mark Nauwelaerts
a3a36883c5 Ensure fallback getenvb returns bytes 2022-10-22 18:46:47 +02:00
Jeremiah Blanchard
0fdd28319a Fixes bug where compat.getenv fails on Windows due to bytes type (when string expected) (tested on Python 3.10) 2022-10-22 18:28:04 +02:00
Julien Cristau
dfa3ad5fca helper: adjust for hg 6.1
mercurial.util.url became mercurial.utils.urlutil.url in 5.8.
2022-03-28 22:48:55 +02:00
4 changed files with 23 additions and 5 deletions

View File

@@ -5,6 +5,11 @@
from mercurial import hg, ui, commands, util
from mercurial import context, subrepo
try:
# hg >= 5.8
from mercurial.utils import urlutil
except ImportError:
from mercurial import util as urlutil
import re
import sys
@@ -51,7 +56,13 @@ if sys.version_info[0] == 3:
stdout = sys.stdout.buffer
stderr = sys.stderr.buffer
getcwd = os.getcwdb
getenv = os.getenvb if os.supports_bytes_environ else os.getenv
@staticmethod
def getenvb(val, default):
result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default)
# if result is a string, get bytes instead
result = result.encode() if hasattr(result, 'encode') else result
return result
getenv = os.getenvb if os.supports_bytes_environ else getenvb
else:
class compat(basecompat):
# life was simple in those days ...
@@ -308,11 +319,11 @@ class GitHgRepo:
if not kind in (b'hg', b'git'):
warn('skipping unsupported subrepo type %s' % kind)
continue
if not util.url(src).isabs():
if not urlutil.url(src).isabs():
parent = self.get_hg_repo_url(remote)
if not parent:
die(b'could not determine repo url of %s' % remote)
parent = util.url(parent)
parent = urlutil.url(parent)
parent.path = posixpath.join(parent.path or b'', src)
parent.path = posixpath.normpath(parent.path)
src = bytes(parent)

View File

@@ -86,7 +86,13 @@ if sys.version_info[0] == 3:
stdout = sys.stdout.buffer
stderr = sys.stderr.buffer
getcwd = os.getcwdb
getenv = os.getenvb if os.supports_bytes_environ else os.getenv
@staticmethod
def getenvb(val, default):
result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default)
# if result is a string, get bytes instead
result = result.encode() if hasattr(result, 'encode') else result
return result
getenv = os.getenvb if os.supports_bytes_environ else getenvb
urlparse = urllib.parse.urlparse
urljoin = urllib.parse.urljoin
else:

View File

@@ -3,7 +3,7 @@
import setuptools
# strip leading v
version = 'v1.0.3.2'[1:]
version = 'v1.0.4'[1:]
# check for released version
assert (len(version) > 0)

View File

@@ -65,3 +65,4 @@ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
# maintain backwards compatible default
# (as used in remote helper)
git config --global init.defaultBranch master
git config --global protocol.file.allow always