Show More
@@ -1465,26 +1465,31 def debuglocks(ui, repo, **opts): | |||||
1465 | ], '') |
|
1465 | ], '') | |
1466 | def debugmanifestfulltextcache(ui, repo, add=None, **opts): |
|
1466 | def debugmanifestfulltextcache(ui, repo, add=None, **opts): | |
1467 | """show, clear or amend the contents of the manifest fulltext cache""" |
|
1467 | """show, clear or amend the contents of the manifest fulltext cache""" | |
1468 | with repo.lock(): |
|
1468 | ||
|
1469 | def getcache(): | |||
1469 | r = repo.manifestlog.getstorage(b'') |
|
1470 | r = repo.manifestlog.getstorage(b'') | |
1470 | try: |
|
1471 | try: | |
1471 |
|
|
1472 | return r._fulltextcache | |
1472 | except AttributeError: |
|
1473 | except AttributeError: | |
1473 | ui.warn(_( |
|
1474 | msg = _("Current revlog implementation doesn't appear to have a " | |
1474 | "Current revlog implementation doesn't appear to have a " |
|
1475 | "manifest fulltext cache\n") | |
1475 | 'manifest fulltext cache\n')) |
|
1476 | raise error.Abort(msg) | |
1476 | return |
|
|||
1477 |
|
1477 | |||
1478 |
|
|
1478 | if opts.get(r'clear'): | |
|
1479 | with repo.lock(): | |||
|
1480 | cache = getcache() | |||
1479 | cache.clear() |
|
1481 | cache.clear() | |
1480 |
|
1482 | |||
1481 |
|
|
1483 | if add: | |
|
1484 | with repo.lock(): | |||
1482 | try: |
|
1485 | try: | |
1483 |
m |
|
1486 | m = repo.manifestlog | |
|
1487 | manifest = m[m.getstorage(b'').lookup(add)] | |||
1484 | except error.LookupError as e: |
|
1488 | except error.LookupError as e: | |
1485 | raise error.Abort(e, hint="Check your manifest node id") |
|
1489 | raise error.Abort(e, hint="Check your manifest node id") | |
1486 | manifest.read() # stores revisision in cache too |
|
1490 | manifest.read() # stores revisision in cache too | |
1487 |
|
1491 | |||
|
1492 | cache = getcache() | |||
1488 |
|
|
1493 | if not len(cache): | |
1489 |
|
|
1494 | ui.write(_('cache empty\n')) | |
1490 |
|
|
1495 | else: |
@@ -107,3 +107,15 Showing the content of the caches after | |||||
107 |
|
107 | |||
108 | $ hg debugmanifestfulltextcache |
|
108 | $ hg debugmanifestfulltextcache | |
109 | cache empty |
|
109 | cache empty | |
|
110 | ||||
|
111 | Adding a new persistent entry in the cache | |||
|
112 | ||||
|
113 | $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 | |||
|
114 | cache contains 1 manifest entries, in order of most to least recent: | |||
|
115 | id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes | |||
|
116 | total cache data size 157 bytes, on-disk 157 bytes | |||
|
117 | ||||
|
118 | $ hg debugmanifestfulltextcache | |||
|
119 | cache contains 1 manifest entries, in order of most to least recent: | |||
|
120 | id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes | |||
|
121 | total cache data size 157 bytes, on-disk 157 bytes |
General Comments 0
You need to be logged in to leave comments.
Login now