Show More
@@ -147,15 +147,15 b' class appendopener(object):' | |||
|
147 | 147 | # not mixed up together. |
|
148 | 148 | |
|
149 | 149 | class appendchangelog(changelog.changelog, appendopener): |
|
150 |
def __init__(self, opener |
|
|
150 | def __init__(self, opener): | |
|
151 | 151 | appendopener.__init__(self, opener) |
|
152 |
changelog.changelog.__init__(self, self |
|
|
152 | changelog.changelog.__init__(self, self) | |
|
153 | 153 | def checkinlinesize(self, fp, tr): |
|
154 | 154 | return |
|
155 | 155 | |
|
156 | 156 | class appendmanifest(manifest.manifest, appendopener): |
|
157 |
def __init__(self, opener |
|
|
157 | def __init__(self, opener): | |
|
158 | 158 | appendopener.__init__(self, opener) |
|
159 |
manifest.manifest.__init__(self, self |
|
|
159 | manifest.manifest.__init__(self, self) | |
|
160 | 160 | def checkinlinesize(self, fp, tr): |
|
161 | 161 | return |
@@ -27,8 +27,8 b' def _string_unescape(text):' | |||
|
27 | 27 | return text.decode('string_escape') |
|
28 | 28 | |
|
29 | 29 | class changelog(revlog): |
|
30 |
def __init__(self, opener |
|
|
31 |
revlog.__init__(self, opener, "00changelog.i" |
|
|
30 | def __init__(self, opener): | |
|
31 | revlog.__init__(self, opener, "00changelog.i") | |
|
32 | 32 | |
|
33 | 33 | def decode_extra(self, text): |
|
34 | 34 | extra = {} |
@@ -666,7 +666,7 b' def copy(ui, repo, *pats, **opts):' | |||
|
666 | 666 | |
|
667 | 667 | def debugancestor(ui, index, rev1, rev2): |
|
668 | 668 | """find the ancestor revision of two revisions in a given index""" |
|
669 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), index |
|
|
669 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), index) | |
|
670 | 670 | a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
|
671 | 671 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
672 | 672 | |
@@ -794,9 +794,8 b' def debugstate(ui, repo):' | |||
|
794 | 794 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
795 | 795 | |
|
796 | 796 | def debugdata(ui, file_, rev): |
|
797 |
"""dump the contents of a |
|
|
798 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), | |
|
799 | file_[:-2] + ".i", 0) | |
|
797 | """dump the contents of a data file revision""" | |
|
798 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") | |
|
800 | 799 | try: |
|
801 | 800 | ui.write(r.revision(r.lookup(rev))) |
|
802 | 801 | except KeyError: |
@@ -816,7 +815,7 b' def debugdate(ui, date, range=None, **op' | |||
|
816 | 815 | |
|
817 | 816 | def debugindex(ui, file_): |
|
818 | 817 | """dump the contents of an index file""" |
|
819 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_ |
|
|
818 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) | |
|
820 | 819 | ui.write(" rev offset length base linkrev" + |
|
821 | 820 | " nodeid p1 p2\n") |
|
822 | 821 | for i in xrange(r.count()): |
@@ -828,7 +827,7 b' def debugindex(ui, file_):' | |||
|
828 | 827 | |
|
829 | 828 | def debugindexdot(ui, file_): |
|
830 | 829 | """dump an index DAG as a .dot file""" |
|
831 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_ |
|
|
830 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) | |
|
832 | 831 | ui.write("digraph G {\n") |
|
833 | 832 | for i in xrange(r.count()): |
|
834 | 833 | node = r.node(i) |
@@ -9,10 +9,9 b' from revlog import *' | |||
|
9 | 9 | import os |
|
10 | 10 | |
|
11 | 11 | class filelog(revlog): |
|
12 |
def __init__(self, opener, path |
|
|
12 | def __init__(self, opener, path): | |
|
13 | 13 | revlog.__init__(self, opener, |
|
14 |
"/".join(("data", self.encodedir(path + ".i"))) |
|
|
15 | defversion) | |
|
14 | "/".join(("data", self.encodedir(path + ".i")))) | |
|
16 | 15 | |
|
17 | 16 | # This avoids a collision between a file named foo and a dir named |
|
18 | 17 | # foo.i or foo.d |
@@ -1018,7 +1018,7 b' class hgweb(object):' | |||
|
1018 | 1018 | def do_capabilities(self, req): |
|
1019 | 1019 | caps = ['lookup', 'changegroupsubset'] |
|
1020 | 1020 | if self.configbool('server', 'uncompressed'): |
|
1021 |
caps.append('stream=%d' % self.repo. |
|
|
1021 | caps.append('stream=%d' % self.repo.changelog.version) | |
|
1022 | 1022 | # XXX: make configurable and/or share code with do_unbundle: |
|
1023 | 1023 | unbundleversions = ['HG10GZ', 'HG10BZ', 'HG10UN'] |
|
1024 | 1024 | if unbundleversions: |
@@ -88,34 +88,14 b' class localrepository(repo.repository):' | |||
|
88 | 88 | except IOError: |
|
89 | 89 | pass |
|
90 | 90 | |
|
91 | v = self.ui.configrevlog() | |
|
92 | self.revlogversion = int(v.get('format', revlog.REVLOG_DEFAULT_FORMAT)) | |
|
93 | self.revlogv1 = self.revlogversion != revlog.REVLOGV0 | |
|
94 | fl = v.get('flags', None) | |
|
95 | flags = 0 | |
|
96 | if fl != None: | |
|
97 | for x in fl.split(): | |
|
98 | flags |= revlog.flagstr(x) | |
|
99 | elif self.revlogv1: | |
|
100 | flags = revlog.REVLOG_DEFAULT_FLAGS | |
|
101 | ||
|
102 | v = self.revlogversion | flags | |
|
103 | self.manifest = manifest.manifest(self.sopener, v) | |
|
104 | self.changelog = changelog.changelog(self.sopener, v) | |
|
91 | self.changelog = changelog.changelog(self.sopener) | |
|
92 | self.sopener.defversion = self.changelog.version | |
|
93 | self.manifest = manifest.manifest(self.sopener) | |
|
105 | 94 | |
|
106 | 95 | fallback = self.ui.config('ui', 'fallbackencoding') |
|
107 | 96 | if fallback: |
|
108 | 97 | util._fallbackencoding = fallback |
|
109 | 98 | |
|
110 | # the changelog might not have the inline index flag | |
|
111 | # on. If the format of the changelog is the same as found in | |
|
112 | # .hgrc, apply any flags found in the .hgrc as well. | |
|
113 | # Otherwise, just version from the changelog | |
|
114 | v = self.changelog.version | |
|
115 | if v == self.revlogversion: | |
|
116 | v |= flags | |
|
117 | self.revlogversion = v | |
|
118 | ||
|
119 | 99 | self.tagscache = None |
|
120 | 100 | self.branchcache = None |
|
121 | 101 | self.nodetagscache = None |
@@ -493,7 +473,7 b' class localrepository(repo.repository):' | |||
|
493 | 473 | def file(self, f): |
|
494 | 474 | if f[0] == '/': |
|
495 | 475 | f = f[1:] |
|
496 |
return filelog.filelog(self.sopener, f |
|
|
476 | return filelog.filelog(self.sopener, f) | |
|
497 | 477 | |
|
498 | 478 | def changectx(self, changeid=None): |
|
499 | 479 | return context.changectx(self, changeid) |
@@ -1804,9 +1784,7 b' class localrepository(repo.repository):' | |||
|
1804 | 1784 | # inconsistent view |
|
1805 | 1785 | cl = None |
|
1806 | 1786 | try: |
|
1807 |
cl = appendfile.appendchangelog(self.sopener |
|
|
1808 | self.changelog.version) | |
|
1809 | ||
|
1787 | cl = appendfile.appendchangelog(self.sopener) | |
|
1810 | 1788 | oldheads = len(cl.heads()) |
|
1811 | 1789 | |
|
1812 | 1790 | # pull off the changeset group |
@@ -1848,8 +1826,7 b' class localrepository(repo.repository):' | |||
|
1848 | 1826 | cl.cleanup() |
|
1849 | 1827 | |
|
1850 | 1828 | # make changelog see real files again |
|
1851 |
self.changelog = changelog.changelog(self.sopener |
|
|
1852 | self.changelog.version) | |
|
1829 | self.changelog = changelog.changelog(self.sopener) | |
|
1853 | 1830 | self.changelog.checkinlinesize(tr) |
|
1854 | 1831 | |
|
1855 | 1832 | newheads = len(self.changelog.heads()) |
@@ -35,10 +35,10 b' class manifestdict(dict):' | |||
|
35 | 35 | return manifestdict(dict.copy(self), dict.copy(self._flags)) |
|
36 | 36 | |
|
37 | 37 | class manifest(revlog): |
|
38 |
def __init__(self, opener |
|
|
38 | def __init__(self, opener): | |
|
39 | 39 | self.mapcache = None |
|
40 | 40 | self.listcache = None |
|
41 |
revlog.__init__(self, opener, "00manifest.i" |
|
|
41 | revlog.__init__(self, opener, "00manifest.i") | |
|
42 | 42 | |
|
43 | 43 | def parselines(self, lines): |
|
44 | 44 | for l in lines.splitlines(1): |
@@ -311,7 +311,7 b' class revlog(object):' | |||
|
311 | 311 | remove data, and can use some simple techniques to avoid the need |
|
312 | 312 | for locking while reading. |
|
313 | 313 | """ |
|
314 |
def __init__(self, opener, indexfile |
|
|
314 | def __init__(self, opener, indexfile): | |
|
315 | 315 | """ |
|
316 | 316 | create a revlog object |
|
317 | 317 | |
@@ -325,7 +325,9 b' class revlog(object):' | |||
|
325 | 325 | self.indexstat = None |
|
326 | 326 | self.cache = None |
|
327 | 327 | self.chunkcache = None |
|
328 | self.defversion = defversion | |
|
328 | self.defversion=REVLOG_DEFAULT_VERSION | |
|
329 | if hasattr(opener, "defversion"): | |
|
330 | self.defversion = opener.defversion | |
|
329 | 331 | self.load() |
|
330 | 332 | |
|
331 | 333 | def load(self): |
@@ -73,7 +73,7 b' class sshserver(object):' | |||
|
73 | 73 | |
|
74 | 74 | caps = ['unbundle', 'lookup', 'changegroupsubset'] |
|
75 | 75 | if self.ui.configbool('server', 'uncompressed'): |
|
76 |
caps.append('stream=%d' % self.repo. |
|
|
76 | caps.append('stream=%d' % self.repo.changelog.version) | |
|
77 | 77 | self.respond("capabilities: %s\n" % (' '.join(caps),)) |
|
78 | 78 | |
|
79 | 79 | def do_lock(self): |
@@ -32,7 +32,6 b' class statichttprepository(localrepo.loc' | |||
|
32 | 32 | def __init__(self, ui, path): |
|
33 | 33 | self._url = path |
|
34 | 34 | self.ui = ui |
|
35 | self.revlogversion = 0 | |
|
36 | 35 | |
|
37 | 36 | self.path = (path + "/.hg") |
|
38 | 37 | self.opener = opener(self.path) |
@@ -325,12 +325,6 b' class ui(object):' | |||
|
325 | 325 | result.append(os.path.expanduser(value)) |
|
326 | 326 | return result |
|
327 | 327 | |
|
328 | def configrevlog(self): | |
|
329 | result = {} | |
|
330 | for key, value in self.configitems("revlog"): | |
|
331 | result[key.lower()] = value | |
|
332 | return result | |
|
333 | ||
|
334 | 328 | def username(self): |
|
335 | 329 | """Return default username to be used in commits. |
|
336 | 330 |
@@ -39,8 +39,8 b' def verify(repo):' | |||
|
39 | 39 | elif revlogv1: |
|
40 | 40 | warn(_("warning: `%s' uses revlog format 0") % name) |
|
41 | 41 | |
|
42 |
revlogv1 = repo. |
|
|
43 |
if repo.ui.verbose or |
|
|
42 | revlogv1 = repo.changelog.version != revlog.REVLOGV0 | |
|
43 | if repo.ui.verbose or not revlogv1: | |
|
44 | 44 | repo.ui.status(_("repository uses revlog format %d\n") % |
|
45 | 45 | (revlogv1 and 1 or 0)) |
|
46 | 46 |
General Comments 0
You need to be logged in to leave comments.
Login now