Mercurial > hg
changeset 22079:5dcc58649b1a
phase: extract the phaseroots serialization in a dedicated method
In most case, the file creation logic will be handled by the
transaction itself. The write method has to stay around for the case
where the repository is modified outside a transaction (strip).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 07 Aug 2014 14:41:00 -0700 |
parents | feb4797c676e |
children | 37f46575d9c2 |
files | mercurial/phases.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/phases.py Thu Aug 07 14:40:02 2014 -0700 +++ b/mercurial/phases.py Thu Aug 07 14:41:00 2014 -0700 @@ -196,11 +196,14 @@ return f = self.opener('phaseroots', 'w', atomictemp=True) try: - for phase, roots in enumerate(self.phaseroots): - for h in roots: - f.write('%i %s\n' % (phase, hex(h))) + self._write(f) finally: f.close() + + def _write(self, fp): + for phase, roots in enumerate(self.phaseroots): + for h in roots: + fp.write('%i %s\n' % (phase, hex(h))) self.dirty = False def _updateroots(self, phase, newroots):