##// END OF EJS Templates
Handle transcoding of tags
Matt Mackall -
r3772:73860ffb default
parent child Browse files
Show More
@@ -2210,7 +2210,9 b' def tags(ui, repo):'
2210 if ui.quiet:
2210 if ui.quiet:
2211 ui.write("%s\n" % t)
2211 ui.write("%s\n" % t)
2212 else:
2212 else:
2213 ui.write("%-30s %s\n" % (t, r))
2213 t = util.localsub(t, 30)
2214 t += " " * (30 - util.locallen(t))
2215 ui.write("%s %s\n" % (t, r))
2214
2216
2215 def tip(ui, repo, **opts):
2217 def tip(ui, repo, **opts):
2216 """show the tip revision
2218 """show the tip revision
@@ -198,6 +198,7 b' class localrepository(repo.repository):'
198 self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
198 self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
199
199
200 if local:
200 if local:
201 # local tags are stored in the current charset
201 self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
202 self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
202 self.hook('tag', node=hex(node), tag=name, local=local)
203 self.hook('tag', node=hex(node), tag=name, local=local)
203 return
204 return
@@ -207,7 +208,9 b' class localrepository(repo.repository):'
207 raise util.Abort(_('working copy of .hgtags is changed '
208 raise util.Abort(_('working copy of .hgtags is changed '
208 '(please commit .hgtags manually)'))
209 '(please commit .hgtags manually)'))
209
210
210 self.wfile('.hgtags', 'ab').write('%s %s\n' % (hex(node), name))
211 # committed tags are stored in UTF-8
212 line = '%s %s\n' % (hex(node), util.fromlocal(name))
213 self.wfile('.hgtags', 'ab').write(line)
211 if self.dirstate.state('.hgtags') == '?':
214 if self.dirstate.state('.hgtags') == '?':
212 self.add(['.hgtags'])
215 self.add(['.hgtags'])
213
216
@@ -227,7 +230,7 b' class localrepository(repo.repository):'
227 self.ui.warn(_("%s: cannot parse entry\n") % context)
230 self.ui.warn(_("%s: cannot parse entry\n") % context)
228 return
231 return
229 node, key = s
232 node, key = s
230 key = key.strip()
233 key = util.tolocal(key.strip()) # stored in UTF-8
231 try:
234 try:
232 bin_n = bin(node)
235 bin_n = bin(node)
233 except TypeError:
236 except TypeError:
@@ -256,6 +259,9 b' class localrepository(repo.repository):'
256 f = self.opener("localtags")
259 f = self.opener("localtags")
257 count = 0
260 count = 0
258 for l in f:
261 for l in f:
262 # localtags are stored in the local character set
263 # while the internal tag table is stored in UTF-8
264 l = util.fromlocal(l)
259 count += 1
265 count += 1
260 parsetag(l, _("localtags, line %d") % count)
266 parsetag(l, _("localtags, line %d") % count)
261 except IOError:
267 except IOError:
General Comments 0
You need to be logged in to leave comments. Login now