tags: short-circuit if no tags have ever been committed
authorBryan O'Sullivan <bryano@fb.com>
Sun, 13 May 2012 12:01:52 +0200
changeset 16730 dd4ce44ff53c
parent 16729 46c15dff3497
child 16731 dcfc70aab372
tags: short-circuit if no tags have ever been committed
mercurial/tags.py
--- a/mercurial/tags.py	Wed May 16 11:40:33 2012 -0500
+++ b/mercurial/tags.py	Sun May 13 12:01:52 2012 +0200
@@ -228,6 +228,11 @@
 
     # N.B. in case 4 (nodes destroyed), "new head" really means "newly
     # exposed".
+    if not len(repo.file('.hgtags')):
+        # No tags have ever been committed, so we can avoid a
+        # potentially expensive search.
+        return (repoheads, cachefnode, None, True)
+
     newheads = [head
                 for head in repoheads
                 if head not in set(cacheheads)]