mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-10-26 06:06:06 +01:00
Enable python3 support
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
@@ -52,10 +52,7 @@ the same commits:
|
||||
Remember to run `git gc --aggressive` after cloning a repository, especially if
|
||||
it's a big one. Otherwise lots of space will be wasted.
|
||||
|
||||
The newest supported version of Mercurial is 6.1 but only through Python 2. The
|
||||
oldest one is 2.4.
|
||||
|
||||
Support for Python 3 is ready, but will be released in the next version soon.
|
||||
The newest supported version of Mercurial is 6.2, the oldest one is 2.4.
|
||||
|
||||
=== Pushing branches ===
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 Felipe Contreras
|
||||
#
|
||||
@@ -26,12 +26,23 @@ import atexit
|
||||
import hashlib
|
||||
import time as ptime
|
||||
|
||||
from urlparse import urlparse, urljoin
|
||||
from urllib import quote as urlquote, unquote as urlunquote
|
||||
if sys.version_info[0] >= 3:
|
||||
from urllib.parse import urlparse, urljoin
|
||||
from urllib.parse import quote as urlquote, unquote as urlunquote
|
||||
|
||||
# Hack to set default encoding
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf-8')
|
||||
ferr = sys.stderr.buffer
|
||||
fin = sys.stdin.buffer
|
||||
|
||||
else:
|
||||
from urlparse import urlparse, urljoin
|
||||
from urllib import quote as urlquote, unquote as urlunquote
|
||||
|
||||
# Hack to set default encoding
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf-8')
|
||||
|
||||
ferr = sys.stderr
|
||||
fin = sys.stdin
|
||||
|
||||
#
|
||||
# If you want to see Mercurial revisions as Git commit notes:
|
||||
@@ -223,7 +234,7 @@ class Parser:
|
||||
self.line = self.get_line()
|
||||
|
||||
def get_line(self):
|
||||
return sys.stdin.readline().decode().strip()
|
||||
return fin.readline().decode().strip()
|
||||
|
||||
def __getitem__(self, i):
|
||||
return self.line.split()[i]
|
||||
@@ -253,7 +264,7 @@ class Parser:
|
||||
return None
|
||||
i = self.line.index(' ') + 1
|
||||
size = int(self.line[i:])
|
||||
return sys.stdin.read(size)
|
||||
return fin.read(size)
|
||||
|
||||
def get_author(self):
|
||||
ex = None
|
||||
@@ -416,7 +427,7 @@ def get_repo(url, alias):
|
||||
myui = ui.ui()
|
||||
|
||||
myui.setconfig(b'ui', b'interactive', b'off')
|
||||
myui.fout = sys.stderr
|
||||
myui.fout = ferr
|
||||
|
||||
if get_config_bool('remote-hg.insecure'):
|
||||
myui.setconfig(b'web', b'cacerts', b'')
|
||||
|
||||
@@ -17,7 +17,7 @@ then
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python2 -c 'import mercurial' > /dev/null 2>&1
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
test_done
|
||||
|
||||
@@ -17,16 +17,16 @@ then
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python2 -c 'import mercurial' > /dev/null 2>&1
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
if python2 -c 'import hggit' > /dev/null 2>&1
|
||||
if python -c 'import hggit' > /dev/null 2>&1
|
||||
then
|
||||
hggit=hggit
|
||||
elif python2 -c 'import hgext.git' > /dev/null 2>&1
|
||||
elif python -c 'import hgext.git' > /dev/null 2>&1
|
||||
then
|
||||
hggit=hgext.git
|
||||
else
|
||||
|
||||
@@ -17,7 +17,7 @@ then
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python2 -c 'import mercurial' > /dev/null 2>&1
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
test_done
|
||||
|
||||
@@ -102,7 +102,7 @@ class Component
|
||||
def build
|
||||
Dir.chdir(dir) do
|
||||
targets = %w[build_py build_ext].map { |e| [e, '--build-lib', "#{$builddir}/python"] }
|
||||
run_cmd %w[python2 setup.py --quiet] + targets.flatten
|
||||
run_cmd %w[python setup.py --quiet] + targets.flatten
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -40,3 +40,5 @@ hg:5.5 hggit:0.9.0 dulwich:0.19.15 # 2020_08
|
||||
hg:5.6 hggit:0.9.0 dulwich:0.19.15 # 2020_10
|
||||
|
||||
hg:5.7 hggit:0.10.0 dulwich:0.19.16 # 2021_01
|
||||
|
||||
hg:5.8 hggit:0.10.1 dulwich:0.20.0 # 2021_05 # python3
|
||||
|
||||
Reference in New Issue
Block a user