Show More
@@ -1188,65 +1188,79 b' class queue:' | |||||
1188 | changes=c, opts=self.diffopts()) |
|
1188 | changes=c, opts=self.diffopts()) | |
1189 | for chunk in chunks: |
|
1189 | for chunk in chunks: | |
1190 | patchf.write(chunk) |
|
1190 | patchf.write(chunk) | |
1191 | patchf.rename() |
|
|||
1192 |
|
1191 | |||
1193 | repo.dirstate.setparents(*cparents) |
|
1192 | try: | |
1194 | copies = {} |
|
1193 | copies = {} | |
1195 | for dst in a: |
|
1194 | for dst in a: | |
1196 | src = repo.dirstate.copied(dst) |
|
1195 | src = repo.dirstate.copied(dst) | |
1197 | if src is not None: |
|
1196 | if src is not None: | |
1198 | copies.setdefault(src, []).append(dst) |
|
1197 | copies.setdefault(src, []).append(dst) | |
1199 | repo.dirstate.add(dst) |
|
1198 | repo.dirstate.add(dst) | |
1200 | # remember the copies between patchparent and tip |
|
1199 | # remember the copies between patchparent and tip | |
1201 | # this may be slow, so don't do it if we're not tracking copies |
|
1200 | # this may be slow, so don't do it if we're not tracking copies | |
1202 | if self.diffopts().git: |
|
1201 | if self.diffopts().git: | |
1203 | for dst in aaa: |
|
1202 | for dst in aaa: | |
1204 | f = repo.file(dst) |
|
1203 | f = repo.file(dst) | |
1205 | src = f.renamed(man[dst]) |
|
1204 | src = f.renamed(man[dst]) | |
1206 | if src: |
|
1205 | if src: | |
1207 | copies.setdefault(src[0], []).extend(copies.get(dst, [])) |
|
1206 | copies.setdefault(src[0], []).extend(copies.get(dst, [])) | |
1208 | if dst in a: |
|
1207 | if dst in a: | |
1209 | copies[src[0]].append(dst) |
|
1208 | copies[src[0]].append(dst) | |
1210 | # we can't copy a file created by the patch itself |
|
1209 | # we can't copy a file created by the patch itself | |
1211 | if dst in copies: |
|
1210 | if dst in copies: | |
1212 | del copies[dst] |
|
1211 | del copies[dst] | |
1213 | for src, dsts in copies.iteritems(): |
|
1212 | for src, dsts in copies.iteritems(): | |
1214 | for dst in dsts: |
|
1213 | for dst in dsts: | |
1215 | repo.dirstate.copy(src, dst) |
|
1214 | repo.dirstate.copy(src, dst) | |
1216 | for f in r: |
|
1215 | for f in r: | |
1217 | repo.dirstate.remove(f) |
|
1216 | repo.dirstate.remove(f) | |
1218 | # if the patch excludes a modified file, mark that |
|
1217 | # if the patch excludes a modified file, mark that | |
1219 | # file with mtime=0 so status can see it. |
|
1218 | # file with mtime=0 so status can see it. | |
1220 | mm = [] |
|
1219 | mm = [] | |
1221 | for i in xrange(len(m)-1, -1, -1): |
|
1220 | for i in xrange(len(m)-1, -1, -1): | |
1222 | if not matchfn(m[i]): |
|
1221 | if not matchfn(m[i]): | |
1223 | mm.append(m[i]) |
|
1222 | mm.append(m[i]) | |
1224 | del m[i] |
|
1223 | del m[i] | |
1225 | for f in m: |
|
1224 | for f in m: | |
1226 | repo.dirstate.normal(f) |
|
1225 | repo.dirstate.normal(f) | |
1227 | for f in mm: |
|
1226 | for f in mm: | |
1228 | repo.dirstate.normallookup(f) |
|
1227 | repo.dirstate.normallookup(f) | |
1229 | for f in forget: |
|
1228 | for f in forget: | |
1230 | repo.dirstate.forget(f) |
|
1229 | repo.dirstate.forget(f) | |
1231 |
|
1230 | |||
1232 | if not msg: |
|
1231 | if not msg: | |
1233 | if not ph.message: |
|
1232 | if not ph.message: | |
1234 | message = "[mq]: %s\n" % patchfn |
|
1233 | message = "[mq]: %s\n" % patchfn | |
|
1234 | else: | |||
|
1235 | message = "\n".join(ph.message) | |||
1235 | else: |
|
1236 | else: | |
1236 |
message = |
|
1237 | message = msg | |
1237 | else: |
|
1238 | ||
1238 |
|
|
1239 | user = ph.user or changes[1] | |
1239 |
|
1240 | |||
1240 | user = ph.user or changes[1] |
|
1241 | # assumes strip can roll itself back if interrupted | |
|
1242 | repo.dirstate.setparents(*cparents) | |||
|
1243 | self.applied.pop() | |||
|
1244 | self.applied_dirty = 1 | |||
|
1245 | self.strip(repo, top, update=False, | |||
|
1246 | backup='strip') | |||
|
1247 | except: | |||
|
1248 | repo.dirstate.invalidate() | |||
|
1249 | raise | |||
1241 |
|
1250 | |||
1242 | self.applied.pop() |
|
1251 | try: | |
1243 | self.applied_dirty = 1 |
|
1252 | # might be nice to attempt to roll back strip after this | |
1244 | self.strip(repo, top, update=False, |
|
1253 | patchf.rename() | |
1245 | backup='strip') |
|
1254 | n = repo.commit(match.files(), message, user, ph.date, | |
1246 | n = repo.commit(match.files(), message, user, ph.date, |
|
1255 | match=match, force=1) | |
1247 | match=match, force=1) |
|
1256 | self.applied.append(statusentry(revlog.hex(n), patchfn)) | |
1248 | self.applied.append(statusentry(revlog.hex(n), patchfn)) |
|
1257 | except: | |
1249 | self.removeundo(repo) |
|
1258 | ctx = repo[cparents[0]] | |
|
1259 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) | |||
|
1260 | self.save_dirty() | |||
|
1261 | self.ui.warn(_('refresh interrupted while patch was popped! ' | |||
|
1262 | '(revert --all, qpush to recover)\n')) | |||
|
1263 | raise | |||
1250 | else: |
|
1264 | else: | |
1251 | self.printdiff(repo, patchparent, fp=patchf) |
|
1265 | self.printdiff(repo, patchparent, fp=patchf) | |
1252 | patchf.rename() |
|
1266 | patchf.rename() | |
@@ -1267,6 +1281,7 b' class queue:' | |||||
1267 | self.push(repo, force=True) |
|
1281 | self.push(repo, force=True) | |
1268 | finally: |
|
1282 | finally: | |
1269 | del wlock |
|
1283 | del wlock | |
|
1284 | self.removeundo(repo) | |||
1270 |
|
1285 | |||
1271 | def init(self, repo, create=False): |
|
1286 | def init(self, repo, create=False): | |
1272 | if not create and os.path.isdir(self.path): |
|
1287 | if not create and os.path.isdir(self.path): |
General Comments 0
You need to be logged in to leave comments.
Login now