[PATCH] tags: short-circuit if no tags have ever been committed
Bryan O'Sullivan
bos at serpentine.com
Sun May 13 05:02:10 CDT 2012
# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1336903312 -7200
# Node ID 652b1c4f090df25ada6b2b13f1ddc32974a605d4
# Parent ac7012ae864dd1c37475d0fb4263b6fd7e534924
tags: short-circuit if no tags have ever been committed
diff -r ac7012ae864d -r 652b1c4f090d mercurial/tags.py
--- a/mercurial/tags.py Sun May 13 12:01:49 2012 +0200
+++ 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)]
More information about the Mercurial-devel
mailing list