Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 4258:b11a2fb59cf5
revlog: simplify revlog version handling
- pass the default version as an attribute on the opener
- eliminate config option mess
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 22 Mar 2007 19:52:38 -0500 |
parents | 1b5c38e9d7aa |
children | 0ce23256e454 |
comparison
equal
deleted
inserted
replaced
4257:1b5c38e9d7aa | 4258:b11a2fb59cf5 |
---|---|
309 Both pieces of the revlog are written to in an append-only | 309 Both pieces of the revlog are written to in an append-only |
310 fashion, which means we never need to rewrite a file to insert or | 310 fashion, which means we never need to rewrite a file to insert or |
311 remove data, and can use some simple techniques to avoid the need | 311 remove data, and can use some simple techniques to avoid the need |
312 for locking while reading. | 312 for locking while reading. |
313 """ | 313 """ |
314 def __init__(self, opener, indexfile, defversion=REVLOG_DEFAULT_VERSION): | 314 def __init__(self, opener, indexfile): |
315 """ | 315 """ |
316 create a revlog object | 316 create a revlog object |
317 | 317 |
318 opener is a function that abstracts the file opening operation | 318 opener is a function that abstracts the file opening operation |
319 and can be used to implement COW semantics or the like. | 319 and can be used to implement COW semantics or the like. |
323 self.opener = opener | 323 self.opener = opener |
324 | 324 |
325 self.indexstat = None | 325 self.indexstat = None |
326 self.cache = None | 326 self.cache = None |
327 self.chunkcache = None | 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 self.load() | 331 self.load() |
330 | 332 |
331 def load(self): | 333 def load(self): |
332 v = self.defversion | 334 v = self.defversion |
333 try: | 335 try: |