comparison mercurial/commands.py @ 25684:0f894d2203c8

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 28 Jun 2015 13:22:17 -0400
parents 3b1fc40626d8
children 5ede49f4383a
comparison
equal deleted inserted replaced
25683:3b1fc40626d8 25684:0f894d2203c8
4067 ctx = scmutil.revsingle(repo, rev, None) 4067 ctx = scmutil.revsingle(repo, rev, None)
4068 4068
4069 if ctx.rev() is None: 4069 if ctx.rev() is None:
4070 ctx = repo[None] 4070 ctx = repo[None]
4071 parents = ctx.parents() 4071 parents = ctx.parents()
4072 taglist = []
4073 for p in parents:
4074 taglist.extend(p.tags())
4075
4072 changed = "" 4076 changed = ""
4073 if default or id or num: 4077 if default or id or num:
4074 if (any(repo.status()) 4078 if (any(repo.status())
4075 or any(ctx.sub(s).dirty() for s in ctx.substate)): 4079 or any(ctx.sub(s).dirty() for s in ctx.substate)):
4076 changed = '+' 4080 changed = '+'
4083 else: 4087 else:
4084 if default or id: 4088 if default or id:
4085 output = [hexfunc(ctx.node())] 4089 output = [hexfunc(ctx.node())]
4086 if num: 4090 if num:
4087 output.append(str(ctx.rev())) 4091 output.append(str(ctx.rev()))
4092 taglist = ctx.tags()
4088 4093
4089 if default and not ui.quiet: 4094 if default and not ui.quiet:
4090 b = ctx.branch() 4095 b = ctx.branch()
4091 if b != 'default': 4096 if b != 'default':
4092 output.append("(%s)" % b) 4097 output.append("(%s)" % b)
4093 4098
4094 # multiple tags for a single parent separated by '/' 4099 # multiple tags for a single parent separated by '/'
4095 t = '/'.join(ctx.tags()) 4100 t = '/'.join(taglist)
4096 if t: 4101 if t:
4097 output.append(t) 4102 output.append(t)
4098 4103
4099 # multiple bookmarks for a single parent separated by '/' 4104 # multiple bookmarks for a single parent separated by '/'
4100 bm = '/'.join(ctx.bookmarks()) 4105 bm = '/'.join(ctx.bookmarks())
4103 else: 4108 else:
4104 if branch: 4109 if branch:
4105 output.append(ctx.branch()) 4110 output.append(ctx.branch())
4106 4111
4107 if tags: 4112 if tags:
4108 output.extend(ctx.tags()) 4113 output.extend(taglist)
4109 4114
4110 if bookmarks: 4115 if bookmarks:
4111 output.extend(ctx.bookmarks()) 4116 output.extend(ctx.bookmarks())
4112 4117
4113 ui.write("%s\n" % ' '.join(output)) 4118 ui.write("%s\n" % ' '.join(output))