##// END OF EJS Templates
Add a features list to branches.cache to detect caches of old hg versions....
Thomas Arendsen Hein -
r4168:bbfe5a3f default
parent child Browse files
Show More
@@ -17,6 +17,7 b' demandload(globals(), "os revlog time ut'
17 class localrepository(repo.repository):
17 class localrepository(repo.repository):
18 capabilities = ('lookup', 'changegroupsubset')
18 capabilities = ('lookup', 'changegroupsubset')
19 supported = ('revlogv1', 'store')
19 supported = ('revlogv1', 'store')
20 branchcache_features = ('unnamed',)
20
21
21 def __del__(self):
22 def __del__(self):
22 self.transhandle = None
23 self.transhandle = None
@@ -376,6 +377,22 b' class localrepository(repo.repository):'
376 f = self.opener("branches.cache")
377 f = self.opener("branches.cache")
377 lines = f.read().split('\n')
378 lines = f.read().split('\n')
378 f.close()
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 last, lrev = lines.pop(0).split(" ", 1)
396 last, lrev = lines.pop(0).split(" ", 1)
380 last, lrev = bin(last), int(lrev)
397 last, lrev = bin(last), int(lrev)
381 if not (lrev < self.changelog.count() and
398 if not (lrev < self.changelog.count() and
@@ -397,6 +414,7 b' class localrepository(repo.repository):'
397 def _writebranchcache(self, branches, tip, tiprev):
414 def _writebranchcache(self, branches, tip, tiprev):
398 try:
415 try:
399 f = self.opener("branches.cache", "w")
416 f = self.opener("branches.cache", "w")
417 f.write(" features: %s\n" % ' '.join(self.branchcache_features))
400 f.write("%s %s\n" % (hex(tip), tiprev))
418 f.write("%s %s\n" % (hex(tip), tiprev))
401 for label, node in branches.iteritems():
419 for label, node in branches.iteritems():
402 f.write("%s %s\n" % (hex(node), label))
420 f.write("%s %s\n" % (hex(node), label))
@@ -7,6 +7,7 b' No .hg/branches.cache'
7 # some regular revisions
7 # some regular revisions
8 Patch queue now empty
8 Patch queue now empty
9 tip: 1
9 tip: 1
10 features: unnamed
10 3f910abad313ff802d3a23a7529433872df9b3ae 1
11 3f910abad313ff802d3a23a7529433872df9b3ae 1
11 3f910abad313ff802d3a23a7529433872df9b3ae bar
12 3f910abad313ff802d3a23a7529433872df9b3ae bar
12 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
13 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -15,10 +16,12 b' 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff'
15 applying p1
16 applying p1
16 Now at: p1
17 Now at: p1
17 tip: 2
18 tip: 2
19 features: unnamed
18 3f910abad313ff802d3a23a7529433872df9b3ae 1
20 3f910abad313ff802d3a23a7529433872df9b3ae 1
19 3f910abad313ff802d3a23a7529433872df9b3ae bar
21 3f910abad313ff802d3a23a7529433872df9b3ae bar
20 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
22 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
21 tip: 3
23 tip: 3
24 features: unnamed
22 3f910abad313ff802d3a23a7529433872df9b3ae 1
25 3f910abad313ff802d3a23a7529433872df9b3ae 1
23 3f910abad313ff802d3a23a7529433872df9b3ae bar
26 3f910abad313ff802d3a23a7529433872df9b3ae bar
24 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
27 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -27,6 +30,7 b' branch bar: 2'
27
30
28 # removing the cache
31 # removing the cache
29 tip: 3
32 tip: 3
33 features: unnamed
30 3f910abad313ff802d3a23a7529433872df9b3ae 1
34 3f910abad313ff802d3a23a7529433872df9b3ae 1
31 3f910abad313ff802d3a23a7529433872df9b3ae bar
35 3f910abad313ff802d3a23a7529433872df9b3ae bar
32 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
36 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -35,6 +39,7 b' branch bar: 2'
35
39
36 # importing rev 1 (the cache now ends in one of the patches)
40 # importing rev 1 (the cache now ends in one of the patches)
37 tip: 3
41 tip: 3
42 features: unnamed
38 3f910abad313ff802d3a23a7529433872df9b3ae 1
43 3f910abad313ff802d3a23a7529433872df9b3ae 1
39 3f910abad313ff802d3a23a7529433872df9b3ae bar
44 3f910abad313ff802d3a23a7529433872df9b3ae bar
40 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
45 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -49,5 +54,6 b' applying p1'
49 applying p2
54 applying p2
50 Now at: p2
55 Now at: p2
51 tip: 3
56 tip: 3
57 features: unnamed
52 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0
58 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0
53 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
59 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -74,6 +74,7 b' modify a branch'
74
74
75
75
76 4:4909a3732169
76 4:4909a3732169
77 features: unnamed
77 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
78 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
78 bf1bc2f45e834c75404d0ddab57d53beab56e2f8
79 bf1bc2f45e834c75404d0ddab57d53beab56e2f8
79 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
80 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
General Comments 0
You need to be logged in to leave comments. Login now