Fix `repo --trace` to show ref and config loads
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>
diff --git a/git_config.py b/git_config.py
index f65a035..78069c5 100644
--- a/git_config.py
+++ b/git_config.py
@@ -19,7 +19,8 @@
import sys
from urllib2 import urlopen, HTTPError
from error import GitError, UploadError
-from git_command import GitCommand, TRACE
+from trace import Trace
+from git_command import GitCommand
R_HEADS = 'refs/heads/'
R_TAGS = 'refs/tags/'
@@ -189,8 +190,7 @@
except OSError:
return None
try:
- if TRACE:
- print >>sys.stderr, ': unpickle %s' % self.file
+ Trace(': unpickle %s', self.file)
return cPickle.load(open(self._pickle, 'r'))
except IOError:
os.remove(self._pickle)