hgext/mq.py
changeset 16705 c2d9ef43ff6c
parent 16699 d947e1da1259
child 16718 3290e24bb3f0
equal deleted inserted replaced
16704:1f3acc30bdfe 16705:c2d9ef43ff6c
   710                 return ret
   710                 return ret
   711             except AbortNoCleanup:
   711             except AbortNoCleanup:
   712                 tr.close()
   712                 tr.close()
   713                 self.savedirty()
   713                 self.savedirty()
   714                 return 2, repo.dirstate.p1()
   714                 return 2, repo.dirstate.p1()
   715             except:
   715             except: # re-raises
   716                 try:
   716                 try:
   717                     tr.abort()
   717                     tr.abort()
   718                 finally:
   718                 finally:
   719                     repo.invalidate()
   719                     repo.invalidate()
   720                     repo.dirstate.invalidate()
   720                     repo.dirstate.invalidate()
  1075                             p.write(chunk)
  1075                             p.write(chunk)
  1076                     p.close()
  1076                     p.close()
  1077                     r = self.qrepo()
  1077                     r = self.qrepo()
  1078                     if r:
  1078                     if r:
  1079                         r[None].add([patchfn])
  1079                         r[None].add([patchfn])
  1080                 except:
  1080                 except: # re-raises
  1081                     repo.rollback()
  1081                     repo.rollback()
  1082                     raise
  1082                     raise
  1083             except Exception:
  1083             except Exception:
  1084                 patchpath = self.join(patchfn)
  1084                 patchpath = self.join(patchfn)
  1085                 try:
  1085                 try:
  1301                 if mergeq:
  1301                 if mergeq:
  1302                     ret = self.mergepatch(repo, mergeq, s, diffopts)
  1302                     ret = self.mergepatch(repo, mergeq, s, diffopts)
  1303                 else:
  1303                 else:
  1304                     ret = self.apply(repo, s, list, all_files=all_files,
  1304                     ret = self.apply(repo, s, list, all_files=all_files,
  1305                                      tobackup=tobackup, check=check)
  1305                                      tobackup=tobackup, check=check)
  1306             except:
  1306             except: # re-raises
  1307                 self.ui.warn(_('cleaning up working directory...'))
  1307                 self.ui.warn(_('cleaning up working directory...'))
  1308                 node = repo.dirstate.p1()
  1308                 node = repo.dirstate.p1()
  1309                 hg.revert(repo, node, None)
  1309                 hg.revert(repo, node, None)
  1310                 # only remove unknown files that we know we touched or
  1310                 # only remove unknown files that we know we touched or
  1311                 # created while patching
  1311                 # created while patching
  1627                 repo.setparents(*cparents)
  1627                 repo.setparents(*cparents)
  1628                 self.applied.pop()
  1628                 self.applied.pop()
  1629                 self.applieddirty = True
  1629                 self.applieddirty = True
  1630                 self.strip(repo, [top], update=False,
  1630                 self.strip(repo, [top], update=False,
  1631                            backup='strip')
  1631                            backup='strip')
  1632             except:
  1632             except: # re-raises
  1633                 repo.dirstate.invalidate()
  1633                 repo.dirstate.invalidate()
  1634                 raise
  1634                 raise
  1635 
  1635 
  1636             try:
  1636             try:
  1637                 # might be nice to attempt to roll back strip after this
  1637                 # might be nice to attempt to roll back strip after this
  1641                 n = newcommit(repo, oldphase, message, user, ph.date,
  1641                 n = newcommit(repo, oldphase, message, user, ph.date,
  1642                               match=match, force=True)
  1642                               match=match, force=True)
  1643                 # only write patch after a successful commit
  1643                 # only write patch after a successful commit
  1644                 patchf.close()
  1644                 patchf.close()
  1645                 self.applied.append(statusentry(n, patchfn))
  1645                 self.applied.append(statusentry(n, patchfn))
  1646             except:
  1646             except: # re-raises
  1647                 ctx = repo[cparents[0]]
  1647                 ctx = repo[cparents[0]]
  1648                 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1648                 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1649                 self.savedirty()
  1649                 self.savedirty()
  1650                 self.ui.warn(_('refresh interrupted while patch was popped! '
  1650                 self.ui.warn(_('refresh interrupted while patch was popped! '
  1651                                '(revert --all, qpush to recover)\n'))
  1651                                '(revert --all, qpush to recover)\n'))