[PATCH 1 of 2] identify: build the tag list directly instead of using wctx.tags()
Matt Mackall
mpm at selenic.com
Mon Jun 29 17:55:37 CDT 2015
On Sun, 2015-06-28 at 15:34 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1435512137 14400
> # Sun Jun 28 13:22:17 2015 -0400
> # Node ID 87c10f86c7517d0f8c42a080821c4b399d6f9755
> # Parent 6368c51cfad6dc5f9c46369ed5e17cf8bd09efae
> identify: build the tag list directly instead of using wctx.tags()
>
> The current implementation of workingctx.tags() returns the tags of the parents.
> This causes the calculation of {lastesttagdistance} from wdir() to be wrong.
> The value when updated to a tag is 0, but updated to the tag's child is 2, the
> child of that 3, and so on. This prepares for workingctx.tags() to not report
> the parent tags.
This raises the question of whether wdir() and . are really the same
commit when wdir() is clean, right? Mostly we're fine with ignoring that
distinction but here it worries me: if I checkout a pristine 1.0 and
archive wdir(), now it tells me it's not 1.0, right?
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4067,6 +4067,10 @@
> if not rev:
> ctx = repo[None]
> parents = ctx.parents()
> + taglist = []
> + for p in parents:
> + taglist.extend(p.tags())
> +
> changed = ""
> if default or id or num:
> if (any(repo.status())
> @@ -4084,6 +4088,7 @@
> output = [hexfunc(ctx.node())]
> if num:
> output.append(str(ctx.rev()))
> + taglist = ctx.tags()
>
> if default and not ui.quiet:
> b = ctx.branch()
> @@ -4091,7 +4096,7 @@
> output.append("(%s)" % b)
>
> # multiple tags for a single parent separated by '/'
> - t = '/'.join(ctx.tags())
> + t = '/'.join(taglist)
> if t:
> output.append(t)
>
> @@ -4104,7 +4109,7 @@
> output.append(ctx.branch())
>
> if tags:
> - output.extend(ctx.tags())
> + output.extend(taglist)
>
> if bookmarks:
> output.extend(ctx.bookmarks())
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list