hgext/mq.py
changeset 2822 30f59f4a327e
parent 2804 4b20daa25f15
child 2830 49988d9f0758
equal deleted inserted replaced
2821:a8a7ce1a01a5 2822:30f59f4a327e
   188             raise util.Abort(_("apply failed for patch %s") % patch)
   188             raise util.Abort(_("apply failed for patch %s") % patch)
   189 
   189 
   190         self.ui.warn("patch didn't work out, merging %s\n" % patch)
   190         self.ui.warn("patch didn't work out, merging %s\n" % patch)
   191 
   191 
   192         # apply failed, strip away that rev and merge.
   192         # apply failed, strip away that rev and merge.
   193         hg.update(repo, head, allow=False, force=True, wlock=wlock)
   193         hg.clean(repo, head, wlock=wlock)
   194         self.strip(repo, n, update=False, backup='strip', wlock=wlock)
   194         self.strip(repo, n, update=False, backup='strip', wlock=wlock)
   195 
   195 
   196         c = repo.changelog.read(rev)
   196         c = repo.changelog.read(rev)
   197         ret = hg.update(repo, rev, allow=True, wlock=wlock)
   197         ret = hg.merge(repo, rev, wlock=wlock)
   198         if ret:
   198         if ret:
   199             raise util.Abort(_("update returned %d") % ret)
   199             raise util.Abort(_("update returned %d") % ret)
   200         n = repo.commit(None, c[4], c[1], force=1, wlock=wlock)
   200         n = repo.commit(None, c[4], c[1], force=1, wlock=wlock)
   201         if n == None:
   201         if n == None:
   202             raise util.Abort(_("repo commit failed"))
   202             raise util.Abort(_("repo commit failed"))
   528         if update:
   528         if update:
   529             (c, a, r, d, u) = repo.changes(None, None)
   529             (c, a, r, d, u) = repo.changes(None, None)
   530             if c or a or d or r:
   530             if c or a or d or r:
   531                 raise util.Abort(_("local changes found"))
   531                 raise util.Abort(_("local changes found"))
   532             urev = self.qparents(repo, rev)
   532             urev = self.qparents(repo, rev)
   533             hg.update(repo, urev, allow=False, force=True, wlock=wlock)
   533             hg.clean(repo, urev, wlock=wlock)
   534             repo.dirstate.write()
   534             repo.dirstate.write()
   535 
   535 
   536         # save is a list of all the branches we are truncating away
   536         # save is a list of all the branches we are truncating away
   537         # that we actually want to keep.  changegroup will be used
   537         # that we actually want to keep.  changegroup will be used
   538         # to preserve them and add them back after the truncate
   538         # to preserve them and add them back after the truncate
  1017                 print "queue directory updating"
  1017                 print "queue directory updating"
  1018                 r = self.qrepo()
  1018                 r = self.qrepo()
  1019                 if not r:
  1019                 if not r:
  1020                     self.ui.warn("Unable to load queue repository\n")
  1020                     self.ui.warn("Unable to load queue repository\n")
  1021                     return 1
  1021                     return 1
  1022                 hg.update(r, qpp[0], allow=False, force=True)
  1022                 hg.clean(r, qpp[0])
  1023 
  1023 
  1024     def save(self, repo, msg=None):
  1024     def save(self, repo, msg=None):
  1025         if len(self.applied) == 0:
  1025         if len(self.applied) == 0:
  1026             self.ui.warn("save: no patches applied, exiting\n")
  1026             self.ui.warn("save: no patches applied, exiting\n")
  1027             return 1
  1027             return 1