aboutsummaryrefslogtreecommitdiff
path: root/git/cmd.py
AgeCommit message (Collapse)Author
2016-09-28Proc, #519: Rework error-exc msgs & log thread-pumps errorsKostis Anagnostopoulos
+ No WindowsError exception. + Add `test_exc.py` for unicode issues. + Single-arg for decoding-streams in pump-func.
2016-09-28io, dif: #519: FIX DIFF freeze when reading from GILKostis Anagnostopoulos
+ CAUSE: In Windows, Diffs freeze while reading Popen streams, probably buffers smaller; good-thin(TM) in this case because reading a Popen-proc from the launching-thread freezes GIL. The alternative to use `proc.communicate()` also relies on big buffers. + SOLUTION: Use `cmd.handle_process_output()` to consume Diff-proc streams. + Retroffited `handle_process_output()` code to support also byte-streams, both Threading(Windows) and Select/Poll (Posix) paths updated. - TODO: Unfortunately, `Diff._index_from_patch_format()` still slurps input; need to re-phrase header-regexes linewise to resolve it.
2016-09-28Win, #519: FIX with_rw_directory() to remove read-only dirsKostis Anagnostopoulos
+ Stop using gitdb's respective helper. + Fix files chmod(555) which CANNOT DELETE on Windows (but do on Linux).
2016-09-28src: constify is_<platform>() callsKostis Anagnostopoulos
+ TCs: unittest-asserts for git-tests.
2016-09-28Win, #519: Remove `git.cmd` failback - no longer exists.Kostis Anagnostopoulos
+ Simplify call_process, no win-code case, no `make_call()` nested func. + Del needless WinError try..catch, in `_call_process()` already converted as GitCommandNotFound by `execute()`. + pyism: kw-loop-->comprehension, facilitate debug-stepping
2016-09-28test, #519: Try appveyor advice for never-ending buildsKostis Anagnostopoulos
+ see http://help.appveyor.com/discussions/problems/5334-nosetests-finsih-bu-build-stuck-and-next-job-dealys-to-start + Use `io.DEFAULT_BUFFER_SIZE`. + test_commit: replace asserts with unittest-asserts. - TRY Popen() NO universal_newlines: NO, reverted in next commits. + [travisci skip]
2016-09-27src, #519: collect all is_<platform>() callsKostis Anagnostopoulos
2016-09-26Win, #519: FIX WinHangs: Popen() CREATE_NEW_PROCESS_GROUP to allow killKostis Anagnostopoulos
+ FIXED most hangs BUT no more `git-daemon` un-killable! + Use logger for utils to replace stray print().
2016-09-26test, #519: Popen() pump: remove WaitGroupKostis Anagnostopoulos
2016-09-26apveyor, #519: FIX incomplete Popen pumpKostis Anagnostopoulos
+ The code in `_read_lines_from_fno()` was reading the stream only once per invocation, so when input was larger than `mmap.PAGESIZE`, bytes were forgotten in the stream. + Replaced buffer-building code with iterate-on-file-descriptors. + Also set deamon-threads.
2016-09-25test, deps: FIX `mock` deps on py3.Kostis Anagnostopoulos
+ Del extra spaces, import os.path as osp
2016-09-11fix(repo): make it serializable with pickleSebastian Thiel
It's entirely untested if this repo still does the right thing, but I'd think it does. Fixes #504
2016-08-02refactor(cmd): streamline usage of creationflagsSebastian Thiel
2016-08-01creationflags must be set to 0 on non-windows platformsBarry Scott
2016-08-01Must pass creationflags as a keyworkBarry Scott
2016-07-29Prevent CMD windows being shown when starting git in a subprocess.Barry Scott
This fixes a UI problem with using GitPython from a GUI python probgram. Each repo that is opened creates a git cat-file processs and that provess will create a console window with out this change.
2016-06-15Fix issue #470Barry Warsaw
2016-06-14fix(flake): misc whitespace fixesSebastian Thiel
2016-06-13fix(misc): various cleanupSebastian Thiel
Just went through all changes and adjusted them to the best of my abilities. As there are no tests to claim otherwise, I believe this is correct enough. However, it becomes evident that it's no longer possible to just make changes without backing them with a respective test.
2016-06-06Can get a str object from stream.read rather then bytes.Barry Scott
Convert to the expected bytes.
2016-06-06log all the output from stdout and stderr for debugging process failuresBarry Scott
2016-06-06Merge remote-tracking branch 'upstream/master' into ↵Barry Scott
pr-cmd-raise-with-stderr-on-error
2016-06-01Make sure os is not even partly destroyedDavid Danier
2016-05-30Make sure that stderr is converted to bytesBarry Scott
remove stderr for a wait() that is not the GitPython wrapper.
2016-05-29Return all the stderr messge after an error is detected for pull()Barry Scott
2016-05-26Use proper syntax for conditional expressionAleksander Nitecki
(instead of abusing the "short-circuit" property of logical operations)
2016-05-26fix(remote): use universal_newlines for fetch/pushSebastian Thiel
That way, real-time parsing of output should finally be possible. Related to #444
2016-05-26import OrderedDict from git.odict rather than directly from collections, to ↵Kenneth Hoste
pix Py2.6 compatibility
2016-05-24fix(cmd): fix with_stdout implementationSebastian Thiel
Admittedly this fix is solely based on the documentation provided for this parameter, which indicated a different intend than was actually implemented. Also I don't believe doing this will cause any harm. As a special note: the call to `open(os.devnull, 'wb')` does not seem leak the handle, apparently it is given as-is to the subprocess, which will then close it naturally. This was tested using an interactive session via `htop` on osx. Fixes #437
2016-05-24fix(cmd): don't catch progress handler exceptionsSebastian Thiel
Fixes #435
2016-05-12Fix order of operators before executing the git commandGuyzmo
Since Python 3.3, the hash value of an object is seeded randomly, making it change between each call. As a consequence, the `dict` type relying on the hash value for the order of the items upon iterating on it, and the parameters passed to `git` being passed as `kwargs` to the `execute()` method, the order of parameters will change randomly between calls. For example, when you call `git.remote.pull()` in a code, two consecutives run will generate: 1. git pull --progress -v origin master 2. git pull -v --progress origin master Within the `transform_kwargs()` method, I'm promoting `kwargs` into an `collections.OrderedDict` being built with `kwargs` sorted on the keys. Then it will ensure that each subsequent calls will execute the parameters in the same order.
2016-04-19Support repeated kwargsVincent Driessen
Some Git command line options are allowed to be repeated multiple times. Examples of this are the -C flag which may occur more than once to "strengthen" its effect, or the -L flag on Git blames, to select multiple blocks of lines to blame. $ git diff -C -C HEAD~1 HEAD $ git blame -L 1-3 -L 12-18 HEAD -- somefile.py This patch supports passing a list/tuple as the value part for kwargs, so that the generated Git command contain the repeated options.
2016-04-06Make sure .read() and friends always return bytesVincent Driessen
2016-02-24fix(cmd): Use buffered readsColin Snover
Popen defaults to using unbuffered reads, which are extremely slow.
2016-02-14fix(cmd): allow improved errors during clone operationSebastian Thiel
Related to #383
2016-02-13fix(cmd): focus !Sebastian Thiel
Thanks travis, once again !
2016-02-13fix(cmd): safely read from stderrSebastian Thiel
Fixes #383
2016-02-07fix(cmd): prevent deadlock on clone/fetch/pullSebastian Thiel
We keep stdout closed, which seems to have the side-effect of stdout being connected to your TTY, in case you run a terminal. However, this shold also prevent deadlocks, as only stderr is used. The alternative would have been to try to fetch lines concurrently, and we have been there. For clone(), `communicate()` is used, and with some luck this will just do the right thing. Even though last time I checked, it didn't ... ? Lets see. Stab at #72
2015-12-21Fixed a non-Windows importAshley Whetter
signal.SIGKILL is not available on Windows so use signal.SIGTERM as a backup when SIGKILL is not available.
2015-10-16Merge pull request #354 from dpursehouse/execute-timeoutSebastian Thiel
Include 'timeout' parameter in Git execute
2015-10-15fix(cmd): remove unused importSebastian Thiel
2015-10-15doc(cmd): make sure people know wait() may blockSebastian Thiel
Related to #357
2015-10-15Revert "fix(cmd): fixed deadlock when stderr buffer overflow"revert-357-autointerrupt_deadlock_fixSebastian Thiel
2015-10-15fix(cmd): fixed deadlock when stderr buffer overflowIvan Ryabchenko
Fixed deadlock when using stderr=PIPE in Popen and Git generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data (see https://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait)
2015-10-13Run os.kill for all child pids even after some of them are downOswin Nathanial
Right now, we come out of the iteration in case of failure while trying to kill a child pid. This may result in some of the child pids staying alive. Change-Id: I18d58fcefec2bbdae4ae9bf73594939ade241b52
2015-10-13Update docstring for 'kill_after_timeout' parameterOswin Nathanial
Specify that this feature is not supported on Windows and mention about the negative side-effects of SIGKILL on a repository. Change-Id: Ibba2c3f51f84084b4637ae9aaafa87dd84000ef4
2015-10-13Rename execute param 'timeout' to 'kill_after_timeout'Oswin Nathanial
Change-Id: I8ab3d5affb3f040dd9630687fb20aedbd7510070
2015-10-09Only create watchdog and event if timeout is specified in execute commandOswin Nathanial
If the timeout is not specified, we don't need the overhead of creating a watchdog and event. Change-Id: I53ff891af24d4c27fb16bf4bb35910dd1d19d238
2015-10-09Raise exception when timeout is used in execute command on WindowsOswin Nathanial
Change-Id: I2e081c606b75b7f8d3d1ee82d93c3d9f3bdcfcbe
2015-09-28Include 'timeout' parameter in Git executeOswin Nathanial
This feature enables to set a timeout while executing a git command. After this timeout is over, the process will be killed. If not explicitly specified, the default functionality will not be affected. Change-Id: I2dd5f0de7cb1f5f1b4253dd7ce92d23551d5f9a7