summaryrefslogtreecommitdiff
path: root/git-remote-testpy.py
AgeCommit message (Collapse)AuthorFilesLines
2013-09-09git_remote_helpers: remove little used Python libraryLibravatar John Keeping1-305/+0
When it was originally added, the git_remote_helpers library was used as part of the tests of the remote-helper interface, but since commit fc407f9 (Add new simplified git-remote-testgit, 2012-11-28) a simple shell script is used for this. A search on Ohloh [1] indicates that this library isn't used by any external projects and even the Python remote helpers in contrib/ don't use this library, so it is only used by its own test suite. Since this is the only Python library in Git, removing it will make packaging easier as the Python scripts only need to be installed for one version of Python, whereas the library should be installed for all available versions. [1] http://code.ohloh.net/search?s=%22git_remote_helpers%22 Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-28git-remote-testpy: fix path hashing on Python 3Libravatar John Keeping1-1/+17
When this change was originally made (0846b0c - git-remote-testpy: hash bytes explicitly , I didn't realise that the "hex" encoding we chose is a "bytes to bytes" encoding so it just fails with an error on Python 3 in the same way as the original code. It is not possible to provide a single code path that works on Python 2 and Python 3 since Python 2.x will attempt to decode the string before encoding it, which fails for strings that are not valid in the default encoding. Python 3.1 introduced the "surrogateescape" error handler which handles this correctly and permits a bytes -> unicode -> bytes round-trip to be lossless. As the original came from reading the filesystem path, we convert them back into the original bytes encoded in sys.getfilesystemencoding(). At this point Python 3.0 is unsupported so we don't go out of our way to try to support it. Helped-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24git-remote-testpy: call print as a functionLibravatar John Keeping1-14/+14
This is harmless in Python 2, which sees the parentheses as redundant grouping, but is required for Python 3. Since this is the only change required to make this script just run under Python 3 without needing 2to3 it seems worthwhile. The case of an empty print must be handled specially because in that case Python 2 will interpret '()' as an empty tuple and print it as '()'; inserting an empty string fixes this. Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24git-remote-testpy: don't do unbuffered text I/OLibravatar John Keeping1-3/+7
Python 3 forbids unbuffered I/O in text mode. Change the reading of stdin in git-remote-testpy so that we read the lines as bytes and then decode them a line at a time. This allows us to keep the I/O unbuffered in order to avoid reintroducing the bug fixed by commit 7fb8e16 (git-remote-testgit: fix race when spawning fast-import). Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24git-remote-testpy: hash bytes explicitlyLibravatar John Keeping1-4/+4
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>
2013-01-14Merge branch 'fc/remote-testgit-feature-done'Libravatar Junio C Hamano1-0/+8
In the longer term, tightening rules is a good thing to do, and because nobody who has worked in the remote helper area seems to be interested in reviewing this, I would assume they do not think such a retroactive tightening will affect their remote helpers. So let's advance this topic to see what happens. * fc/remote-testgit-feature-done: remote-testgit: properly check for errors
2013-01-09Merge branch 'er/python-version-requirements'Libravatar Junio C Hamano1-0/+5
Some python scripts we ship cannot be run with older versions of the interpreter. * er/python-version-requirements: Add checks to Python scripts for version dependencies.
2012-11-29Rename git-remote-testgit to git-remote-testpyLibravatar Felipe Contreras1-0/+272
This script is not really exercising the remote-helper functionality, but more the python framework for remote helpers that live in git_remote_helpers. It's also not a good example of how to write remote-helpers, unless you are planning to use python, and even then you might not want to use this framework. So let's use a more appropriate name: git-remote-testpy. A patch that replaces git-remote-testgit with a simpler version is on the way. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>