summaryrefslogtreecommitdiffstats
path: root/git_command.py
Commit message (Collapse)AuthorAgeFilesLines
* Add rpc: to default protocol whitelistv1.12.33Jonathan Nieder2016-02-261-1/+1
| | | | Change-Id: I57e1c3d93c0ce56da9c487df65eb3d258e0260e8
* Set GIT_ALLOW_PROTOCOL to limit dangerous protocolsDan Willemsen2015-11-261-0/+3
| | | | | | | | | See git commit 33cfccbbf35a -- some protocols allow arbitrary command execution as part of the URL. Instead of blindly allowing those, whitelist the allowed URL protocols unless the user has already done so. Bug: Issue 210 Change-Id: I6bd8e721aa5e3dab53ef28cfdc8fde33eb74ef76
* git_command: only decode when neededAnthony King2015-06-031-1/+4
| | | | | | strings no longer need decoding, since unicode is str Change-Id: I9516d298fee7ddc058452394b7759327fe3aa7a8
* decode the buffer before appendingAnthony King2015-06-031-0/+2
| | | | | | | | | | output from a process is in bytes in python3. we need to decode it. in Python3, bytes don't have an encode attribute. use this to identify it. Change-Id: I152f2ec34614131027db680ead98b53f9b321ed5
* Always capture output for GitCommandJohn L. Villalovos2015-03-261-12/+52
| | | | | | | | | | | | | | Switch the GitCommand program to always capture the output for stdout and stderr. And by default print the output while running. The options capture_stdout and capture_stderr have effectively become options to supress the printing of stdout and stderr. Update the 'git fetch' to use '--progress' so that the progress messages will be displayed. git checks if the output location isatty() and if it is not a TTY it will by default not print the progress messages. Change-Id: Ifdae138e008f80a59195f9f43c911a1a5210ec60
* Decode git versionChirayu Desai2014-08-201-2/+2
| | | | | | | | | Used by 'repo --version' With Python 3, * Before: b'git version 2.1.0' * After: git version 2.1.0 Change-Id: I4321bb0f09e92cda1123c35910338b940e82a305
* Share git version parsing code with wrapper modulev1.12.12Conley Owens2014-01-301-11/+3
| | | | | | | 'repo' and 'git_command.py' had their own git version parsing code. This change shares that code between the modules. DRY is good. Change-Id: Ic896d2dc08353644bd4ced57e15a91284d97d54a
* Respect version hyphenationv1.12.11Conley Owens2014-01-301-1/+1
| | | | | | | | The last change regarding version parsing lost handling of version hyphenation, this restores that. In otherwords, 1.1.1-otherstuff is parsed as (1,1,1) instead of (1,1,0) Change-Id: I3753944e92095606653835ed2bd090b9301c7194
* Handle release candidates in git version parsingConley Owens2014-01-301-4/+8
| | | | | | | Right now repo chokes on git versions like "1.9.rc1". This change treats 'rc*' as a '0'. Change-Id: I612b7b431675ba7415bf70640a673e48dbb00a90
* Fix some python3 encoding issuesChirayu Desai2013-11-211-1/+1
| | | | | | * Add .decode('utf-8') where needed * Add 'b' to `open` where needed, and remove where unnecessary Change-Id: I0f03ecf9ed1a78e3b2f15f9469deb9aaab698657
* Change print statements to work in python3Sarah Owens2012-11-131-2/+3
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Fix pylint warning W0108: Lambda may not be necessaryDavid Pursehouse2012-11-071-2/+2
| | | | | | Remove unnecessary usage of lambda. Change-Id: I06d41933057d60d15d307ee800cca052a44754c6
* Even more coding style cleanupDavid Pursehouse2012-10-301-3/+3
| | | | | | | | | | | Fixing some more pylint warnings: W1401: Anomalous backslash in string W0623: Redefining name 'name' from outer scope W0702: No exception type(s) specified E0102: name: function already defined line n Change-Id: I5afcdb4771ce210390a79981937806e30900a93c
* Use modern Python exception syntaxSarah Owens2012-10-231-1/+1
| | | | | | | | | | | "except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
* Rename "dir" variablesMickaël Salaün2012-10-101-4/+4
| | | | | | | The variable name "dir" conflicts with the name of a Python built-in function: http://docs.python.org/library/functions.html#dir Change-Id: I850f3ec8df7563dc85e21f2876fe5e6550ca2d8f
* Fix bug in version_tuple to handle strings with -rc#Chad Jones2012-07-311-1/+1
| | | | | | | Example of version string that caused a problem: git version 1.7.11-rc3 Change-Id: I8a68b6b37f7b2ded23a1f8ae0d12131050a8807b CC: sop@google.com
* Single quote http.proxy in GIT_CONFIG_PARAMETERSv1.9.4Shawn O. Pearce2012-06-131-1/+1
| | | | | | | | Git requires the values in this environment variable to be single quoted. repo must wrap the expression into '' before adding it to the environment. Change-Id: I20a1fb8772f9aa6e9fd5a0516c981c2ca020ef05
* Use GIT_CONFIG_PARAMETERS instead of -c for http.proxyv1.9.3Shawn O. Pearce2012-06-051-2/+6
| | | | | | | | | Ancient versions of Git don't understand the -c command line flag that we tried to use to pass http_proxy down into Git on Darwin. Use the environment variable instead, to more gracefully degrade with these old versions. Change-Id: Iffffa32088c1fd803895b990b3377ecfec6a1b14
* Pass http_proxy as -c http.proxy on Mac OS XShawn O. Pearce2012-05-251-0/+2
| | | | | | | | The system libcurl library seems to ignore http_proxy on Mac OS X systems. Copy the http_proxy environment variable (if set) as `git -c http.proxy` whenever running a Git command. Change-Id: I0ab29336897178f70b85092601f9fcc306dd17e1
* Stabilize repo communication with subprocesses.Ulrik Sjölin2011-11-291-19/+3
| | | | | | | | | Make repo use the standard way in python to work with pipes. Communication via pipes to sub processes is done by calling communicate(). This will make repo not hang every now and then. Change-Id: Ibe2c4ecbdbcbe72f0b725ca50d54088e5646fc5d
* Enhance HTTP supportShawn O. Pearce2011-09-191-16/+19
| | | | | | | | | | | | | | Setting REPO_CURL_VERBOSE=1 in the environment will register a debug level HTTPHandler on the urllib2 library, showing HTTP requests and responses on the stderr channel of repo. During any HTTP or HTTPS request created inside of the repo process, a custom User-Agent header is now defined: User-Agent: git-repo/1.7.5 (Linux) git/1.7.7 Python/2.6.5 Change-Id: Ia5026fb1e1500659bd2af27416d85e205048bf26 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Use os.environ.copy() instead of dict()Shawn O. Pearce2011-01-091-1/+1
| | | | | Signed-off-by: Shawn O. Pearce <sop@google.com> (cherry picked from commit 3218c13205694434edb2375ab8a8515554eed366)
* Encode the environment variables passed to gitShawn O. Pearce2011-01-091-4/+7
| | | | | | | | Windows allows the environment to have unicode values. This will cause Python to fail to execute the command. Change-Id: I37d922c3d7ced0d5b4883f0220346ac42defc5e9 Signed-off-by: Shawn O. Pearce <sop@google.com>
* sync: kill git fetch process before SSH control master processv1.6.9.6Shawn O. Pearce2010-05-111-1/+28
| | | | | | | | | | | | | | | | If the SSH control master process is killed while an active git fetch is using its network socket, the underlying SSH client may not realize the connection was broken. This can lead to both the client and the server waiting indefinitely for network messages which will never be sent. Work around the problem by keeping track of any processes that use the tunnels we establish. If we are about to kill any of the SSH control masters that we started, ensure the clients using them are successfully killed first. Change-Id: Ida6c124dcb0c6a26bf7dd69cba2fbdc2ecd5b2fc Signed-off-by: Shawn O. Pearce <sop@google.com>
* Rename _ssh_sock() to fix code style issue.Nico Sallembien2010-04-271-2/+2
| | | | | Since _ssh_sock is imported out of the git_command module, the leading underscore should be removed from the function name.
* Refactor git version detection for reuseShawn O. Pearce2009-06-121-0/+24
| | | | | | | | This way we can use it to detect feature support in the underlying git, such as new options or commands that have been added in more recent versions. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Work around 'ControlPath too long' on Mac OS XShawn O. Pearce2009-04-211-1/+4
| | | | | | | | | | | | Mac OS X sets TMPDIR to a very long path within /var, so long that a socket created in that location is too big for a struct sockaddr_un on the platform, resulting in OpenSSH being unable to create or bind to a socket in that location. Instead we try to use the very short and very common /tmp, but fall back to the guessed default if /tmp does not exist. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Automatically use SSH control master support during syncShawn O. Pearce2009-04-181-0/+26
| | | | | | | | | By creating a background ssh "control master" process which lives for the duration of our sync cycle we can easily cut the time for a no-op sync of 132 projects from 60s to 18s. Bug: REPO-11 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix `repo --trace` to show ref and config loadsShawn O. Pearce2009-04-181-7/+3
| | | | | | | | | The value of the varible TRACE was copied during the import, which happens before the --trace option can be processed. So instead we now use a function to determine if the value is set, as the function can be safely copied early during import. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+164