Show More
@@ -91,17 +91,39 b' def update(repo, partial, ctxgen):' | |||||
91 | if ancestors: |
|
91 | if ancestors: | |
92 | bheadrevs = [b for b in bheadrevs if b not in ancestors] |
|
92 | bheadrevs = [b for b in bheadrevs if b not in ancestors] | |
93 | partial[branch] = [cl.node(rev) for rev in bheadrevs] |
|
93 | partial[branch] = [cl.node(rev) for rev in bheadrevs] | |
|
94 | tiprev = max(bheadrevs) | |||
|
95 | if tiprev > partial.tiprev: | |||
|
96 | partial.tipnode = cl.node(tiprev) | |||
|
97 | partial.tiprev = tiprev | |||
|
98 | ||||
94 |
|
99 | |||
95 | # There may be branches that cease to exist when the last commit in the |
|
100 | # There may be branches that cease to exist when the last commit in the | |
96 | # branch was stripped. This code filters them out. Note that the |
|
101 | # branch was stripped. This code filters them out. Note that the | |
97 | # branch that ceased to exist may not be in newbranches because |
|
102 | # branch that ceased to exist may not be in newbranches because | |
98 | # newbranches is the set of candidate heads, which when you strip the |
|
103 | # newbranches is the set of candidate heads, which when you strip the | |
99 | # last commit in a branch will be the parent branch. |
|
104 | # last commit in a branch will be the parent branch. | |
|
105 | droppednodes = [] | |||
100 | for branch in partial.keys(): |
|
106 | for branch in partial.keys(): | |
101 | nodes = [head for head in partial[branch] |
|
107 | nodes = [head for head in partial[branch] | |
102 | if cl.hasnode(head)] |
|
108 | if cl.hasnode(head)] | |
103 | if not nodes: |
|
109 | if not nodes: | |
|
110 | droppednodes.extend(nodes) | |||
104 | del partial[branch] |
|
111 | del partial[branch] | |
|
112 | try: | |||
|
113 | node = cl.node(partial.tiprev) | |||
|
114 | except IndexError: | |||
|
115 | node = None | |||
|
116 | if ((partial.tipnode != node) | |||
|
117 | or (partial.tipnode in droppednodes)): | |||
|
118 | # cache key are not valid anymore | |||
|
119 | partial.tipnode = nullid | |||
|
120 | partial.tiprev = nullrev | |||
|
121 | for heads in partial.values(): | |||
|
122 | tiprev = max(cl.rev(node) for node in heads) | |||
|
123 | if tiprev > partial.tiprev: | |||
|
124 | partial.tipnode = cl.node(tiprev) | |||
|
125 | partial.tiprev = tiprev | |||
|
126 | ||||
105 |
|
127 | |||
106 | def updatecache(repo): |
|
128 | def updatecache(repo): | |
107 | repo = repo.unfiltered() # Until we get a smarter cache management |
|
129 | repo = repo.unfiltered() # Until we get a smarter cache management | |
@@ -121,8 +143,6 b' def updatecache(repo):' | |||||
121 | if partial.tiprev < catip: |
|
143 | if partial.tiprev < catip: | |
122 | ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip)) |
|
144 | ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip)) | |
123 | update(repo, partial, ctxgen) |
|
145 | update(repo, partial, ctxgen) | |
124 | partial.tipnode = cl.node(catip) |
|
|||
125 | partial.tiprev = catip |
|
|||
126 | partial.write(repo) |
|
146 | partial.write(repo) | |
127 | # If cacheable tip were lower than actual tip, we need to update the |
|
147 | # If cacheable tip were lower than actual tip, we need to update the | |
128 | # cache up to tip. This update (from cacheable to actual tip) is not |
|
148 | # cache up to tip. This update (from cacheable to actual tip) is not | |
@@ -131,8 +151,6 b' def updatecache(repo):' | |||||
131 | if partial.tiprev < tiprev: |
|
151 | if partial.tiprev < tiprev: | |
132 | ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, tiprev)) |
|
152 | ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, tiprev)) | |
133 | update(repo, partial, ctxgen) |
|
153 | update(repo, partial, ctxgen) | |
134 | partial.tipnode = cl.node(tiprev) |
|
|||
135 | partial.tiprev = tiprev |
|
|||
136 | repo._branchcache = partial |
|
154 | repo._branchcache = partial | |
137 |
|
155 | |||
138 | class branchcache(dict): |
|
156 | class branchcache(dict): |
@@ -1438,8 +1438,6 b' class localrepository(object):' | |||||
1438 | if self.changelog.hasnode(node)) |
|
1438 | if self.changelog.hasnode(node)) | |
1439 | cache = self._branchcache |
|
1439 | cache = self._branchcache | |
1440 | branchmap.update(self, cache, ctxgen) |
|
1440 | branchmap.update(self, cache, ctxgen) | |
1441 | cache.tipnode = self.changelog.tip() |
|
|||
1442 | cache.tiprev = self.changelog.rev(cache.tipnode) |
|
|||
1443 | cache.write(self) |
|
1441 | cache.write(self) | |
1444 |
|
1442 | |||
1445 | # Ensure the persistent tag cache is updated. Doing it now |
|
1443 | # Ensure the persistent tag cache is updated. Doing it now |
General Comments 0
You need to be logged in to leave comments.
Login now