[PATCH 2 of 9 V3] localrepo: use _encodetags in _findtags method

Sean Farley sean.michael.farley at gmail.com
Fri Mar 28 17:06:00 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396036824 18000
#      Fri Mar 28 15:00:24 2014 -0500
# Node ID 50cf68685c17254b52aa0ebe4effeef3c65bd6a5
# Parent  9bab4721b0f6821f1f03d8a3eb9780dd14171000
localrepo: use _encodetags in _findtags method

This is just a refactoring and doesn't change any functionality.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -613,21 +613,12 @@ class localrepository(object):
         tagtypes = {}
 
         tagsmod.findglobaltags(self.ui, self, alltags, tagtypes)
         tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
 
-        # Build the return dicts.  Have to re-encode tag names because
-        # the tags module always uses UTF-8 (in order not to lose info
-        # writing to the cache), but the rest of Mercurial wants them in
-        # local encoding.
-        tags = {}
-        for (name, (node, hist)) in alltags.iteritems():
-            if node != nullid:
-                tags[encoding.tolocal(name)] = node
+        tags, tagtypes = self._encodetags(alltags, tagtypes)
         tags['tip'] = self.changelog.tip()
-        tagtypes = dict([(encoding.tolocal(name), value)
-                         for (name, value) in tagtypes.iteritems()])
         return (tags, tagtypes)
 
     def tagtype(self, tagname):
         '''
         return the type of the given tag. result can be:


More information about the Mercurial-devel mailing list