[PATCH] tags: short-circuit if no tags have ever been committed
Bryan O'Sullivan
bos at serpentine.com
Tue Apr 17 18:08:18 CDT 2012
# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1334704092 25200
# Node ID 38fa6f50bfb4d9c826ef87c9296705b3d2c88c77
# Parent f45c08b41eb62aa1c5b69e6faa5ffff5928a9b6d
tags: short-circuit if no tags have ever been committed
diff -r f45c08b41eb6 -r 38fa6f50bfb4 mercurial/tags.py
--- a/mercurial/tags.py Tue Apr 17 16:08:11 2012 -0700
+++ b/mercurial/tags.py Tue Apr 17 16:08:12 2012 -0700
@@ -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