310 analysis. Note: that this must be reliably be set by normal code, but |
311 analysis. Note: that this must be reliably be set by normal code, but |
311 that test, debug, or performance measurement code might not set this to |
312 that test, debug, or performance measurement code might not set this to |
312 accurate value. |
313 accurate value. |
313 """ |
314 """ |
314 self.upperboundcomp = upperboundcomp |
315 self.upperboundcomp = upperboundcomp |
|
316 if not indexfile.endswith(b'.i'): |
|
317 raise error.ProgrammingError( |
|
318 b"revlog's indexfile should end with `.i`" |
|
319 ) |
|
320 if datafile is None: |
|
321 datafile = indexfile[:-2] + b".d" |
|
322 if postfix is not None: |
|
323 datafile = b'%s.%s' % (datafile, postfix) |
|
324 if postfix is not None: |
|
325 indexfile = b'%s.%s' % (indexfile, postfix) |
315 self.indexfile = indexfile |
326 self.indexfile = indexfile |
316 self.datafile = datafile or (indexfile[:-2] + b".d") |
327 self.datafile = datafile |
317 self.nodemap_file = None |
328 self.nodemap_file = None |
|
329 self.postfix = postfix |
318 if persistentnodemap: |
330 if persistentnodemap: |
319 self.nodemap_file = nodemaputil.get_nodemap_file( |
331 self.nodemap_file = nodemaputil.get_nodemap_file( |
320 opener, self.indexfile |
332 opener, self.indexfile |
321 ) |
333 ) |
322 |
334 |
2879 ) |
2891 ) |
2880 |
2892 |
2881 # Rewriting the revlog in place is hard. Our strategy for censoring is |
2893 # Rewriting the revlog in place is hard. Our strategy for censoring is |
2882 # to create a new revlog, copy all revisions to it, then replace the |
2894 # to create a new revlog, copy all revisions to it, then replace the |
2883 # revlogs on transaction close. |
2895 # revlogs on transaction close. |
2884 |
2896 # |
2885 newindexfile = self.indexfile + b'.tmpcensored' |
|
2886 newdatafile = self.datafile + b'.tmpcensored' |
|
2887 |
|
2888 # This is a bit dangerous. We could easily have a mismatch of state. |
2897 # This is a bit dangerous. We could easily have a mismatch of state. |
2889 newrl = revlog( |
2898 newrl = revlog( |
2890 self.opener, |
2899 self.opener, |
2891 target=self.target, |
2900 target=self.target, |
2892 indexfile=newindexfile, |
2901 postfix=b'tmpcensored', |
2893 datafile=newdatafile, |
2902 indexfile=self.indexfile, |
2894 censorable=True, |
2903 censorable=True, |
2895 ) |
2904 ) |
2896 newrl._format_version = self._format_version |
2905 newrl._format_version = self._format_version |
2897 newrl._format_flags = self._format_flags |
2906 newrl._format_flags = self._format_flags |
2898 newrl._generaldelta = self._generaldelta |
2907 newrl._generaldelta = self._generaldelta |