summaryrefslogtreecommitdiff
path: root/git_remote_helpers
AgeCommit message (Collapse)AuthorFilesLines
2013-01-30git_remote_helpers: remove GIT-PYTHON-VERSION upon "clean"Libravatar Junio C Hamano1-1/+1
fadf8c7 (git_remote_helpers: force rebuild if python version changes, 2013-01-20) started using a marker file to keep track of the version of Python interpreter used for the last build, but forgot to remove it when asked to "make clean". Acked-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24git_remote_helpers: use 2to3 if building with Python 3Libravatar John Keeping1-0/+10
Using the approach detailed in the Python documentation[1], run 2to3 on the code as part of the build if building with Python 3. The code itself requires no changes to convert cleanly. [1] http://docs.python.org/3.3/howto/pyporting.html#during-installation 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_helpers: force rebuild if python version changesLibravatar John Keeping2-1/+8
When different version of python are used to build via distutils, the behaviour can change. Detect changes in version and pass --force in this case. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-20git_remote_helpers: fix input when running under Python 3Libravatar John Keeping1-3/+6
Although 2to3 will fix most issues in Python 2 code to make it run under Python 3, it does not handle the new strict separation between byte strings and unicode strings. There is one instance in git_remote_helpers where we are caught by this, which is when reading refs from "git for-each-ref". Fix this by operating on the returned string as a byte string rather than a unicode string. As this method is currently only used internally by the class this does not affect code anywhere else. Note that we cannot use byte strings in the source as the 'b' prefix is not supported before Python 2.7 so in order to maintain compatibility with the maximum range of Python versions we use an explicit call to encode(). Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-20git_remote_helpers: allow building with Python 3Libravatar John Keeping1-1/+1
Change inline Python to call "print" as a function not a statement. This is harmless because Python 2 will see the parentheses as redundant grouping but they are necessary to run this code with Python 3. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-12-28Add checks to Python scripts for version dependencies.Libravatar Eric S. Raymond1-0/+5
Signed-off-by: Eric S. Raymond <esr@thyrsus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-26remote-testgit: fix direction of marksLibravatar Felipe Contreras1-1/+1
Basically this is what we want: == pull == testgit transport-helper * export -> import # testgit.marks git.marks == push == testgit transport-helper * import <- export # testgit.marks git.marks Each side should be agnostic of the other side. Because testgit.marks (our helper marks) could be anything, not necessarily a format parsable by fast-export or fast-import. In this test they happen to be compatible, because we use those tools, but in the real world it would be something completely different. For example, they might be mapping marks to mercurial revisions (certainly not parsable by fast-import/export). This is what we have: == pull == testgit transport-helper * export -> import # testgit.marks git.marks == push == testgit transport-helper * import <- export # git.marks testgit.marks The only reason this is working is that git.marks and testgit.marks are roughly the same. This new behavior used to not be possible before due to a bug in fast-export, but with the bug fixed, it works fine. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Change check_ref_format() to take a flags argumentLibravatar Michael Haggerty1-1/+1
Change check_ref_format() to take a flags argument that indicates what is acceptable in the reference name (analogous to "git check-ref-format"'s "--allow-onelevel" and "--refspec-pattern"). This is more convenient for callers and also fixes a failure in the test suite (and likely elsewhere in the code) by enabling "onelevel" and "refspec-pattern" to be allowed independently of each other. Also rename check_ref_format() to check_refname_format() to make it obvious that it deals with refnames rather than references themselves. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-19transport-helper: update ref status after push with exportLibravatar Sverre Rabbelier2-1/+61
Also add check_output from python 2.7. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-19git-remote-testgit: fix error handlingLibravatar Sverre Rabbelier5-22/+62
If fast-export did not complete successfully the error handling code itself would error out. This was broken in commit 23b093ee0 (Brandon Casey, Wed Jun 9 2010, Remove python 2.5'isms). Revert that commit an introduce our own copy of check_call in util.py instead. Tested by changing 'if retcode' to 'if not retcode' temporarily. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-19git_remote_helpers: push all refs during a non-local exportLibravatar Jeff King1-1/+1
When a remote helper exports to a non-local git repo, the steps are roughly: 1. fast-export into a local staging area; the set of interesting refs is defined by what is in the fast-export stream 2. git push from the staging area to the non-local repo In the second step, we should explicitly push all refs, not just matching ones. This will let us push refs that do not yet exist in the remote repo. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-19git-remote-testgit: import non-HEAD refsLibravatar Jeff King1-2/+7
Upon receiving an "import" command, the testgit remote helper would ignore the ref asked for by git and generate a fast-export stream based on HEAD. Instead, we should actually give git the ref it asked for. This requires adding a new parameter to the export_repo method in the remote-helpers python library, which may be used by code outside of git.git. We use a default parameter so that callers without the new parameter will get the same behavior as before. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27remote-helpers: build in platform independent directoryLibravatar Michael J Gruber1-0/+3
The build directory which is used by distutils depends on the platform (e.g. build/lib on Fedora 13, build/lib.linux-i686-2.6 on Ubuntu 9.04). But test-lib.sh expects to find the build in build/lib which can cause t5800-remote-helpers.sh to fail early. Override distutils' choice so that the build is always in build/lib. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13Remove python 2.5'ismsLibravatar Brandon Casey4-8/+25
The following python 2.5 features were worked around: * the sha module is used as a fallback when the hashlib module is not available * the 'any' built-in method was replaced with a 'for' loop * a conditional expression was replaced with an 'if' statement * the subprocess.check_call method was replaced by a call to subprocess.Popen followed by a call to subprocess.wait with a check of its return status These changes allow the python infrastructure to be used with python 2.4 which is distributed with RedHat's RHEL 5, for example. t5800 was updated to check for python >= 2.4 to reflect these changes. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-21Merge branch 'sr/remote-helper-export'Libravatar Junio C Hamano4-0/+220
* sr/remote-helper-export: t5800: testgit helper requires Python support Makefile: Simplify handling of python scripts remote-helpers: add tests for testgit helper remote-helpers: add testgit helper remote-helpers: add support for an export command remote-helpers: allow requesing the path to the .git directory fast-import: always create marks_file directories clone: also configure url for bare clones clone: pass the remote name to remote_get Conflicts: Makefile
2010-03-31remote-helpers: add testgit helperLibravatar Sverre Rabbelier4-0/+220
Currently the remote helper infrastructure is only used by the curl helper, which does not give a good impression of how remote helpers can be used to interact with foreign repositories. Since implementing such a helper is non-trivial it would be good to have at least one easy-to-follow example demonstrating how to implement a helper that interacts with a foreign vcs using fast-import/fast-export. The testgit helper can be used to interact with remote git repositories by prefixing the url with "testgit::". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24Correct references to /usr/bin/python which does not exist on FreeBSDLibravatar R. Tyler Ballance1-1/+5
On FreeBSD, Python does not ship as part of the base system but is available via the ports system, which install the binary in /usr/local/bin. Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-24Add Python support library for remote helpersLibravatar Sverre Rabbelier7-0/+942
This patch introduces parts of a Python package called "git_remote_helpers" containing the building blocks for remote helpers written in Python. No actual remote helpers are part of this patch, this patch only includes the common basics needed to start writing such helpers. The patch includes the necessary Makefile additions to build and install the git_remote_helpers Python package along with the rest of Git. This patch is based on Johan Herland's git_remote_cvs patch and has been improved by the following contributions: - David Aguilar: Lots of Python coding style fixes - David Aguilar: DESTDIR support in Makefile Cc: David Aguilar <davvid@gmail.com> Cc: Johan Herland <johan@herland.net> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>