Show More
@@ -17,6 +17,7 demandload(globals(), "os revlog time ut | |||
|
17 | 17 | class localrepository(repo.repository): |
|
18 | 18 | capabilities = ('lookup', 'changegroupsubset') |
|
19 | 19 | supported = ('revlogv1', 'store') |
|
20 | branchcache_features = ('unnamed',) | |
|
20 | 21 | |
|
21 | 22 | def __del__(self): |
|
22 | 23 | self.transhandle = None |
@@ -376,6 +377,22 class localrepository(repo.repository): | |||
|
376 | 377 | f = self.opener("branches.cache") |
|
377 | 378 | lines = f.read().split('\n') |
|
378 | 379 | f.close() |
|
380 | features = lines.pop(0).strip() | |
|
381 | if not features.startswith('features: '): | |
|
382 | raise ValueError(_('branch cache: no features specified')) | |
|
383 | features = features.split(' ', 1)[1].split() | |
|
384 | missing_features = [] | |
|
385 | for feature in self.branchcache_features: | |
|
386 | try: | |
|
387 | features.remove(feature) | |
|
388 | except ValueError, inst: | |
|
389 | missing_features.append(feature) | |
|
390 | if missing_features: | |
|
391 | raise ValueError(_('branch cache: missing features: %s') | |
|
392 | % ', '.join(missing_features)) | |
|
393 | if features: | |
|
394 | raise ValueError(_('branch cache: unknown features: %s') | |
|
395 | % ', '.join(features)) | |
|
379 | 396 | last, lrev = lines.pop(0).split(" ", 1) |
|
380 | 397 | last, lrev = bin(last), int(lrev) |
|
381 | 398 | if not (lrev < self.changelog.count() and |
@@ -397,6 +414,7 class localrepository(repo.repository): | |||
|
397 | 414 | def _writebranchcache(self, branches, tip, tiprev): |
|
398 | 415 | try: |
|
399 | 416 | f = self.opener("branches.cache", "w") |
|
417 | f.write(" features: %s\n" % ' '.join(self.branchcache_features)) | |
|
400 | 418 | f.write("%s %s\n" % (hex(tip), tiprev)) |
|
401 | 419 | for label, node in branches.iteritems(): |
|
402 | 420 | f.write("%s %s\n" % (hex(node), label)) |
@@ -7,6 +7,7 No .hg/branches.cache | |||
|
7 | 7 | # some regular revisions |
|
8 | 8 | Patch queue now empty |
|
9 | 9 | tip: 1 |
|
10 | features: unnamed | |
|
10 | 11 | 3f910abad313ff802d3a23a7529433872df9b3ae 1 |
|
11 | 12 | 3f910abad313ff802d3a23a7529433872df9b3ae bar |
|
12 | 13 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
@@ -15,10 +16,12 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff | |||
|
15 | 16 | applying p1 |
|
16 | 17 | Now at: p1 |
|
17 | 18 | tip: 2 |
|
19 | features: unnamed | |
|
18 | 20 | 3f910abad313ff802d3a23a7529433872df9b3ae 1 |
|
19 | 21 | 3f910abad313ff802d3a23a7529433872df9b3ae bar |
|
20 | 22 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
|
21 | 23 | tip: 3 |
|
24 | features: unnamed | |
|
22 | 25 | 3f910abad313ff802d3a23a7529433872df9b3ae 1 |
|
23 | 26 | 3f910abad313ff802d3a23a7529433872df9b3ae bar |
|
24 | 27 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
@@ -27,6 +30,7 branch bar: 2 | |||
|
27 | 30 | |
|
28 | 31 | # removing the cache |
|
29 | 32 | tip: 3 |
|
33 | features: unnamed | |
|
30 | 34 | 3f910abad313ff802d3a23a7529433872df9b3ae 1 |
|
31 | 35 | 3f910abad313ff802d3a23a7529433872df9b3ae bar |
|
32 | 36 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
@@ -35,6 +39,7 branch bar: 2 | |||
|
35 | 39 | |
|
36 | 40 | # importing rev 1 (the cache now ends in one of the patches) |
|
37 | 41 | tip: 3 |
|
42 | features: unnamed | |
|
38 | 43 | 3f910abad313ff802d3a23a7529433872df9b3ae 1 |
|
39 | 44 | 3f910abad313ff802d3a23a7529433872df9b3ae bar |
|
40 | 45 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
@@ -49,5 +54,6 applying p1 | |||
|
49 | 54 | applying p2 |
|
50 | 55 | Now at: p2 |
|
51 | 56 | tip: 3 |
|
57 | features: unnamed | |
|
52 | 58 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0 |
|
53 | 59 | 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo |
General Comments 0
You need to be logged in to leave comments.
Login now