[PATCH 3 of 5 V2 in-clowncopter] tags: return empty list of heads for no .hgtags case

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Apr 16 14:21:54 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1429198366 14400
#      Thu Apr 16 11:32:46 2015 -0400
# Node ID 95ff070e3d341b67c4d4bce84782db94ea038a9b
# Parent  1f1f261b6ab11239c822befc54d6b0a4047d4b77
tags: return empty list of heads for no .hgtags case

The caller only uses the heads to resolve tags from content of .hgtags.
Returning a non-empty array is pointless if there is no .hgtags file.

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -324,11 +324,11 @@ def _readtagcache(ui, repo):
     # 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, {}, valid, None, True)
+        return ([], {}, valid, None, True)
 
     starttime = time.time()
 
     # Now we have to lookup the .hgtags filenode for every new head.
     # This is the most expensive part of finding tags, so performance


More information about the Mercurial-devel mailing list