Show More
@@ -278,26 +278,23 b' def _readtagcache(ui, repo):' | |||||
278 | except IOError: |
|
278 | except IOError: | |
279 | cachefile = None |
|
279 | cachefile = None | |
280 |
|
280 | |||
281 | cacherevs = [] # list of headrev |
|
281 | cachetiprev = None | |
282 | cacheheads = [] # list of headnode |
|
282 | cachetipnode = None | |
283 | cachefnode = {} # map headnode to filenode |
|
|||
284 | if cachefile: |
|
283 | if cachefile: | |
285 | try: |
|
284 | try: | |
286 | for line in cachelines: |
|
285 | for i, line in enumerate(cachelines): | |
|
286 | # Getting the first line and consuming all fnode lines. | |||
287 | if line == "\n": |
|
287 | if line == "\n": | |
288 | break |
|
288 | break | |
|
289 | if i != 0: | |||
|
290 | continue | |||
|
291 | ||||
289 | line = line.split() |
|
292 | line = line.split() | |
290 |
cache |
|
293 | cachetiprev = int(line[0]) | |
291 |
|
|
294 | cachetipnode = bin(line[1]) | |
292 | cacheheads.append(headnode) |
|
|||
293 | if len(line) == 3: |
|
|||
294 | fnode = bin(line[2]) |
|
|||
295 | cachefnode[headnode] = fnode |
|
|||
296 | except Exception: |
|
295 | except Exception: | |
297 |
# corruption of the |
|
296 | # corruption of the cache, just recompute it. | |
298 |
|
|
297 | pass | |
299 | cacherevs = [] |
|
|||
300 | cachefnode = {} |
|
|||
301 |
|
298 | |||
302 | tipnode = repo.changelog.tip() |
|
299 | tipnode = repo.changelog.tip() | |
303 | tiprev = len(repo.changelog) - 1 |
|
300 | tiprev = len(repo.changelog) - 1 | |
@@ -306,7 +303,9 b' def _readtagcache(ui, repo):' | |||||
306 | # (Unchanged tip trivially means no changesets have been added. |
|
303 | # (Unchanged tip trivially means no changesets have been added. | |
307 | # But, thanks to localrepository.destroyed(), it also means none |
|
304 | # But, thanks to localrepository.destroyed(), it also means none | |
308 | # have been destroyed by strip or rollback.) |
|
305 | # have been destroyed by strip or rollback.) | |
309 | if cacheheads and cacheheads[0] == tipnode and cacherevs[0] == tiprev: |
|
306 | if (cachetiprev is not None | |
|
307 | and cachetiprev == tiprev | |||
|
308 | and cachetipnode == tipnode): | |||
310 | tags = _readtags(ui, repo, cachelines, cachefile.name) |
|
309 | tags = _readtags(ui, repo, cachelines, cachefile.name) | |
311 | cachefile.close() |
|
310 | cachefile.close() | |
312 | return (None, None, tags, False) |
|
311 | return (None, None, tags, False) | |
@@ -335,20 +334,17 b' def _readtagcache(ui, repo):' | |||||
335 | if not len(repo.file('.hgtags')): |
|
334 | if not len(repo.file('.hgtags')): | |
336 | # No tags have ever been committed, so we can avoid a |
|
335 | # No tags have ever been committed, so we can avoid a | |
337 | # potentially expensive search. |
|
336 | # potentially expensive search. | |
338 |
return (repoheads, |
|
337 | return (repoheads, {}, None, True) | |
339 |
|
338 | |||
340 | starttime = time.time() |
|
339 | starttime = time.time() | |
341 |
|
340 | |||
342 | newheads = [head |
|
|||
343 | for head in repoheads |
|
|||
344 | if head not in set(cacheheads)] |
|
|||
345 |
|
||||
346 | # Now we have to lookup the .hgtags filenode for every new head. |
|
341 | # Now we have to lookup the .hgtags filenode for every new head. | |
347 | # This is the most expensive part of finding tags, so performance |
|
342 | # This is the most expensive part of finding tags, so performance | |
348 | # depends primarily on the size of newheads. Worst case: no cache |
|
343 | # depends primarily on the size of newheads. Worst case: no cache | |
349 | # file, so newheads == repoheads. |
|
344 | # file, so newheads == repoheads. | |
350 | fnodescache = hgtagsfnodescache(repo.unfiltered()) |
|
345 | fnodescache = hgtagsfnodescache(repo.unfiltered()) | |
351 | for head in reversed(newheads): |
|
346 | cachefnode = {} | |
|
347 | for head in reversed(repoheads): | |||
352 | fnode = fnodescache.getfnode(head) |
|
348 | fnode = fnodescache.getfnode(head) | |
353 | if fnode != nullid: |
|
349 | if fnode != nullid: | |
354 | cachefnode[head] = fnode |
|
350 | cachefnode[head] = fnode |
@@ -345,7 +345,7 b' Extra junk data at the end should get ov' | |||||
345 | $ hg blackbox -l 5 |
|
345 | $ hg blackbox -l 5 | |
346 | 1970/01/01 00:00:00 bob> tags |
|
346 | 1970/01/01 00:00:00 bob> tags | |
347 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
347 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 | |
348 |
1970/01/01 00:00:00 bob> |
|
348 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) | |
349 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags |
|
349 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags | |
350 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
350 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) | |
351 |
|
351 | |||
@@ -396,7 +396,7 b" Stripping doesn't truncate the tags cach" | |||||
396 |
|
396 | |||
397 | $ hg blackbox -l 4 |
|
397 | $ hg blackbox -l 4 | |
398 | 1970/01/01 00:00:00 bob> tags |
|
398 | 1970/01/01 00:00:00 bob> tags | |
399 |
1970/01/01 00:00:00 bob> |
|
399 | 1970/01/01 00:00:00 bob> 3/3 cache hits/lookups in * seconds (glob) | |
400 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags |
|
400 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags | |
401 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
401 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) | |
402 |
|
402 | |||
@@ -413,7 +413,7 b" Stripping doesn't truncate the tags cach" | |||||
413 | $ hg blackbox -l 5 |
|
413 | $ hg blackbox -l 5 | |
414 | 1970/01/01 00:00:00 bob> tags |
|
414 | 1970/01/01 00:00:00 bob> tags | |
415 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
415 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 | |
416 |
1970/01/01 00:00:00 bob> |
|
416 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) | |
417 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags |
|
417 | 1970/01/01 00:00:00 bob> writing tags cache file with 3 heads and 1 tags | |
418 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
418 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) | |
419 | $ f --size .hg/cache/hgtagsfnodes1 |
|
419 | $ f --size .hg/cache/hgtagsfnodes1 |
General Comments 0
You need to be logged in to leave comments.
Login now