mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
dirstate: write branch file atomically
This commit is contained in:
parent
5db73f60d8
commit
62440b9ac3
@ -244,7 +244,11 @@ class dirstate(object):
|
|||||||
if branch in ['tip', '.', 'null']:
|
if branch in ['tip', '.', 'null']:
|
||||||
raise util.Abort(_('the name \'%s\' is reserved') % branch)
|
raise util.Abort(_('the name \'%s\' is reserved') % branch)
|
||||||
self._branch = encoding.fromlocal(branch)
|
self._branch = encoding.fromlocal(branch)
|
||||||
self._opener.write("branch", self._branch + '\n')
|
f = self._opener('branch', 'w', atomictemp=True)
|
||||||
|
try:
|
||||||
|
f.write(self._branch + '\n')
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
def _read(self):
|
def _read(self):
|
||||||
self._map = {}
|
self._map = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user