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>
This commit is contained in:
Shawn O. Pearce
2009-04-18 09:54:51 -07:00
parent b81ac9e654
commit ad3193a0e5
5 changed files with 47 additions and 17 deletions

View File

@ -19,7 +19,8 @@ import re
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 @@ class GitConfig(object):
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)