mercurial/tags.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
    23 from .i18n import _
    23 from .i18n import _
    24 from . import (
    24 from . import (
    25     encoding,
    25     encoding,
    26     error,
    26     error,
    27     match as matchmod,
    27     match as matchmod,
    28     pycompat,
       
    29     scmutil,
    28     scmutil,
    30     util,
    29     util,
    31 )
    30 )
    32 from .utils import stringutil
    31 from .utils import stringutil
    33 
    32 
   352     "tagtype" of entries in the tagmaps. When set, the 'tagtype' argument also
   351     "tagtype" of entries in the tagmaps. When set, the 'tagtype' argument also
   353     needs to be set."""
   352     needs to be set."""
   354     if tagtype is None:
   353     if tagtype is None:
   355         assert tagtypes is None
   354         assert tagtypes is None
   356 
   355 
   357     for name, nodehist in pycompat.iteritems(filetags):
   356     for name, nodehist in filetags.items():
   358         if name not in alltags:
   357         if name not in alltags:
   359             alltags[name] = nodehist
   358             alltags[name] = nodehist
   360             if tagtype is not None:
   359             if tagtype is not None:
   361                 tagtypes[name] = tagtype
   360                 tagtypes[name] = tagtype
   362             continue
   361             continue
   505                     unknown_entries.add(node)
   504                     unknown_entries.add(node)
   506             cachefnode[node] = fnode
   505             cachefnode[node] = fnode
   507 
   506 
   508     if unknown_entries:
   507     if unknown_entries:
   509         fixed_nodemap = fnodescache.refresh_invalid_nodes(unknown_entries)
   508         fixed_nodemap = fnodescache.refresh_invalid_nodes(unknown_entries)
   510         for node, fnode in pycompat.iteritems(fixed_nodemap):
   509         for node, fnode in fixed_nodemap.items():
   511             if fnode != repo.nullid:
   510             if fnode != repo.nullid:
   512                 cachefnode[node] = fnode
   511                 cachefnode[node] = fnode
   513 
   512 
   514     fnodescache.write()
   513     fnodescache.write()
   515 
   514 
   547 
   546 
   548     # Tag names in the cache are in UTF-8 -- which is the whole reason
   547     # Tag names in the cache are in UTF-8 -- which is the whole reason
   549     # we keep them in UTF-8 throughout this module.  If we converted
   548     # we keep them in UTF-8 throughout this module.  If we converted
   550     # them local encoding on input, we would lose info writing them to
   549     # them local encoding on input, we would lose info writing them to
   551     # the cache.
   550     # the cache.
   552     for (name, (node, hist)) in sorted(pycompat.iteritems(cachetags)):
   551     for (name, (node, hist)) in sorted(cachetags.items()):
   553         for n in hist:
   552         for n in hist:
   554             cachefile.write(b"%s %s\n" % (hex(n), name))
   553             cachefile.write(b"%s %s\n" % (hex(n), name))
   555         cachefile.write(b"%s %s\n" % (hex(node), name))
   554         cachefile.write(b"%s %s\n" % (hex(node), name))
   556 
   555 
   557     try:
   556     try: