Show More
@@ -666,6 +666,14 b' Example for ``~/.hgrc``::' | |||||
666 | ``format`` |
|
666 | ``format`` | |
667 | ---------- |
|
667 | ---------- | |
668 |
|
668 | |||
|
669 | ``usegeneraldelta`` | |||
|
670 | Enable or disable the "generaldelta" repository format which improves | |||
|
671 | repository compression by allowing "revlog" to store delta against arbitrary | |||
|
672 | revision instead of the previous stored one. This provides significant | |||
|
673 | improvement for repositories with branches. Disabling this option ensures that | |||
|
674 | the on-disk format of newly created repository will be compatible with | |||
|
675 | Mercurial before version 1.9. | |||
|
676 | ||||
669 | ``usestore`` |
|
677 | ``usestore`` | |
670 | Enable or disable the "store" repository format which improves |
|
678 | Enable or disable the "store" repository format which improves | |
671 | compatibility with systems that fold case or otherwise mangle |
|
679 | compatibility with systems that fold case or otherwise mangle |
@@ -358,6 +358,7 b' class localrepository(object):' | |||||
358 | aggressivemergedeltas = self.ui.configbool('format', |
|
358 | aggressivemergedeltas = self.ui.configbool('format', | |
359 | 'aggressivemergedeltas', False) |
|
359 | 'aggressivemergedeltas', False) | |
360 | self.svfs.options['aggressivemergedeltas'] = aggressivemergedeltas |
|
360 | self.svfs.options['aggressivemergedeltas'] = aggressivemergedeltas | |
|
361 | self.svfs.options['lazydeltabase'] = not scmutil.gddeltaconfig(self.ui) | |||
361 |
|
362 | |||
362 | def _writerequirements(self): |
|
363 | def _writerequirements(self): | |
363 | scmutil.writerequires(self.vfs, self.requirements) |
|
364 | scmutil.writerequires(self.vfs, self.requirements) |
@@ -230,6 +230,7 b' class revlog(object):' | |||||
230 | self._maxchainlen = opts['maxchainlen'] |
|
230 | self._maxchainlen = opts['maxchainlen'] | |
231 | if 'aggressivemergedeltas' in opts: |
|
231 | if 'aggressivemergedeltas' in opts: | |
232 | self._aggressivemergedeltas = opts['aggressivemergedeltas'] |
|
232 | self._aggressivemergedeltas = opts['aggressivemergedeltas'] | |
|
233 | self._lazydeltabase = bool(opts.get('lazydeltabase', False)) | |||
233 |
|
234 | |||
234 | if self._chunkcachesize <= 0: |
|
235 | if self._chunkcachesize <= 0: | |
235 | raise RevlogError(_('revlog chunk cache size %r is not greater ' |
|
236 | raise RevlogError(_('revlog chunk cache size %r is not greater ' | |
@@ -1370,7 +1371,11 b' class revlog(object):' | |||||
1370 |
|
1371 | |||
1371 | # should we try to build a delta? |
|
1372 | # should we try to build a delta? | |
1372 | if prev != nullrev: |
|
1373 | if prev != nullrev: | |
1373 | if self._generaldelta: |
|
1374 | if cachedelta and self._generaldelta and self._lazydeltabase: | |
|
1375 | # Assume what we received from the server is a good choice | |||
|
1376 | # build delta will reuse the cache | |||
|
1377 | d = builddelta(cachedelta[0]) | |||
|
1378 | elif self._generaldelta: | |||
1374 | if p2r != nullrev and self._aggressivemergedeltas: |
|
1379 | if p2r != nullrev and self._aggressivemergedeltas: | |
1375 | d = builddelta(p1r) |
|
1380 | d = builddelta(p1r) | |
1376 | d2 = builddelta(p2r) |
|
1381 | d2 = builddelta(p2r) |
@@ -1173,8 +1173,13 b' def wlocksub(repo, cmd, *args, **kwargs)' | |||||
1173 |
|
1173 | |||
1174 | def gdinitconfig(ui): |
|
1174 | def gdinitconfig(ui): | |
1175 | """helper function to know if a repo should be created as general delta |
|
1175 | """helper function to know if a repo should be created as general delta | |
|
1176 | """ | |||
|
1177 | # experimental config: format.generaldelta | |||
|
1178 | return (ui.configbool('format', 'generaldelta', False) | |||
|
1179 | or ui.configbool('format', 'usegeneraldelta', False)) | |||
1176 |
|
1180 | |||
1177 | This currently depends on a single config option but this will get more |
|
1181 | def gddeltaconfig(ui): | |
1178 | complicated soon.""" |
|
1182 | """helper function to know if incoming delta should be optimised | |
|
1183 | """ | |||
1179 | # experimental config: format.generaldelta |
|
1184 | # experimental config: format.generaldelta | |
1180 | return ui.configbool('format', 'generaldelta', False) |
|
1185 | return ui.configbool('format', 'generaldelta', False) |
@@ -71,10 +71,55 b' commit.' | |||||
71 |
|
71 | |||
72 | $ cd .. |
|
72 | $ cd .. | |
73 |
|
73 | |||
|
74 | Test "usegeneraldelta" config | |||
|
75 | (repo are general delta, but incoming bundle are not re-deltified) | |||
|
76 | ||||
|
77 | delta coming from the server base delta server are not recompressed. | |||
|
78 | (also include the aggressive version for comparison) | |||
|
79 | ||||
|
80 | $ hg clone repo --pull --config format.usegeneraldelta=1 usegd | |||
|
81 | requesting all changes | |||
|
82 | adding changesets | |||
|
83 | adding manifests | |||
|
84 | adding file changes | |||
|
85 | added 4 changesets with 5 changes to 2 files (+2 heads) | |||
|
86 | updating to branch default | |||
|
87 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
88 | $ hg clone repo --pull --config format.generaldelta=1 full | |||
|
89 | requesting all changes | |||
|
90 | adding changesets | |||
|
91 | adding manifests | |||
|
92 | adding file changes | |||
|
93 | added 4 changesets with 5 changes to 2 files (+2 heads) | |||
|
94 | updating to branch default | |||
|
95 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
96 | $ hg -R repo debugindex -m | |||
|
97 | rev offset length base linkrev nodeid p1 p2 | |||
|
98 | 0 0 77 0 0 0273e8a1b972 000000000000 000000000000 | |||
|
99 | 1 77 57 0 1 e0c49f5ef780 0273e8a1b972 000000000000 | |||
|
100 | 2 134 77 2 2 de950093e41b 0273e8a1b972 000000000000 | |||
|
101 | 3 211 57 2 3 db74c7cde4d0 0273e8a1b972 000000000000 | |||
|
102 | $ hg -R usegd debugindex -m | |||
|
103 | rev offset length delta linkrev nodeid p1 p2 | |||
|
104 | 0 0 77 -1 0 0273e8a1b972 000000000000 000000000000 | |||
|
105 | 1 77 57 0 1 e0c49f5ef780 0273e8a1b972 000000000000 | |||
|
106 | 2 134 77 -1 2 de950093e41b 0273e8a1b972 000000000000 | |||
|
107 | 3 211 57 2 3 db74c7cde4d0 0273e8a1b972 000000000000 | |||
|
108 | $ hg -R full debugindex -m | |||
|
109 | rev offset length delta linkrev nodeid p1 p2 | |||
|
110 | 0 0 77 -1 0 0273e8a1b972 000000000000 000000000000 | |||
|
111 | 1 77 57 0 1 e0c49f5ef780 0273e8a1b972 000000000000 | |||
|
112 | 2 134 57 0 2 de950093e41b 0273e8a1b972 000000000000 | |||
|
113 | 3 191 57 0 3 db74c7cde4d0 0273e8a1b972 000000000000 | |||
|
114 | ||||
74 | Test format.aggressivemergedeltas |
|
115 | Test format.aggressivemergedeltas | |
75 |
|
116 | |||
76 | $ hg init --config format.generaldelta=1 aggressive |
|
117 | $ hg init --config format.generaldelta=1 aggressive | |
77 | $ cd aggressive |
|
118 | $ cd aggressive | |
|
119 | $ cat << EOF >> .hg/hgrc | |||
|
120 | > [format] | |||
|
121 | > generaldelta = 1 | |||
|
122 | > EOF | |||
78 | $ touch a b c d e |
|
123 | $ touch a b c d e | |
79 | $ hg commit -Aqm side1 |
|
124 | $ hg commit -Aqm side1 | |
80 | $ hg up -q null |
|
125 | $ hg up -q null |
General Comments 0
You need to be logged in to leave comments.
Login now