##// END OF EJS Templates
mq: use atomictempfiles during patch refresh
Brendan Cully -
r7400:409a9b44 default
parent child Browse files
Show More
@@ -1093,7 +1093,7 b' class queue:'
1093 patchparent = self.qparents(repo, top)
1093 patchparent = self.qparents(repo, top)
1094 ph = self.readheaders(patchfn)
1094 ph = self.readheaders(patchfn)
1095
1095
1096 patchf = self.opener(patchfn, 'r+')
1096 patchf = self.opener(patchfn, 'r')
1097
1097
1098 # if the patch was a git patch, refresh it as a git patch
1098 # if the patch was a git patch, refresh it as a git patch
1099 for line in patchf:
1099 for line in patchf:
@@ -1108,6 +1108,9 b' class queue:'
1108 if newdate:
1108 if newdate:
1109 ph.setdate(newdate)
1109 ph.setdate(newdate)
1110
1110
1111 # only commit new patch when write is complete
1112 patchf = self.opener(patchfn, 'w', atomictemp=True)
1113
1111 patchf.seek(0)
1114 patchf.seek(0)
1112 patchf.truncate()
1115 patchf.truncate()
1113
1116
@@ -1185,7 +1188,7 b' class queue:'
1185 changes=c, opts=self.diffopts())
1188 changes=c, opts=self.diffopts())
1186 for chunk in chunks:
1189 for chunk in chunks:
1187 patchf.write(chunk)
1190 patchf.write(chunk)
1188 patchf.close()
1191 patchf.rename()
1189
1192
1190 repo.dirstate.setparents(*cparents)
1193 repo.dirstate.setparents(*cparents)
1191 copies = {}
1194 copies = {}
@@ -1246,7 +1249,7 b' class queue:'
1246 self.removeundo(repo)
1249 self.removeundo(repo)
1247 else:
1250 else:
1248 self.printdiff(repo, patchparent, fp=patchf)
1251 self.printdiff(repo, patchparent, fp=patchf)
1249 patchf.close()
1252 patchf.rename()
1250 added = repo.status()[1]
1253 added = repo.status()[1]
1251 for a in added:
1254 for a in added:
1252 f = repo.wjoin(a)
1255 f = repo.wjoin(a)
General Comments 0
You need to be logged in to leave comments. Login now