summaryrefslogtreecommitdiffstats
path: root/git_refs.py
Commit message (Collapse)AuthorAgeFilesLines
* Make usage of open safer by setting binary mode and closing fdsShawn O. Pearce2009-04-181-2/+2
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix `repo --trace` to show ref and config loadsShawn O. Pearce2009-04-181-5/+5
| | | | | | | | | 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-0/+6
| | | | | | | | 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>
* Avoid unnecessary git symbolic-ref calls during repo syncShawn O. Pearce2009-04-171-2/+12
| | | | | | | | If the m/BRANCH ref is already pointing at the value set in the manifest there is no reason to set it again. Leave it alone, thus saving a full fork+exec call. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Improve repo sync performance by avoid git forksShawn O. Pearce2009-04-171-0/+11
| | | | | | | | | | | By resolving the current HEAD and the manifest revision using pure Python, we can in the common case of "no changes" avoid a lot of git operations and directly jump out of the local sync method. This reduces the no-op `repo sync -l` time for Android's 114 projects from more than 6s to under 0.8s. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Implement git ref reading purely in PythonShawn O. Pearce2009-04-171-0/+133
Its much faster to read the refs from 114 projects when the reader is pure Python and just doing file IO than forking 114 git commands and parsing their output. The reader caches refs based upon file mtimes. If any single ref file has been modified since the last read, we re-read the entire repository's ref namespace. This simplifies the code as we don't need to worry about shooting down symbolic-refs, but it may cause more IO than is necessary if only one ref gets updated. This change drops `repo branches` in Android from 1.658s to 0.206s. Likewise, `repo sync` improves dramatically as well. Signed-off-by: Shawn O. Pearce <sop@google.com>