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

login
register
mail settings
Submitter Sean Farley
Date March 28, 2014, 10:06 p.m.
Message ID <50cf68685c17254b52aa.1396044360@laptop.local>
Download mbox | patch
Permalink /patch/4110/
State Superseded
Headers show

Comments

Sean Farley - March 28, 2014, 10:06 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.

Patch

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: