diff options
| author | Shawn O. Pearce <sop@google.com> | 2009-04-17 20:44:26 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-04-17 21:03:45 -0700 |
| commit | b81ac9e65444d0f54d2b6dd24d20b74945c9a36a (patch) | |
| tree | 717c5afa16ee88c9b409ce298c95d6f150118775 /git_config.py | |
| parent | 0f3dd233ecaf8d145ddb33a5ef1b8d3d71ade476 (diff) | |
| download | git-repo-b81ac9e65444d0f54d2b6dd24d20b74945c9a36a.tar.gz | |
Enable tracing of ref scans and config unpickling
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>
Diffstat (limited to 'git_config.py')
| -rw-r--r-- | git_config.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/git_config.py b/git_config.py index c87d5bed..f65a0353 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -19,7 +19,7 @@ import re | |||
| 19 | import sys | 19 | import sys |
| 20 | from urllib2 import urlopen, HTTPError | 20 | from urllib2 import urlopen, HTTPError |
| 21 | from error import GitError, UploadError | 21 | from error import GitError, UploadError |
| 22 | from git_command import GitCommand | 22 | from git_command import GitCommand, TRACE |
| 23 | 23 | ||
| 24 | R_HEADS = 'refs/heads/' | 24 | R_HEADS = 'refs/heads/' |
| 25 | R_TAGS = 'refs/tags/' | 25 | R_TAGS = 'refs/tags/' |
| @@ -189,6 +189,8 @@ class GitConfig(object): | |||
| 189 | except OSError: | 189 | except OSError: |
| 190 | return None | 190 | return None |
| 191 | try: | 191 | try: |
| 192 | if TRACE: | ||
| 193 | print >>sys.stderr, ': unpickle %s' % self.file | ||
| 192 | return cPickle.load(open(self._pickle, 'r')) | 194 | return cPickle.load(open(self._pickle, 'r')) |
| 193 | except IOError: | 195 | except IOError: |
| 194 | os.remove(self._pickle) | 196 | os.remove(self._pickle) |
