Show More
@@ -7,10 +7,10 | |||||
7 |
|
7 | |||
8 | from node import hex, nullid, nullrev, short |
|
8 | from node import hex, nullid, nullrev, short | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 |
import os, sys, errno, re, |
|
10 | import os, sys, errno, re, tempfile | |
11 | import util, scmutil, templater, patch, error, templatekw, wdutil |
|
11 | import util, scmutil, templater, patch, error, templatekw, wdutil | |
12 | import match as matchmod |
|
12 | import match as matchmod | |
13 |
import |
|
13 | import revset, subrepo | |
14 |
|
14 | |||
15 | expandpats = wdutil.expandpats |
|
15 | expandpats = wdutil.expandpats | |
16 | match = wdutil.match |
|
16 | match = wdutil.match |
@@ -21,7 +21,7 propertycache = util.propertycache | |||||
21 | class localrepository(repo.repository): |
|
21 | class localrepository(repo.repository): | |
22 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey', |
|
22 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey', | |
23 | 'known', 'getbundle')) |
|
23 | 'known', 'getbundle')) | |
24 | supportedformats = set(('revlogv1',)) |
|
24 | supportedformats = set(('revlogv1', 'generaldelta')) | |
25 | supported = supportedformats | set(('store', 'fncache', 'shared', |
|
25 | supported = supportedformats | set(('store', 'fncache', 'shared', | |
26 | 'dotencode')) |
|
26 | 'dotencode')) | |
27 |
|
27 | |||
@@ -61,6 +61,8 class localrepository(repo.repository): | |||||
61 | '\0\0\0\2' # represents revlogv2 |
|
61 | '\0\0\0\2' # represents revlogv2 | |
62 | ' dummy changelog to prevent using the old repo layout' |
|
62 | ' dummy changelog to prevent using the old repo layout' | |
63 | ) |
|
63 | ) | |
|
64 | if self.ui.configbool('format', 'generaldelta', False): | |||
|
65 | requirements.append("generaldelta") | |||
64 | else: |
|
66 | else: | |
65 | raise error.RepoError(_("repository %s not found") % path) |
|
67 | raise error.RepoError(_("repository %s not found") % path) | |
66 | elif create: |
|
68 | elif create: | |
@@ -115,6 +117,8 class localrepository(repo.repository): | |||||
115 | def _applyrequirements(self, requirements): |
|
117 | def _applyrequirements(self, requirements): | |
116 | self.requirements = requirements |
|
118 | self.requirements = requirements | |
117 | self.sopener.options = {} |
|
119 | self.sopener.options = {} | |
|
120 | if 'generaldelta' in requirements: | |||
|
121 | self.sopener.options['generaldelta'] = 1 | |||
118 |
|
122 | |||
119 | def _writerequirements(self): |
|
123 | def _writerequirements(self): | |
120 | reqfile = self.opener("requires", "w") |
|
124 | reqfile = self.opener("requires", "w") | |
@@ -700,7 +704,7 class localrepository(repo.repository): | |||||
700 | if os.path.exists(bkname): |
|
704 | if os.path.exists(bkname): | |
701 | util.copyfile(bkname, self.join('journal.bookmarks')) |
|
705 | util.copyfile(bkname, self.join('journal.bookmarks')) | |
702 | else: |
|
706 | else: | |
703 |
self.opener('journal.bookmarks', ' |
|
707 | self.opener.write('journal.bookmarks', '') | |
704 |
|
708 | |||
705 | return (self.sjoin('journal'), self.join('journal.dirstate'), |
|
709 | return (self.sjoin('journal'), self.join('journal.dirstate'), | |
706 | self.join('journal.branch'), self.join('journal.desc'), |
|
710 | self.join('journal.branch'), self.join('journal.desc'), |
@@ -226,10 +226,13 class revlog(object): | |||||
226 | self._nodepos = None |
|
226 | self._nodepos = None | |
227 |
|
227 | |||
228 | v = REVLOG_DEFAULT_VERSION |
|
228 | v = REVLOG_DEFAULT_VERSION | |
229 |
if hasattr(opener, 'options') |
|
229 | if hasattr(opener, 'options'): | |
|
230 | if 'defversion' in opener.options: | |||
230 | v = opener.options['defversion'] |
|
231 | v = opener.options['defversion'] | |
231 | if v & REVLOGNG: |
|
232 | if v & REVLOGNG: | |
232 | v |= REVLOGNGINLINEDATA |
|
233 | v |= REVLOGNGINLINEDATA | |
|
234 | if v & REVLOGNG and 'generaldelta' in opener.options: | |||
|
235 | v |= REVLOGGENERALDELTA | |||
233 |
|
236 | |||
234 | i = '' |
|
237 | i = '' | |
235 | try: |
|
238 | try: | |
@@ -1003,10 +1006,14 class revlog(object): | |||||
1003 | l = len(data[1]) + len(data[0]) |
|
1006 | l = len(data[1]) + len(data[0]) | |
1004 | basecache = self._basecache |
|
1007 | basecache = self._basecache | |
1005 | if basecache and basecache[0] == rev: |
|
1008 | if basecache and basecache[0] == rev: | |
1006 | base = basecache[1] |
|
1009 | chainbase = basecache[1] | |
1007 | else: |
|
1010 | else: | |
1008 | base = self.chainbase(rev) |
|
1011 | chainbase = self.chainbase(rev) | |
1009 | dist = l + offset - self.start(base) |
|
1012 | dist = l + offset - self.start(chainbase) | |
|
1013 | if self._generaldelta: | |||
|
1014 | base = rev | |||
|
1015 | else: | |||
|
1016 | base = chainbase | |||
1010 | return dist, l, data, base |
|
1017 | return dist, l, data, base | |
1011 |
|
1018 | |||
1012 | curr = len(self) |
|
1019 | curr = len(self) | |
@@ -1019,6 +1026,9 class revlog(object): | |||||
1019 |
|
1026 | |||
1020 | # should we try to build a delta? |
|
1027 | # should we try to build a delta? | |
1021 | if prev != nullrev: |
|
1028 | if prev != nullrev: | |
|
1029 | if self._generaldelta: | |||
|
1030 | d = builddelta(p1r) | |||
|
1031 | else: | |||
1022 | d = builddelta(prev) |
|
1032 | d = builddelta(prev) | |
1023 | dist, l, data, base = d |
|
1033 | dist, l, data, base = d | |
1024 |
|
1034 |
General Comments 0
You need to be logged in to leave comments.
Login now