Show More
@@ -129,10 +129,7 b' class localrepository(repo.repository):' | |||||
129 |
|
129 | |||
130 | tag_disallowed = ':\r\n' |
|
130 | tag_disallowed = ':\r\n' | |
131 |
|
131 | |||
132 |
def _tag(self, names, node, message, local, user, date, |
|
132 | def _tag(self, names, node, message, local, user, date, extra={}): | |
133 | extra={}): |
|
|||
134 | use_dirstate = parent is None |
|
|||
135 |
|
||||
136 | if isinstance(names, str): |
|
133 | if isinstance(names, str): | |
137 | allchars = names |
|
134 | allchars = names | |
138 | names = (names,) |
|
135 | names = (names,) | |
@@ -173,30 +170,20 b' class localrepository(repo.repository):' | |||||
173 | self.hook('tag', node=hex(node), tag=name, local=local) |
|
170 | self.hook('tag', node=hex(node), tag=name, local=local) | |
174 | return |
|
171 | return | |
175 |
|
172 | |||
176 | if use_dirstate: |
|
173 | try: | |
177 | try: |
|
174 | fp = self.wfile('.hgtags', 'rb+') | |
178 | fp = self.wfile('.hgtags', 'rb+') |
|
175 | except IOError: | |
179 | except IOError: |
|
176 | fp = self.wfile('.hgtags', 'ab') | |
180 | fp = self.wfile('.hgtags', 'ab') |
|
|||
181 | else: |
|
|||
182 | prevtags = fp.read() |
|
|||
183 | else: |
|
177 | else: | |
184 | try: |
|
178 | prevtags = fp.read() | |
185 | prevtags = self.filectx('.hgtags', parent).data() |
|
|||
186 | except error.LookupError: |
|
|||
187 | pass |
|
|||
188 | fp = self.wfile('.hgtags', 'wb') |
|
|||
189 | if prevtags: |
|
|||
190 | fp.write(prevtags) |
|
|||
191 |
|
179 | |||
192 | # committed tags are stored in UTF-8 |
|
180 | # committed tags are stored in UTF-8 | |
193 | writetags(fp, names, encoding.fromlocal, prevtags) |
|
181 | writetags(fp, names, encoding.fromlocal, prevtags) | |
194 |
|
182 | |||
195 |
if |
|
183 | if '.hgtags' not in self.dirstate: | |
196 | self.add(['.hgtags']) |
|
184 | self.add(['.hgtags']) | |
197 |
|
185 | |||
198 |
tagnode = self.commit(['.hgtags'], message, user, date, |
|
186 | tagnode = self.commit(['.hgtags'], message, user, date, extra=extra) | |
199 | extra=extra) |
|
|||
200 |
|
187 | |||
201 | for name in names: |
|
188 | for name in names: | |
202 | self.hook('tag', node=hex(node), tag=name, local=local) |
|
189 | self.hook('tag', node=hex(node), tag=name, local=local) |
General Comments 0
You need to be logged in to leave comments.
Login now