##// END OF EJS Templates
localrepo: use dirstate restorebackup instead of copying dirstate manually...
Mateusz Kwapich -
r29190:e51f3418 default
parent child Browse files
Show More
@@ -1042,13 +1042,9 b' class localrepository(object):'
1042 # transaction running
1042 # transaction running
1043 repo.dirstate.write(None)
1043 repo.dirstate.write(None)
1044 else:
1044 else:
1045 # prevent in-memory changes from being written out at
1046 # the end of outer wlock scope or so
1047 repo.dirstate.invalidate()
1048
1049 # discard all changes (including ones already written
1045 # discard all changes (including ones already written
1050 # out) in this transaction
1046 # out) in this transaction
1051 repo.vfs.rename('journal.dirstate', 'dirstate')
1047 repo.dirstate.restorebackup(None, prefix='journal.')
1052
1048
1053 repo.invalidate(clearfilecache=True)
1049 repo.invalidate(clearfilecache=True)
1054
1050
@@ -1190,7 +1186,7 b' class localrepository(object):'
1190 # prevent dirstateguard from overwriting already restored one
1186 # prevent dirstateguard from overwriting already restored one
1191 dsguard.close()
1187 dsguard.close()
1192
1188
1193 self.vfs.rename('undo.dirstate', 'dirstate')
1189 self.dirstate.restorebackup(None, prefix='undo.')
1194 try:
1190 try:
1195 branch = self.vfs.read('undo.branch')
1191 branch = self.vfs.read('undo.branch')
1196 self.dirstate.setbranch(encoding.tolocal(branch))
1192 self.dirstate.setbranch(encoding.tolocal(branch))
@@ -1199,7 +1195,6 b' class localrepository(object):'
1199 'current branch is still \'%s\'\n')
1195 'current branch is still \'%s\'\n')
1200 % self.dirstate.branch())
1196 % self.dirstate.branch())
1201
1197
1202 self.dirstate.invalidate()
1203 parents = tuple([p.rev() for p in self[None].parents()])
1198 parents = tuple([p.rev() for p in self[None].parents()])
1204 if len(parents) > 1:
1199 if len(parents) > 1:
1205 ui.status(_('working directory now based on '
1200 ui.status(_('working directory now based on '
General Comments 0
You need to be logged in to leave comments. Login now