# HG changeset patch # User Pierre-Yves David # Date 2017-03-28 05:39:10 # Node ID d0e7c70f14b782d06ba8293e9dd7b2f29eaddead # Parent 9cd640e5c1ba69826326e90a62f1b03bde523ace tags: make argument 'tagtype' optional in '_updatetags' This is the next step from the previous changesets, we are now ready to use this function in a simpler way. diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -223,15 +223,22 @@ def _readtags(ui, repo, lines, fn, recod newtags[tag] = (taghist[-1], taghist[:-1]) return newtags -def _updatetags(filetags, alltags, tagtype, tagtypes): - '''Incorporate the tag info read from one file into the two - dictionaries, alltags and tagtypes, that contain all tag - info (global across all heads plus local).''' +def _updatetags(filetags, alltags, tagtype=None, tagtypes=None): + """Incorporate the tag info read from one file into dictionnaries + + The first one, 'alltags', is a "tagmaps" (see 'findglobaltags' for details). + + The second one, 'tagtypes', is optional and will be updated to track the + "tagtype" of entries in the tagmaps. When set, the 'tagtype' argument also + needs to be set.""" + if tagtype is None: + assert tagtypes is None for name, nodehist in filetags.iteritems(): if name not in alltags: alltags[name] = nodehist - tagtypes[name] = tagtype + if tagtype is not None: + tagtypes[name] = tagtype continue # we prefer alltags[name] if: @@ -243,7 +250,7 @@ def _updatetags(filetags, alltags, tagty if (bnode != anode and anode in bhist and (bnode not in ahist or len(bhist) > len(ahist))): anode = bnode - else: + elif tagtype is not None: tagtypes[name] = tagtype ahist.extend([n for n in bhist if n not in ahist]) alltags[name] = anode, ahist