summaryrefslogtreecommitdiffstats
path: root/git_config.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't crash if the ssh client is already deadShawn O. Pearce2009-06-161-2/+5
| | | | | | | | | If the SSH client terminated abnormally in the background (e.g. the server shutdown while we were doing a sync) then the pid won't exist. Instead of crashing, ignore it, the result we wanted (a non-orphaned ssh process) is already acheived. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Ignore EOFError when reading a truncated pickle filev1.6.8.2Shawn O. Pearce2009-06-121-0/+3
| | | | | | | | | If the pickle config file is 0 bytes in length, we may have crashed (or been aborted) while writing the file out to disk. Instead of crashing with a backtrace, just treat the file as though it wasn't present and load off a `git config` fork. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add missing return False to preconnectShawn O. Pearce2009-06-121-0/+1
| | | | | | | | Noticed by users on repo-discuss, we were missing a return False here to signal that SSH control master was not used to setup the network connection. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow callers of GitConfig to specify the pickle file pathShawn O. Pearce2009-05-291-4/+8
| | | | | | | | This way we can put it in another directory than the config file itself, e.g. hide it inside ".git" when parsing a ".gitmodules" file from the working tree. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Teach GitConfig how to yield subsection namesShawn O. Pearce2009-05-191-0/+5
| | | | | | | This can be useful when pulling apart a configuration file, like finding all entries which match submodule.*.*. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix ssh://user@hostname/ style URLs parsingv1.6.7.3Shawn O. Pearce2009-04-301-1/+1
| | | | | | | | I only tested this with ssh://hostname/ style URLs, so I failed to test ssh://user@hostname/ format, which failed if the hostname portion was longer than 1 character. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Disable SSH ControlMaster option on CygwinShawn O. Pearce2009-04-231-1/+1
| | | | | Bug: REPO-29 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix UnboundLocalError: local variable 'port' when using SSHv1.6.7.2Shawn O. Pearce2009-04-211-5/+4
| | | | | | | | | If the SSH URL doesn't contain a port number, but uses the ssh:// or git+ssh:// syntax we raised a Python runtime error due to the 'port' local variable not being assigned a value. Default it to the IANA assigned port for SSH, 22. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Automatically use SSH control master support during syncShawn O. Pearce2009-04-181-1/+80
| | | | | | | | | 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>
* Make usage of open safer by setting binary mode and closing fdsShawn O. Pearce2009-04-181-4/+10
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Speed up 'repo start' by removing some forksShawn O. Pearce2009-04-181-4/+44
| | | | | | | | | | Its quite common for most projects to be matching the current manifest revision, as most developers only modify one or two projects at any one time. We can speed up `repo start foo` (that impacts the entire client) by performing most of the branch creation and switch operations in pure Python, and thus avoid 4 forks per project. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix `repo --trace` to show ref and config loadsShawn O. Pearce2009-04-181-3/+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>
* Enable tracing of ref scans and config unpicklingShawn O. Pearce2009-04-171-1/+3
| | | | | | | | These are not as expensive as spawning a git command, but they are not free either. We want to keep track of how many times we wind up calling them on any particular operation. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Pickle parsed git config filesShawn O. Pearce2009-04-171-0/+38
| | | | | | | | | | | | | | | | We now cache the output of `git config --list` for each of our GitConfig instances in a Python pickle file. These can be read back in using only the Python interpreter at a much faster rate than we can fork+exec the git config process. If the corresponding git config file has a newer modification timestamp than the pickle file, we delete the pickle file and regenerate it. This ensures that any edits made by the user will be taken into account the next time we consult the file. This reduces the time for a no-op repo sync from 0.847s to 0.269s. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Supporrt mixed case subsection names in Git config filesShawn O. Pearce2009-04-171-11/+15
| | | | | | | | | | | | | | In the case of: [url "Foo"] insteadOf = Bar We should return "Bar" for the key "url.Foo.insteadof", but not for the key "url.foo.insteadof". This requires splitting the key into its components and only lower casing the section and value name, leaving the subsection portion alone. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Only lookup review server '/ssh_info' once per repo processShawn O. Pearce2009-03-251-19/+33
| | | | | | | | If the user has multiple projects to upload changes to, and they are all going to the same review server, we only need to query the '/ssh_info' data once. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Produce a useful error if /ssh_info was HTML and not plain textShawn O. Pearce2009-03-251-0/+5
| | | | | | | | | | | | | | If /ssh_info is protected by an HTML based login page, we may get back a "200 OK" response from the server with some HTML document asking us to authenticate. This can't be parsed into a host name and port number, so we shouldn't even try. Valid host names and decimal port numbers cannot contain '<', but an unexpected HTML login page would. So we test for '<' to give us a fair indicator that the content isn't what we think it is, and bail out. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Handle review URLs pointing directly at GerritShawn O. Pearce2009-03-251-3/+6
| | | | | | | | | | | | If a review URL is set to 'http://host/Gerrit' because the user thinks that is the correct way to point repo at Gerrit, we should be a bit more flexible and fix the URL by dropping the '/Gerrit' suffix and replace it with '/ssh_info'. Likewise, if a review URL points already at '/ssh_info' for a Gerrit instance, we should leave it alone. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Support Gerrit2's ssh:// based uploadv1.5Shawn O. Pearce2009-01-051-1/+41
| | | | | | | | | | | In Gerrit2 uploads are sent over "git push ssh://...", as this is a more efficient transport and is easier to code from external scripts and/or direct command line usage by an end-user. Gerrit1's HTTP POST based format is assumed if the review server does not have the /ssh_info URL available on it. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Use remote.*.projectname to indicate the target project for uploadShawn O. Pearce2008-11-061-0/+2
| | | | | | | | This way "forks" of a project, e.g. the linux kernel, can be setup to use different destination projects in the review server by creating different remotes in the client side Git repository. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo init --mirror' to download a complete forrestv1.1Shawn O. Pearce2008-11-051-4/+6
| | | | | | | | | | | | | | | The mirror option downloads a complete forrest (as described by the manifest) and creates a replica of the remote repositories rather than a client working directory. This permits other clients to sync off the mirror site. A mirror can be positioned in a "DMZ", where the mirror executes "repo sync" to obtain changes from the external upstream and clients inside the protected zone operate off the mirror only, and therefore do not require direct git:// access to the external upstream repositories. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Cache the per-user configuration to avoid duplicate instancesShawn O. Pearce2008-10-291-1/+5
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+344