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

Gregory Szorc gregory.szorc at gmail.com
Thu Apr 16 11:03:55 CDT 2015


On Thu, Apr 16, 2015 at 12:02 PM, Gregory Szorc <gregory.szorc at gmail.com>
wrote:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150416/b74f8302/attachment.html>


More information about the Mercurial-devel mailing list