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

login
register
mail settings
Submitter Gregory Szorc
Date April 16, 2015, 4:02 p.m.
Message ID <ae6e9a2d4e3bed28324b.1429200126@gps-mbp.local>
Download mbox | patch
Permalink /patch/8716/
State Superseded
Commit 61a6d83280d35972ec4e2acf669b9b5032a42378
Headers show

Comments

Gregory Szorc - April 16, 2015, 4:02 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 ae6e9a2d4e3bed28324ba8987dda3b91fdaf949c
# Parent  9a344e86745a94407a9c0ea8f67b73a85de99f43
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.
Gregory Szorc - April 16, 2015, 4:03 p.m.
On Thu, Apr 16, 2015 at 12:02 PM, Gregory Szorc <gregory.szorc@gmail.com>
wrote:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1429198366 14400
> #      Thu Apr 16 11:32:46 2015 -0400
> # Node ID ae6e9a2d4e3bed28324ba8987dda3b91fdaf949c
> # Parent  9a344e86745a94407a9c0ea8f67b73a85de99f43
> 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
> @@ -9,9 +9,9 @@
>  # Currently this module only deals with reading and caching tags.
>  # Eventually, it could take care of updating (adding/removing/moving)
>  # tags too.
>
> -from node import nullid, bin, hex, short
> +from node import nullid, nullrev, bin, hex, short
>
>

This was accidental. Can it be fixed in flight?


> @@ -325,9 +325,9 @@ def _readtagcache(ui, repo):
>      # 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.
>

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -9,9 +9,9 @@ 
 # Currently this module only deals with reading and caching tags.
 # Eventually, it could take care of updating (adding/removing/moving)
 # tags too.
 
-from node import nullid, bin, hex, short
+from node import nullid, nullrev, bin, hex, short
 from i18n import _
 import util
 import encoding
 import error
@@ -325,9 +325,9 @@  def _readtagcache(ui, repo):
     # 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.