Show More
@@ -258,10 +258,13 b' class localrepository(repo.repository):' | |||||
258 | # be one tagtype for all such "virtual" tags? Or is the status |
|
258 | # be one tagtype for all such "virtual" tags? Or is the status | |
259 | # quo fine? |
|
259 | # quo fine? | |
260 |
|
260 | |||
261 | alltags = {} # map tag name to (node, hist) |
|
261 | def readtags(lines, fn): | |
262 | tagtypes = {} |
|
262 | '''Read tag definitions from a file (or any source of | |
|
263 | lines). Return a mapping from tag name to (node, hist): | |||
|
264 | node is the node id from the last line read for that name, | |||
|
265 | and hist is the list of node ids previously associated with | |||
|
266 | it (in file order). All node ids are binary, not hex.''' | |||
263 |
|
267 | |||
264 | def readtags(lines, fn, tagtype): |
|
|||
265 | filetags = {} # map tag name to (node, hist) |
|
268 | filetags = {} # map tag name to (node, hist) | |
266 | count = 0 |
|
269 | count = 0 | |
267 |
|
270 | |||
@@ -287,15 +290,21 b' class localrepository(repo.repository):' | |||||
287 | # silently ignore as pull -r might cause this |
|
290 | # silently ignore as pull -r might cause this | |
288 | continue |
|
291 | continue | |
289 |
|
292 | |||
290 |
# update filetags |
|
293 | # update filetags | |
291 | # node is the node from the latest line read with |
|
|||
292 | # 'name', and hist is the list of nodes previously |
|
|||
293 | # associated with 'name' |
|
|||
294 | hist = [] |
|
294 | hist = [] | |
295 | if name in filetags: |
|
295 | if name in filetags: | |
296 | n, hist = filetags[name] |
|
296 | n, hist = filetags[name] | |
297 | hist.append(n) |
|
297 | hist.append(n) | |
298 | filetags[name] = (nodebin, hist) |
|
298 | filetags[name] = (nodebin, hist) | |
|
299 | return filetags | |||
|
300 | ||||
|
301 | alltags = {} # map tag name to (node, hist) | |||
|
302 | tagtypes = {} | |||
|
303 | ||||
|
304 | def updatetags(filetags, tagtype): | |||
|
305 | '''Incorporate the tag info read from one file into the two | |||
|
306 | dictionaries, alltags and tagtypes, that contain all tag | |||
|
307 | info (global across all heads plus local).''' | |||
299 |
|
308 | |||
300 | for name, nodehist in filetags.iteritems(): |
|
309 | for name, nodehist in filetags.iteritems(): | |
301 | if name not in alltags: |
|
310 | if name not in alltags: | |
@@ -334,13 +343,15 b' class localrepository(repo.repository):' | |||||
334 |
|
343 | |||
335 | # read the tags file from each head, ending with the tip |
|
344 | # read the tags file from each head, ending with the tip | |
336 | for fctx in reversed(ctxs): |
|
345 | for fctx in reversed(ctxs): | |
337 |
readtags(fctx.data().splitlines(), fctx |
|
346 | filetags = readtags(fctx.data().splitlines(), fctx) | |
|
347 | updatetags(filetags, "global") | |||
338 |
|
348 | |||
339 | try: |
|
349 | try: | |
340 | data = encoding.fromlocal(self.opener("localtags").read()) |
|
350 | data = encoding.fromlocal(self.opener("localtags").read()) | |
341 | # localtags are stored in the local character set |
|
351 | # localtags are stored in the local character set | |
342 | # while the internal tag table is stored in UTF-8 |
|
352 | # while the internal tag table is stored in UTF-8 | |
343 |
readtags(data.splitlines(), "localtags" |
|
353 | filetags = readtags(data.splitlines(), "localtags") | |
|
354 | updatetags(filetags, "local") | |||
344 | except IOError: |
|
355 | except IOError: | |
345 | pass |
|
356 | pass | |
346 |
|
357 |
General Comments 0
You need to be logged in to leave comments.
Login now