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