diff mercurial/tags.py @ 21030:9ea132aee96c

tags: log events related to tags cache We now log when .hg/cache/tags data is built from scratch by reading manifests and when the file is written.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 14 Apr 2014 11:50:05 -0700
parents 335a558f81dc
children 5125856a28cf 925d1bb9a971
line wrap: on
line diff
--- a/mercurial/tags.py	Mon Apr 14 15:14:02 2014 -0400
+++ b/mercurial/tags.py	Mon Apr 14 11:50:05 2014 -0700
@@ -15,6 +15,7 @@
 import encoding
 import error
 import errno
+import time
 
 def findglobaltags(ui, repo, alltags, tagtypes):
     '''Find global tags in repo by reading .hgtags from every head that
@@ -234,6 +235,8 @@
         # potentially expensive search.
         return (repoheads, cachefnode, None, True)
 
+    starttime = time.time()
+
     newheads = [head
                 for head in repoheads
                 if head not in set(cacheheads)]
@@ -251,6 +254,12 @@
             # no .hgtags file on this head
             pass
 
+    duration = time.time() - starttime
+    ui.log('tagscache',
+           'resolved %d tags cache entries from %d manifests in %0.4f '
+           'seconds\n',
+           len(cachefnode), len(newheads), duration)
+
     # Caller has to iterate over all heads, but can use the filenodes in
     # cachefnode to get to each .hgtags revision quickly.
     return (repoheads, cachefnode, None, True)
@@ -262,6 +271,9 @@
     except (OSError, IOError):
         return
 
+    ui.log('tagscache', 'writing tags cache file with %d heads and %d tags\n',
+            len(heads), len(cachetags))
+
     realheads = repo.heads()            # for sanity checks below
     for head in heads:
         # temporary sanity checks; these can probably be removed