summaryrefslogtreecommitdiff
path: root/git/cmd.py
Commit message (Collapse)AuthorAgeFilesLines
* Moved setup function into top level __init__Odegard, Ken2017-07-091-34/+20
| | | | | | | | Discovered that the remote module also relies on the git executable as such it also needs to be “refreshed” anytime the git executable is updated or changed. This was best solved by moving the setup function into the top level __init__ where the setup simply calls git.cmd.Git.refresh and git.remote.FetchInfo.refresh.
* Preliminary implementation of setup/refresh functionsOdegard, Ken2017-07-091-8/+75
| | | | | | | | Added one function (setup) and an alias (refresh simply calls setup). These functions give the developer one more way to configure the git executable path. This also allows the user to interactively adjust the git executable configured during runtime as these functions dynamically update the executable path for the entire git module.
* Spelling fixesVille Skyttä2017-03-091-1/+1
|
* Merge pull request #582 from gitpython-developers/no_devnull_openSebastian Thiel2017-02-251-1/+1
|\ | | | | fix(cmd): checking process.DEVNUL were needlessly opening `os.devnull`
| * fix(cmd): checking process.DEVNUL were needlessly opening `os.devnull`no_devnull_openKostis Anagnostopoulos2017-02-101-1/+1
| | | | | | | | | | | | | | Fixes resource-leak warning on Windows Puython-3.5.3+: D:\python-3.5.2.amd64\lib\site-packages\git\cmd.py:583: ResourceWarning: unclosed file <_io.BufferedWriter name='nul'> else getattr(subprocess, 'DEVNULL', open(os.devnull, 'wb')))
* | Merge pull request #555 from ankostis/cntxtmmanSebastian Thiel2017-02-251-16/+19
|\ \ | | | | | | Retrofit `repo` class as context-man to cleanup global mman on repo-delete
| * | style(cmd): pythonize cmd-args filtering for PY26, improve docstringKostis Anagnostopoulos2016-12-081-16/+19
| |/ | | | | Apply codereview comments of #541.
* | fix(cmd): don't try to use TASKKILL on linuxSebastian Thiel2017-02-251-2/+3
|/ | | | Fixes #576
* Merge pull request #541 from andy-maier/py26_fixesSebastian Thiel2016-12-081-5/+9
|\ | | | | Fixes to support Python 2.6 again.
| * Fixes to support Python 2.6 again.Andreas Maier2016-10-241-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Details: - Added Python 2.6 again to .travis.yml (it was removed in commit 4486bcb). - Replaced the use of dictionary comprehensions in `git/cmd.py` around line 800 with the code before that change (in commit 25a2ebf). Reason: dict comprehensions were introduced only in Python 2.7. - Changed the import source for `SkipTest` and `skipIf` from `unittest.case` to first trying `unittest` and upon ImportError from `unittest2`. This was done in `git/util.py` and in several testcases. Reason: `SkipTest` and `skipIf` were introduced to unittest only in Python 2.7, and `unittest2` is a backport of `unittest` additions to Python 2.6. - In git/test/lib/helper.py, fixed the definition of `assertRaisesRegex` to work on py26. - For Python 2.6, added the `unittest2` dependency to `requirements.txt` and changed `.travis.yml` to install `unittest2`. Because git/util.py uses SkipTest from unittest/unittest2, the dependency could not be added to `test-requirements.txt`. - Fixed an assertion in `git/test/test_index.py` to also allow a Python 2.6 specific exception message. - In `is_cygwin_git()` in `git/util.py`, replaced `check_output()` with `Popen()`. It was added in Python 2.7. - Enabled Python 2.6 for Windows: - Added Python 2.6 for MINGW in .appveyor.yml. - When defining `PROC_CREATIONFLAGS` in `git/cmd.py`, made use of certain win32 and subprocess flags that were introduced in Python 2.7, dependent on whether we run on Python 2.7 or higher. - In `AutoInterrupt.__del__()` in `git/cmd.py`, allowed for `os` not having `kill()`. `os.kill()` was added for Windows in Python 2.7 (For Linux, it existed in Python 2.6 already).
* | chore(lint): flake8Sebastian Thiel2016-12-081-0/+1
|/ | | | | | | | Interestingly only shows in particular python versions on travis. Maybe some caching effect? Locally it is reproducible easily, with the latest flake8
* Merge branch 'cygwin' of https://github.com/ankostis/GitPython into ↵Sebastian Thiel2016-10-221-2/+21
|\ | | | | | | ankostis-cygwin
| * cygwin, #533: FIX daemon launchingKostis Anagnostopoulos2016-10-141-4/+7
| | | | | | | | | | | | | | | | + Rework git-daemon launching with `with` resource-management. + cmd: add `is_cygwin` optional override kwd on `Git.polish_url()`. - Cygwin TCs failing: - PY2: err: 13, fail: 3 - PY3: err: 12, fail: 3
| * cygwin, #533: Try to make it work with Cygwin's Git.Kostis Anagnostopoulos2016-10-141-1/+17
| | | | | | | | | | | | | | | | | | + Make `Git.polish_url()` convert paths into Cygwin-friendly paths. + Add utility and soe TCs for funcs for detecting cygwin and converting abs-paths to `/cygdrive/c/...`. - Cygwin TCs failing: - PY2: err: 14, fail: 3 - PY3: err: 13, fail: 3
* | Fix some typosSantiago Castro2016-10-201-3/+3
| |
* | Add a test for persistent git optionsBenjamin Poldrack2016-10-181-1/+1
| |
* | Allow for setting git options, that are persistent across subcommand callsBenjamin Poldrack2016-10-181-2/+20
|/
* cmd, #525: Always include stdout+stderr in exceptionsKostis Anagnostopoulos2016-10-141-4/+1
| | | | | + Ignore `with_extended_output` arg when reaising the exception, keep its behavior when `status==0`.
* remote, #525: FIX BUG push-cmd misses error messagesKostis Anagnostopoulos2016-10-141-1/+1
| | | | | | + Bug discovered after enabling TC in prev commit and rework of fetch. + remote_tc: unitestize assertions. + util: DEL unused `_mktemp()`.
* remote, #525: pump fetch-infos instead of GIL-read stderrKostis Anagnostopoulos2016-10-131-2/+6
| | | | | | + `handle_process_output()` accepts null-finalizer, to pump completely stderr before raising any errors. + test: Enable `TestGit.test_environment()` on Windows (to checks stderr consumption).
* test, #525: allow disabling freeze errors separatelyKostis Anagnostopoulos2016-10-131-2/+5
| | | | | + cmd: use DEVNULL for non PIPEs; no open-file. + TCs: some unitestize-assertions on base & remote TCs.
* daemon, #525: FIX remote urls in config-filesKostis Anagnostopoulos2016-10-121-1/+5
| | | | | | | | | | | | + Parse most remote & config-urls \-->/. + Used relative daemon-paths. + Use git-daemon PORT above 10k; on Windows all below need Admin rights. +FIXED git-daemon @with_rw_and_rw_remote_repo(): + test_base.test_with_rw_remote_and_rw_repo() PASS. + test_remote.test_base() now freezes! (so still hidden win_err) + repo_test: minor finally delete test-repos created inside this repo. + util: delete unused `absolute_project_path()`.
* repo, cmd: DROP UNEEDED Win path for chcwd & check for '~' homedirKostis Anagnostopoulos2016-10-121-12/+3
| | | | + Do not abspath twice when contructing cloned repo. + Add `git.repo.base` logger.
* pumps: FIX don't pump when proc has no streamsKostis Anagnostopoulos2016-10-121-4/+9
|
* FIX regression by #519 on reading stdout/stderr of cmdsKostis Anagnostopoulos2016-10-021-1/+2
|
* Win, #519: FIX repo TCs.Kostis Anagnostopoulos2016-10-011-4/+8
| | | | | | | | | | | | | | | + FIX TestRepo.test_submodule_update(): + submod: del `.git` file prior overwrite; Windows denied otherwise! + FIX TestRepo.test_untracked_files(): + In the `git add <file>` case, it failed with unicode args on PY2. Had to encode them with `locale.getpreferredencoding()` AND use SHELL. + cmd: add `shell` into `execute()` kwds, for overriding USE_SHELL per command. + repo: replace blocky `communicate()` in `_clone()` with thread-pumps. + test_repo.py: unittestize (almost all) assertions. + Replace open --> with open for index (base and TC). + test_index.py: Enabled a dormant assertion.
* ci: Capture logging for Popen() execute statements.Kostis Anagnostopoulos2016-09-301-0/+1
| | | + Collect all known commands
* ABANDON select/poll Kostis Anagnostopoulos2016-09-281-185/+48
|
* remote, #519: INCOMPLETE FIX-2 double-decoding push-infosKostis Anagnostopoulos2016-09-281-11/+19
| | | | + Unicode PY2/3 issues fixed also in pump stream func.
* Proc, #519: Rework error-exc msgs & log thread-pumps errorsKostis Anagnostopoulos2016-09-281-24/+40
| | | | | + No WindowsError exception. + Add `test_exc.py` for unicode issues. + Single-arg for decoding-streams in pump-func.
* io, dif: #519: FIX DIFF freeze when reading from GILKostis Anagnostopoulos2016-09-281-67/+74
| | | | | | | | | | | | | | | + 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.
* Win, #519: FIX with_rw_directory() to remove read-only dirsKostis Anagnostopoulos2016-09-281-0/+4
| | | | | + Stop using gitdb's respective helper. + Fix files chmod(555) which CANNOT DELETE on Windows (but do on Linux).
* src: constify is_<platform>() callsKostis Anagnostopoulos2016-09-281-5/+5
| | | + TCs: unittest-asserts for git-tests.
* Win, #519: Remove `git.cmd` failback - no longer exists.Kostis Anagnostopoulos2016-09-281-54/+15
| | | | | | | + 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
* test, #519: Try appveyor advice for never-ending buildsKostis Anagnostopoulos2016-09-281-1/+2
| | | | | | | | | | | + 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]
* src, #519: collect all is_<platform>() callsKostis Anagnostopoulos2016-09-271-7/+9
|
* Win, #519: FIX WinHangs: Popen() CREATE_NEW_PROCESS_GROUP to allow killKostis Anagnostopoulos2016-09-261-7/+14
| | | | | + FIXED most hangs BUT no more `git-daemon` un-killable! + Use logger for utils to replace stray print().
* test, #519: Popen() pump: remove WaitGroupKostis Anagnostopoulos2016-09-261-13/+6
|
* apveyor, #519: FIX incomplete Popen pumpKostis Anagnostopoulos2016-09-261-3/+13
| | | | | | | | + 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.
* test, deps: FIX `mock` deps on py3.Kostis Anagnostopoulos2016-09-251-9/+8
| | | | + Del extra spaces, import os.path as osp
* fix(repo): make it serializable with pickleSebastian Thiel2016-09-111-1/+20
| | | | | | | It's entirely untested if this repo still does the right thing, but I'd think it does. Fixes #504
* refactor(cmd): streamline usage of creationflagsSebastian Thiel2016-08-021-13/+4
|
* creationflags must be set to 0 on non-windows platformsBarry Scott2016-08-011-4/+5
|
* Must pass creationflags as a keyworkBarry Scott2016-08-011-1/+1
|
* Prevent CMD windows being shown when starting git in a subprocess.Barry Scott2016-07-291-1/+14
| | | | | 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.
* Fix issue #470Barry Warsaw2016-06-151-5/+6
|
* fix(flake): misc whitespace fixesSebastian Thiel2016-06-141-2/+1
|
* fix(misc): various cleanupSebastian Thiel2016-06-131-25/+6
| | | | | | | | | 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.
* Can get a str object from stream.read rather then bytes.Barry Scott2016-06-061-1/+4
| | | Convert to the expected bytes.
* log all the output from stdout and stderr for debugging process failuresBarry Scott2016-06-061-1/+14
|