--- a/mercurial/context.py Tue Feb 27 16:47:16 2007 -0600
+++ b/mercurial/context.py Tue Feb 27 16:48:17 2007 -0600
@@ -510,7 +510,7 @@
def date(self):
t, tz = self._changectx.date()
try:
- return (os.lstat(self._repo.wjoin(self._path)).st_mtime, tz)
+ return (int(os.lstat(self._repo.wjoin(self._path)).st_mtime), tz)
except OSError, err:
if err.errno != errno.ENOENT: raise
return (t, tz)
--- a/mercurial/localrepo.py Tue Feb 27 16:47:16 2007 -0600
+++ b/mercurial/localrepo.py Tue Feb 27 16:48:17 2007 -0600
@@ -217,6 +217,37 @@
tag_disallowed = ':\r\n'
+ def _tag(self, name, node, message, local, user, date, parent=None):
+ use_dirstate = parent is None
+
+ for c in self.tag_disallowed:
+ if c in name:
+ raise util.Abort(_('%r cannot be used in a tag name') % c)
+
+ self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
+
+ if local:
+ # local tags are stored in the current charset
+ self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
+ self.hook('tag', node=hex(node), tag=name, local=local)
+ return
+
+ # committed tags are stored in UTF-8
+ line = '%s %s\n' % (hex(node), util.fromlocal(name))
+ if use_dirstate:
+ self.wfile('.hgtags', 'ab').write(line)
+ else:
+ ntags = self.filectx('.hgtags', parent).data()
+ self.wfile('.hgtags', 'ab').write(ntags + line)
+ if use_dirstate and self.dirstate.state('.hgtags') == '?':
+ self.add(['.hgtags'])
+
+ tagnode = self.commit(['.hgtags'], message, user, date, p1=parent)
+
+ self.hook('tag', node=hex(node), tag=name, local=local)
+
+ return tagnode
+
def tag(self, name, node, message, local, user, date):
'''tag a revision with a symbolic name.
@@ -235,31 +266,13 @@
date: date tuple to use if committing'''
- for c in self.tag_disallowed:
- if c in name:
- raise util.Abort(_('%r cannot be used in a tag name') % c)
-
- self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
-
- if local:
- # local tags are stored in the current charset
- self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
- self.hook('tag', node=hex(node), tag=name, local=local)
- return
-
for x in self.status()[:5]:
if '.hgtags' in x:
raise util.Abort(_('working copy of .hgtags is changed '
'(please commit .hgtags manually)'))
- # committed tags are stored in UTF-8
- line = '%s %s\n' % (hex(node), util.fromlocal(name))
- self.wfile('.hgtags', 'ab').write(line)
- if self.dirstate.state('.hgtags') == '?':
- self.add(['.hgtags'])
- self.commit(['.hgtags'], message, user, date)
- self.hook('tag', node=hex(node), tag=name, local=local)
+ self._tag(name, node, message, local, user, date)
def tags(self):
'''return a mapping of tag to node'''