Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/changelog.py @ 30001:b5e5ddf48bd2
revlog: specify checkambig at writing to avoid file stat ambiguity
This allows revlog-style files to be written out with checkambig=True
easily.
Because avoiding file stat ambiguity is needed only for filecache-ed
manifest and changelog, this patch does:
- use False for default value of checkambig
- focus only on writing changes of index file out
This patch also adds optional argument checkambig to _divert/_delay
for changelog, to safely accept checkambig specified in revlog
layer. But this argument can be fully ignored, because:
- changes are written into other than index file, if name != target
- changes are never written into index file, otherwise
(into pending file by _divert, or into in-memory buffer by _delay)
This is a part of ExactCacheValidationPlan.
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 22 Sep 2016 21:51:58 +0900 |
parents | 2f64e5a6efb8 |
children | 003c41edc5f5 |
comparison
equal
deleted
inserted
replaced
30000:9766d88c2465 | 30001:b5e5ddf48bd2 |
---|---|
122 self.data.append(str(s)) | 122 self.data.append(str(s)) |
123 self.offset += len(s) | 123 self.offset += len(s) |
124 | 124 |
125 def _divertopener(opener, target): | 125 def _divertopener(opener, target): |
126 """build an opener that writes in 'target.a' instead of 'target'""" | 126 """build an opener that writes in 'target.a' instead of 'target'""" |
127 def _divert(name, mode='r'): | 127 def _divert(name, mode='r', checkambig=False): |
128 if name != target: | 128 if name != target: |
129 return opener(name, mode) | 129 return opener(name, mode) |
130 return opener(name + ".a", mode) | 130 return opener(name + ".a", mode) |
131 return _divert | 131 return _divert |
132 | 132 |
133 def _delayopener(opener, target, buf): | 133 def _delayopener(opener, target, buf): |
134 """build an opener that stores chunks in 'buf' instead of 'target'""" | 134 """build an opener that stores chunks in 'buf' instead of 'target'""" |
135 def _delay(name, mode='r'): | 135 def _delay(name, mode='r', checkambig=False): |
136 if name != target: | 136 if name != target: |
137 return opener(name, mode) | 137 return opener(name, mode) |
138 return appender(opener, name, mode, buf) | 138 return appender(opener, name, mode, buf) |
139 return _delay | 139 return _delay |
140 | 140 |