Show More
@@ -48,9 +48,9 b' def read(repo):' | |||||
48 | filteredhash = None |
|
48 | filteredhash = None | |
49 | if len(cachekey) > 2: |
|
49 | if len(cachekey) > 2: | |
50 | filteredhash = bin(cachekey[2]) |
|
50 | filteredhash = bin(cachekey[2]) | |
51 |
|
|
51 | bcache = branchcache(tipnode=last, tiprev=lrev, | |
52 | filteredhash=filteredhash) |
|
52 | filteredhash=filteredhash) | |
53 |
if not |
|
53 | if not bcache.validfor(repo): | |
54 | # invalidate the cache |
|
54 | # invalidate the cache | |
55 | raise ValueError(r'tip differs') |
|
55 | raise ValueError(r'tip differs') | |
56 | cl = repo.changelog |
|
56 | cl = repo.changelog | |
@@ -66,9 +66,9 b' def read(repo):' | |||||
66 | if not cl.hasnode(node): |
|
66 | if not cl.hasnode(node): | |
67 | raise ValueError( |
|
67 | raise ValueError( | |
68 | r'node %s does not exist' % pycompat.sysstr(hex(node))) |
|
68 | r'node %s does not exist' % pycompat.sysstr(hex(node))) | |
69 |
|
|
69 | bcache.setdefault(label, []).append(node) | |
70 | if state == 'c': |
|
70 | if state == 'c': | |
71 |
|
|
71 | bcache._closednodes.add(node) | |
72 |
|
72 | |||
73 | except (IOError, OSError): |
|
73 | except (IOError, OSError): | |
74 | return None |
|
74 | return None | |
@@ -80,13 +80,13 b' def read(repo):' | |||||
80 | msg += ' (%s)' % repo.filtername |
|
80 | msg += ' (%s)' % repo.filtername | |
81 | msg += ': %s\n' |
|
81 | msg += ': %s\n' | |
82 | repo.ui.debug(msg % pycompat.bytestr(inst)) |
|
82 | repo.ui.debug(msg % pycompat.bytestr(inst)) | |
83 |
|
|
83 | bcache = None | |
84 |
|
84 | |||
85 | finally: |
|
85 | finally: | |
86 | if f: |
|
86 | if f: | |
87 | f.close() |
|
87 | f.close() | |
88 |
|
88 | |||
89 |
return |
|
89 | return bcache | |
90 |
|
90 | |||
91 | ### Nearest subset relation |
|
91 | ### Nearest subset relation | |
92 | # Nearest subset of filter X is a filter Y so that: |
|
92 | # Nearest subset of filter X is a filter Y so that: | |
@@ -103,27 +103,27 b" subsettable = {None: 'visible'," | |||||
103 | def updatecache(repo): |
|
103 | def updatecache(repo): | |
104 | cl = repo.changelog |
|
104 | cl = repo.changelog | |
105 | filtername = repo.filtername |
|
105 | filtername = repo.filtername | |
106 |
|
|
106 | bcache = repo._branchcaches.get(filtername) | |
107 |
|
107 | |||
108 | revs = [] |
|
108 | revs = [] | |
109 |
if |
|
109 | if bcache is None or not bcache.validfor(repo): | |
110 |
|
|
110 | bcache = read(repo) | |
111 |
if |
|
111 | if bcache is None: | |
112 | subsetname = subsettable.get(filtername) |
|
112 | subsetname = subsettable.get(filtername) | |
113 | if subsetname is None: |
|
113 | if subsetname is None: | |
114 |
|
|
114 | bcache = branchcache() | |
115 | else: |
|
115 | else: | |
116 | subset = repo.filtered(subsetname) |
|
116 | subset = repo.filtered(subsetname) | |
117 |
|
|
117 | bcache = subset.branchmap().copy() | |
118 | extrarevs = subset.changelog.filteredrevs - cl.filteredrevs |
|
118 | extrarevs = subset.changelog.filteredrevs - cl.filteredrevs | |
119 |
revs.extend(r for r in extrarevs if r <= |
|
119 | revs.extend(r for r in extrarevs if r <= bcache.tiprev) | |
120 |
revs.extend(cl.revs(start= |
|
120 | revs.extend(cl.revs(start=bcache.tiprev + 1)) | |
121 | if revs: |
|
121 | if revs: | |
122 |
|
|
122 | bcache.update(repo, revs) | |
123 |
|
|
123 | bcache.write(repo) | |
124 |
|
124 | |||
125 |
assert |
|
125 | assert bcache.validfor(repo), filtername | |
126 |
repo._branchcaches[repo.filtername] = |
|
126 | repo._branchcaches[repo.filtername] = bcache | |
127 |
|
127 | |||
128 | def replacecache(repo, bm): |
|
128 | def replacecache(repo, bm): | |
129 | """Replace the branchmap cache for a repo with a branch mapping. |
|
129 | """Replace the branchmap cache for a repo with a branch mapping. |
General Comments 0
You need to be logged in to leave comments.
Login now