summaryrefslogtreecommitdiff
path: root/git-remote-testpy.py
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-01-20 13:15:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-25 03:32:35 (GMT)
commit0846b0c905a885720138e8194fb0289f121b5da1 (patch)
treeff187058986a7e7d1bdac6af207e16f20c2f7922 /git-remote-testpy.py
parentcadbf5c7ed4ea60d2b776346586b224e774dca4b (diff)
downloadgit-0846b0c905a885720138e8194fb0289f121b5da1.zip
git-0846b0c905a885720138e8194fb0289f121b5da1.tar.gz
git-0846b0c905a885720138e8194fb0289f121b5da1.tar.bz2
git-remote-testpy: hash bytes explicitly
Under Python 3 'hasher.update(...)' must take a byte string and not a unicode string. Explicitly encode the argument to this method to hex bytes so that we don't need to worry about failures to encode that might occur if we chose a textual encoding. This changes the directory used by git-remote-testpy for its git mirror of the remote repository, but this tool should not have any serious users as it is used primarily to test the Python remote helper framework. The use of encode() moves the required Python version forward to 2.0. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-remote-testpy.py')
-rw-r--r--git-remote-testpy.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git-remote-testpy.py b/git-remote-testpy.py
index d94a66a..197b7be 100644
--- a/git-remote-testpy.py
+++ b/git-remote-testpy.py
@@ -31,9 +31,9 @@ from git_remote_helpers.git.exporter import GitExporter
from git_remote_helpers.git.importer import GitImporter
from git_remote_helpers.git.non_local import NonLocalGit
-if sys.hexversion < 0x01050200:
- # os.makedirs() is the limiter
- sys.stderr.write("git-remote-testgit: requires Python 1.5.2 or later.\n")
+if sys.hexversion < 0x02000000:
+ # string.encode() is the limiter
+ sys.stderr.write("git-remote-testgit: requires Python 2.0 or later.\n")
sys.exit(1)
def get_repo(alias, url):
@@ -45,7 +45,7 @@ def get_repo(alias, url):
repo.get_head()
hasher = _digest()
- hasher.update(repo.path)
+ hasher.update(repo.path.encode('hex'))
repo.hash = hasher.hexdigest()
repo.get_base_path = lambda base: os.path.join(