##// END OF EJS Templates
revlog: always enable generaldelta on version 2 revlogs...
Gregory Szorc -
r41238:e7a2cc84 default
parent child Browse files
Show More
@@ -295,8 +295,9 b' class changelog(revlog.revlog):'
295 295 revlog.revlog.__init__(self, opener, indexfile, datafile=datafile,
296 296 checkambig=True, mmaplargeindex=True)
297 297
298 if self._initempty:
299 # changelogs don't benefit from generaldelta
298 if self._initempty and (self.version & 0xFFFF == revlog.REVLOGV1):
299 # changelogs don't benefit from generaldelta.
300
300 301 self.version &= ~revlog.FLAG_GENERALDELTA
301 302 self._generaldelta = False
302 303
@@ -66,8 +66,6 b' Version 2 revlogs have the following fla'
66 66
67 67 0
68 68 Store revision data inline.
69 1
70 Generaldelta encoding.
71 69
72 70 The following header values are common:
73 71
@@ -159,8 +157,10 b' Version 2 Format'
159 157
160 158 (In development. Format not finalized or stable.)
161 159
162 Version 2 is currently identical to version 1. This will obviously
163 change.
160 Version 2 is identical to version 2 with the following differences.
161
162 There is no dedicated *generaldelta* revlog format flag. Instead,
163 the feature is implied enabled by default.
164 164
165 165 Delta Chains
166 166 ============
@@ -363,7 +363,7 b' class locallegacypeer(localpeer):'
363 363
364 364 # Increment the sub-version when the revlog v2 format changes to lock out old
365 365 # clients.
366 REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'
366 REVLOGV2_REQUIREMENT = 'exp-revlogv2.1'
367 367
368 368 # A repository with the sparserevlog feature will have delta chains that
369 369 # can spread over a larger span. Sparse reading cuts these large spans into
@@ -387,8 +387,7 b' class revlog(object):'
387 387 opts = getattr(opener, 'options', {}) or {}
388 388
389 389 if 'revlogv2' in opts:
390 # version 2 revlogs always use generaldelta.
391 versionflags = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
390 versionflags = REVLOGV2 | FLAG_INLINE_DATA
392 391 elif 'revlogv1' in opts:
393 392 versionflags = REVLOGV1 | FLAG_INLINE_DATA
394 393 if 'generaldelta' in opts:
@@ -451,25 +450,38 b' class revlog(object):'
451 450 raise
452 451
453 452 self.version = versionflags
454 self._inline = versionflags & FLAG_INLINE_DATA
455 self._generaldelta = versionflags & FLAG_GENERALDELTA
453
456 454 flags = versionflags & ~0xFFFF
457 455 fmt = versionflags & 0xFFFF
456
458 457 if fmt == REVLOGV0:
459 458 if flags:
460 459 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
461 460 'revlog %s') %
462 461 (flags >> 16, fmt, self.indexfile))
462
463 self._inline = False
464 self._generaldelta = False
465
463 466 elif fmt == REVLOGV1:
464 467 if flags & ~REVLOGV1_FLAGS:
465 468 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
466 469 'revlog %s') %
467 470 (flags >> 16, fmt, self.indexfile))
471
472 self._inline = versionflags & FLAG_INLINE_DATA
473 self._generaldelta = versionflags & FLAG_GENERALDELTA
474
468 475 elif fmt == REVLOGV2:
469 476 if flags & ~REVLOGV2_FLAGS:
470 477 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
471 478 'revlog %s') %
472 479 (flags >> 16, fmt, self.indexfile))
480
481 self._inline = versionflags & FLAG_INLINE_DATA
482 # generaldelta implied by version 2 revlogs.
483 self._generaldelta = True
484
473 485 else:
474 486 raise error.RevlogError(_('unknown version (%d) in revlog %s') %
475 487 (fmt, self.indexfile))
@@ -20,13 +20,15 b' REVLOGV1 = 1'
20 20 # Dummy value until file format is finalized.
21 21 # Reminder: change the bounds check in revlog.__init__ when this is changed.
22 22 REVLOGV2 = 0xDEAD
23 # Shared across v1 and v2.
23 24 FLAG_INLINE_DATA = (1 << 16)
25 # Only used by v1, implied by v2.
24 26 FLAG_GENERALDELTA = (1 << 17)
25 27 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
26 28 REVLOG_DEFAULT_FORMAT = REVLOGV1
27 29 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
28 30 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
29 REVLOGV2_FLAGS = REVLOGV1_FLAGS
31 REVLOGV2_FLAGS = FLAG_INLINE_DATA
30 32
31 33 # revlog index flags
32 34
@@ -22,7 +22,7 b' Can create and open repo with revlog v2 '
22 22 $ cd empty-repo
23 23 $ cat .hg/requires
24 24 dotencode
25 exp-revlogv2.0
25 exp-revlogv2.1
26 26 fncache
27 27 sparserevlog
28 28 store
@@ -54,7 +54,7 b' Writing a simple revlog v2 works'
54 54 date: Thu Jan 01 00:00:00 1970 +0000
55 55 summary: initial
56 56
57 Header written as expected (changelog always disables generaldelta)
57 Header written as expected
58 58
59 59 $ f --hexdump --bytes 4 .hg/store/00changelog.i
60 60 .hg/store/00changelog.i:
@@ -62,4 +62,4 b' Header written as expected (changelog al'
62 62
63 63 $ f --hexdump --bytes 4 .hg/store/data/foo.i
64 64 .hg/store/data/foo.i:
65 0000: 00 03 de ad |....|
65 0000: 00 01 de ad |....|
General Comments 0
You need to be logged in to leave comments. Login now