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_refs.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_refs.py')
-rw-r--r-- | git_refs.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/git_refs.py b/git_refs.py index b91abc28..be8d271b 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -14,6 +14,8 @@ | |||
14 | # limitations under the License. | 14 | # limitations under the License. |
15 | 15 | ||
16 | import os | 16 | import os |
17 | import sys | ||
18 | from git_command import TRACE | ||
17 | 19 | ||
18 | HEAD = 'HEAD' | 20 | HEAD = 'HEAD' |
19 | R_HEADS = 'refs/heads/' | 21 | R_HEADS = 'refs/heads/' |
@@ -63,6 +65,8 @@ class GitRefs(object): | |||
63 | self._LoadAll() | 65 | self._LoadAll() |
64 | 66 | ||
65 | def _NeedUpdate(self): | 67 | def _NeedUpdate(self): |
68 | if TRACE: | ||
69 | print >>sys.stderr, ': scan refs %s' % self._gitdir | ||
66 | for name, mtime in self._mtime.iteritems(): | 70 | for name, mtime in self._mtime.iteritems(): |
67 | try: | 71 | try: |
68 | if mtime != os.path.getmtime(os.path.join(self._gitdir, name)): | 72 | if mtime != os.path.getmtime(os.path.join(self._gitdir, name)): |
@@ -72,6 +76,8 @@ class GitRefs(object): | |||
72 | return False | 76 | return False |
73 | 77 | ||
74 | def _LoadAll(self): | 78 | def _LoadAll(self): |
79 | if TRACE: | ||
80 | print >>sys.stderr, ': load refs %s' % self._gitdir | ||
75 | self._phyref = {} | 81 | self._phyref = {} |
76 | self._symref = {} | 82 | self._symref = {} |
77 | self._mtime = {} | 83 | self._mtime = {} |