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_refs.py b/git_refs.py
index be8d271..2476091 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -15,7 +15,7 @@
 
 import os
 import sys
-from git_command import TRACE
+from trace import Trace
 
 HEAD    = 'HEAD'
 R_HEADS = 'refs/heads/'
@@ -65,8 +65,8 @@
       self._LoadAll()
 
   def _NeedUpdate(self):
-    if TRACE:
-      print >>sys.stderr, ': scan refs %s' % self._gitdir
+    Trace(': scan refs %s', self._gitdir)
+
     for name, mtime in self._mtime.iteritems():
       try:
         if mtime != os.path.getmtime(os.path.join(self._gitdir, name)):
@@ -76,8 +76,8 @@
     return False
 
   def _LoadAll(self):
-    if TRACE:
-      print >>sys.stderr, ': load refs %s' % self._gitdir
+    Trace(': load refs %s', self._gitdir)
+
     self._phyref = {}
     self._symref = {}
     self._mtime = {}