hgext/mq.py
changeset 27827 a5b168953013
parent 27651 07fc2f2134ba
child 27828 823069f73ff9
equal deleted inserted replaced
27826:f087b7095381 27827:a5b168953013
  1166         match = scmutil.matchfiles(repo, commitfiles)
  1166         match = scmutil.matchfiles(repo, commitfiles)
  1167         if len(repo[None].parents()) > 1:
  1167         if len(repo[None].parents()) > 1:
  1168             raise error.Abort(_('cannot manage merge changesets'))
  1168             raise error.Abort(_('cannot manage merge changesets'))
  1169         self.checktoppatch(repo)
  1169         self.checktoppatch(repo)
  1170         insert = self.fullseriesend()
  1170         insert = self.fullseriesend()
  1171         wlock = repo.wlock()
  1171         with repo.wlock():
  1172         try:
       
  1173             try:
  1172             try:
  1174                 # if patch file write fails, abort early
  1173                 # if patch file write fails, abort early
  1175                 p = self.opener(patchfn, "w")
  1174                 p = self.opener(patchfn, "w")
  1176             except IOError as e:
  1175             except IOError as e:
  1177                 raise error.Abort(_('cannot write patch "%s": %s')
  1176                 raise error.Abort(_('cannot write patch "%s": %s')
  1237                     os.unlink(patchpath)
  1236                     os.unlink(patchpath)
  1238                 except OSError:
  1237                 except OSError:
  1239                     self.ui.warn(_('error unlinking %s\n') % patchpath)
  1238                     self.ui.warn(_('error unlinking %s\n') % patchpath)
  1240                 raise
  1239                 raise
  1241             self.removeundo(repo)
  1240             self.removeundo(repo)
  1242         finally:
       
  1243             release(wlock)
       
  1244 
  1241 
  1245     def isapplied(self, patch):
  1242     def isapplied(self, patch):
  1246         """returns (index, rev, patch)"""
  1243         """returns (index, rev, patch)"""
  1247         for i, a in enumerate(self.applied):
  1244         for i, a in enumerate(self.applied):
  1248             if a.name == patch:
  1245             if a.name == patch: