Show More
@@ -134,6 +134,7 b' class branchcache(dict):' | |||||
134 | self._closednodes = set() |
|
134 | self._closednodes = set() | |
135 | else: |
|
135 | else: | |
136 | self._closednodes = closednodes |
|
136 | self._closednodes = closednodes | |
|
137 | self._revbranchcache = None | |||
137 |
|
138 | |||
138 | def _hashfiltered(self, repo): |
|
139 | def _hashfiltered(self, repo): | |
139 | """build hash of revision filtered in the current cache |
|
140 | """build hash of revision filtered in the current cache | |
@@ -225,6 +226,9 b' class branchcache(dict):' | |||||
225 | repo.ui.debug("couldn't write branch cache: %s\n" % inst) |
|
226 | repo.ui.debug("couldn't write branch cache: %s\n" % inst) | |
226 | # Abort may be raise by read only opener |
|
227 | # Abort may be raise by read only opener | |
227 | pass |
|
228 | pass | |
|
229 | if self._revbranchcache: | |||
|
230 | self._revbranchcache.write(repo.unfiltered()) | |||
|
231 | self._revbranchcache = None | |||
228 |
|
232 | |||
229 | def update(self, repo, revgen): |
|
233 | def update(self, repo, revgen): | |
230 | """Given a branchhead cache, self, that may have extra nodes or be |
|
234 | """Given a branchhead cache, self, that may have extra nodes or be | |
@@ -235,9 +239,12 b' class branchcache(dict):' | |||||
235 | cl = repo.changelog |
|
239 | cl = repo.changelog | |
236 | # collect new branch entries |
|
240 | # collect new branch entries | |
237 | newbranches = {} |
|
241 | newbranches = {} | |
238 | getbranchinfo = cl.branchinfo |
|
242 | urepo = repo.unfiltered() | |
|
243 | self._revbranchcache = revbranchcache(urepo) | |||
|
244 | getbranchinfo = self._revbranchcache.branchinfo | |||
|
245 | ucl = urepo.changelog | |||
239 | for r in revgen: |
|
246 | for r in revgen: | |
240 | branch, closesbranch = getbranchinfo(r) |
|
247 | branch, closesbranch = getbranchinfo(ucl, r) | |
241 | newbranches.setdefault(branch, []).append(r) |
|
248 | newbranches.setdefault(branch, []).append(r) | |
242 | if closesbranch: |
|
249 | if closesbranch: | |
243 | self._closednodes.add(cl.node(r)) |
|
250 | self._closednodes.add(cl.node(r)) | |
@@ -361,7 +368,7 b' class revbranchcache(object):' | |||||
361 | self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize - |
|
368 | self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize - | |
362 | len(self._rbcrevs))) |
|
369 | len(self._rbcrevs))) | |
363 | for r in xrange(first, len(changelog)): |
|
370 | for r in xrange(first, len(changelog)): | |
364 | self._branchinfo(r) |
|
371 | self._branchinfo(changelog, r) | |
365 |
|
372 | |||
366 | # fast path: extract data from cache, use it if node is matching |
|
373 | # fast path: extract data from cache, use it if node is matching | |
367 | reponode = changelog.node(rev)[:_rbcnodelen] |
|
374 | reponode = changelog.node(rev)[:_rbcnodelen] | |
@@ -374,7 +381,7 b' class revbranchcache(object):' | |||||
374 | return self._names[branchidx], close |
|
381 | return self._names[branchidx], close | |
375 | # fall back to slow path and make sure it will be written to disk |
|
382 | # fall back to slow path and make sure it will be written to disk | |
376 | self._rbcrevslen = min(self._rbcrevslen, rev) |
|
383 | self._rbcrevslen = min(self._rbcrevslen, rev) | |
377 | return self._branchinfo(rev) |
|
384 | return self._branchinfo(changelog, rev) | |
378 |
|
385 | |||
379 | def _branchinfo(self, changelog, rev): |
|
386 | def _branchinfo(self, changelog, rev): | |
380 | """Retrieve branch info from changelog and update _rbcrevs""" |
|
387 | """Retrieve branch info from changelog and update _rbcrevs""" |
@@ -31,6 +31,8 b' Trigger branchcache creation:' | |||||
31 | default 10:a7949464abda |
|
31 | default 10:a7949464abda | |
32 | $ ls .hg/cache |
|
32 | $ ls .hg/cache | |
33 | branch2-served |
|
33 | branch2-served | |
|
34 | rbc-names-v1 | |||
|
35 | rbc-revs-v1 | |||
34 |
|
36 | |||
35 | Default operation: |
|
37 | Default operation: | |
36 |
|
38 |
@@ -53,6 +53,7 b' Convert while testing all possible outpu' | |||||
53 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1 |
|
53 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@1 | |
54 | converting: 0/6 revisions (0.00%) |
|
54 | converting: 0/6 revisions (0.00%) | |
55 | committing changelog |
|
55 | committing changelog | |
|
56 | couldn't read revision branch cache names: * (glob) | |||
56 | 4 hello |
|
57 | 4 hello | |
57 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2 |
|
58 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/trunk@2 | |
58 | converting: 1/6 revisions (16.67%) |
|
59 | converting: 1/6 revisions (16.67%) |
@@ -71,6 +71,8 b' Non store repo:' | |||||
71 | .hg/00manifest.i |
|
71 | .hg/00manifest.i | |
72 | .hg/cache |
|
72 | .hg/cache | |
73 | .hg/cache/branch2-served |
|
73 | .hg/cache/branch2-served | |
|
74 | .hg/cache/rbc-names-v1 | |||
|
75 | .hg/cache/rbc-revs-v1 | |||
74 | .hg/data |
|
76 | .hg/data | |
75 | .hg/data/tst.d.hg |
|
77 | .hg/data/tst.d.hg | |
76 | .hg/data/tst.d.hg/foo.i |
|
78 | .hg/data/tst.d.hg/foo.i | |
@@ -99,6 +101,8 b' Non fncache repo:' | |||||
99 | .hg/00changelog.i |
|
101 | .hg/00changelog.i | |
100 | .hg/cache |
|
102 | .hg/cache | |
101 | .hg/cache/branch2-served |
|
103 | .hg/cache/branch2-served | |
|
104 | .hg/cache/rbc-names-v1 | |||
|
105 | .hg/cache/rbc-revs-v1 | |||
102 | .hg/dirstate |
|
106 | .hg/dirstate | |
103 | .hg/last-message.txt |
|
107 | .hg/last-message.txt | |
104 | .hg/requires |
|
108 | .hg/requires |
@@ -196,6 +196,8 b' r4 has hardlinks in the working dir (not' | |||||
196 | 2 r4/.hg/00changelog.i |
|
196 | 2 r4/.hg/00changelog.i | |
197 | 2 r4/.hg/branch |
|
197 | 2 r4/.hg/branch | |
198 | 2 r4/.hg/cache/branch2-served |
|
198 | 2 r4/.hg/cache/branch2-served | |
|
199 | 2 r4/.hg/cache/rbc-names-v1 | |||
|
200 | 2 r4/.hg/cache/rbc-revs-v1 | |||
199 | 2 r4/.hg/dirstate |
|
201 | 2 r4/.hg/dirstate | |
200 | 2 r4/.hg/hgrc |
|
202 | 2 r4/.hg/hgrc | |
201 | 2 r4/.hg/last-message.txt |
|
203 | 2 r4/.hg/last-message.txt | |
@@ -226,6 +228,8 b' Update back to revision 11 in r4 should ' | |||||
226 | 2 r4/.hg/00changelog.i |
|
228 | 2 r4/.hg/00changelog.i | |
227 | 1 r4/.hg/branch |
|
229 | 1 r4/.hg/branch | |
228 | 2 r4/.hg/cache/branch2-served |
|
230 | 2 r4/.hg/cache/branch2-served | |
|
231 | 2 r4/.hg/cache/rbc-names-v1 | |||
|
232 | 2 r4/.hg/cache/rbc-revs-v1 | |||
229 | 1 r4/.hg/dirstate |
|
233 | 1 r4/.hg/dirstate | |
230 | 2 r4/.hg/hgrc |
|
234 | 2 r4/.hg/hgrc | |
231 | 2 r4/.hg/last-message.txt |
|
235 | 2 r4/.hg/last-message.txt |
@@ -66,6 +66,8 b' new directories are setgid' | |||||
66 | 00600 ./.hg/00changelog.i |
|
66 | 00600 ./.hg/00changelog.i | |
67 | 00770 ./.hg/cache/ |
|
67 | 00770 ./.hg/cache/ | |
68 | 00660 ./.hg/cache/branch2-served |
|
68 | 00660 ./.hg/cache/branch2-served | |
|
69 | 00660 ./.hg/cache/rbc-names-v1 | |||
|
70 | 00660 ./.hg/cache/rbc-revs-v1 | |||
69 | 00660 ./.hg/dirstate |
|
71 | 00660 ./.hg/dirstate | |
70 | 00660 ./.hg/last-message.txt |
|
72 | 00660 ./.hg/last-message.txt | |
71 | 00600 ./.hg/requires |
|
73 | 00600 ./.hg/requires | |
@@ -111,6 +113,8 b' group can still write everything' | |||||
111 | 00660 ../push/.hg/00changelog.i |
|
113 | 00660 ../push/.hg/00changelog.i | |
112 | 00770 ../push/.hg/cache/ |
|
114 | 00770 ../push/.hg/cache/ | |
113 | 00660 ../push/.hg/cache/branch2-base |
|
115 | 00660 ../push/.hg/cache/branch2-base | |
|
116 | 00660 ../push/.hg/cache/rbc-names-v1 | |||
|
117 | 00660 ../push/.hg/cache/rbc-revs-v1 | |||
114 | 00660 ../push/.hg/requires |
|
118 | 00660 ../push/.hg/requires | |
115 | 00770 ../push/.hg/store/ |
|
119 | 00770 ../push/.hg/store/ | |
116 | 00660 ../push/.hg/store/00changelog.i |
|
120 | 00660 ../push/.hg/store/00changelog.i |
General Comments 0
You need to be logged in to leave comments.
Login now