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

login
register
mail settings
Submitter Pierre-Yves David
Date April 16, 2015, 7:21 p.m.
Message ID <95ff070e3d341b67c4d4.1429212114@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8723/
State Accepted
Headers show

Comments

Pierre-Yves David - April 16, 2015, 7:21 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

Patch

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