comparison mercurial/localrepo.py @ 2977:f63667f694de

Merge with tah
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 22 Aug 2006 10:18:40 +0200
parents eef469259745
children aebc3f64b20f
comparison
equal deleted inserted replaced
2971:63c3a1921a67 2977:f63667f694de
167 r = runhook(hname, cmd) or r 167 r = runhook(hname, cmd) or r
168 return r 168 return r
169 169
170 tag_disallowed = ':\r\n' 170 tag_disallowed = ':\r\n'
171 171
172 def tag(self, name, node, local=False, message=None, user=None, date=None): 172 def tag(self, name, node, message, local, user, date):
173 '''tag a revision with a symbolic name. 173 '''tag a revision with a symbolic name.
174 174
175 if local is True, the tag is stored in a per-repository file. 175 if local is True, the tag is stored in a per-repository file.
176 otherwise, it is stored in the .hgtags file, and a new 176 otherwise, it is stored in the .hgtags file, and a new
177 changeset is committed with the change. 177 changeset is committed with the change.
189 189
190 for c in self.tag_disallowed: 190 for c in self.tag_disallowed:
191 if c in name: 191 if c in name:
192 raise util.Abort(_('%r cannot be used in a tag name') % c) 192 raise util.Abort(_('%r cannot be used in a tag name') % c)
193 193
194 self.hook('pretag', throw=True, node=node, tag=name, local=local) 194 self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
195 195
196 if local: 196 if local:
197 self.opener('localtags', 'a').write('%s %s\n' % (node, name)) 197 self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
198 self.hook('tag', node=node, tag=name, local=local) 198 self.hook('tag', node=hex(node), tag=name, local=local)
199 return 199 return
200 200
201 for x in self.status()[:5]: 201 for x in self.status()[:5]:
202 if '.hgtags' in x: 202 if '.hgtags' in x:
203 raise util.Abort(_('working copy of .hgtags is changed ' 203 raise util.Abort(_('working copy of .hgtags is changed '
204 '(please commit .hgtags manually)')) 204 '(please commit .hgtags manually)'))
205 205
206 self.wfile('.hgtags', 'ab').write('%s %s\n' % (node, name)) 206 self.wfile('.hgtags', 'ab').write('%s %s\n' % (hex(node), name))
207 if self.dirstate.state('.hgtags') == '?': 207 if self.dirstate.state('.hgtags') == '?':
208 self.add(['.hgtags']) 208 self.add(['.hgtags'])
209 209
210 if not message:
211 message = _('Added tag %s for changeset %s') % (name, node)
212
213 self.commit(['.hgtags'], message, user, date) 210 self.commit(['.hgtags'], message, user, date)
214 self.hook('tag', node=node, tag=name, local=local) 211 self.hook('tag', node=hex(node), tag=name, local=local)
215 212
216 def tags(self): 213 def tags(self):
217 '''return a mapping of tag to node''' 214 '''return a mapping of tag to node'''
218 if not self.tagscache: 215 if not self.tagscache:
219 self.tagscache = {} 216 self.tagscache = {}
1103 if force: 1100 if force:
1104 self.ui.warn(_("warning: repository is unrelated\n")) 1101 self.ui.warn(_("warning: repository is unrelated\n"))
1105 else: 1102 else:
1106 raise util.Abort(_("repository is unrelated")) 1103 raise util.Abort(_("repository is unrelated"))
1107 1104
1108 self.ui.note(_("found new changesets starting at ") + 1105 self.ui.debug(_("found new changesets starting at ") +
1109 " ".join([short(f) for f in fetch]) + "\n") 1106 " ".join([short(f) for f in fetch]) + "\n")
1110 1107
1111 self.ui.debug(_("%d total queries\n") % reqcnt) 1108 self.ui.debug(_("%d total queries\n") % reqcnt)
1112 1109
1113 return fetch.keys() 1110 return fetch.keys()