196 raise util.Abort(_('%r cannot be used in a tag name') % c) |
196 raise util.Abort(_('%r cannot be used in a tag name') % c) |
197 |
197 |
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 |
204 |
205 |
205 for x in self.status()[:5]: |
206 for x in self.status()[:5]: |
206 if '.hgtags' in x: |
207 if '.hgtags' in x: |
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 |
214 self.commit(['.hgtags'], message, user, date) |
217 self.commit(['.hgtags'], message, user, date) |
215 self.hook('tag', node=hex(node), tag=name, local=local) |
218 self.hook('tag', node=hex(node), tag=name, local=local) |