hgext/mq.py
changeset 8706 25e9c71b89de
parent 8700 a96b049075a8
child 8711 1b95c6f13155
equal deleted inserted replaced
8705:509083f54e52 8706:25e9c71b89de
   424 
   424 
   425         ctx = repo[rev]
   425         ctx = repo[rev]
   426         ret = hg.merge(repo, rev)
   426         ret = hg.merge(repo, rev)
   427         if ret:
   427         if ret:
   428             raise util.Abort(_("update returned %d") % ret)
   428             raise util.Abort(_("update returned %d") % ret)
   429         n = repo.commit(None, ctx.description(), ctx.user(), force=1)
   429         n = repo.commit(ctx.description(), ctx.user(), force=True)
   430         if n is None:
   430         if n is None:
   431             raise util.Abort(_("repo commit failed"))
   431             raise util.Abort(_("repo commit failed"))
   432         try:
   432         try:
   433             ph = patchheader(mergeq.join(patch))
   433             ph = patchheader(mergeq.join(patch))
   434         except:
   434         except:
   469             # needs to know which parent is actually in the patch queue.
   469             # needs to know which parent is actually in the patch queue.
   470             # so, we insert a merge marker with only one parent.  This way
   470             # so, we insert a merge marker with only one parent.  This way
   471             # the first patch in the queue is never a merge patch
   471             # the first patch in the queue is never a merge patch
   472             #
   472             #
   473             pname = ".hg.patches.merge.marker"
   473             pname = ".hg.patches.merge.marker"
   474             n = repo.commit(None, '[mq]: merge marker', force=1)
   474             n = repo.commit('[mq]: merge marker', force=True)
   475             self.removeundo(repo)
   475             self.removeundo(repo)
   476             self.applied.append(statusentry(hex(n), pname))
   476             self.applied.append(statusentry(hex(n), pname))
   477             self.applied_dirty = 1
   477             self.applied_dirty = 1
   478 
   478 
   479         head = self.qparents(repo)
   479         head = self.qparents(repo)
   595                 p1, p2 = repo.dirstate.parents()
   595                 p1, p2 = repo.dirstate.parents()
   596                 repo.dirstate.setparents(p1, merge)
   596                 repo.dirstate.setparents(p1, merge)
   597 
   597 
   598             files = patch.updatedir(self.ui, repo, files)
   598             files = patch.updatedir(self.ui, repo, files)
   599             match = cmdutil.matchfiles(repo, files or [])
   599             match = cmdutil.matchfiles(repo, files or [])
   600             n = repo.commit(None, message, ph.user, ph.date, match=match,
   600             n = repo.commit(message, ph.user, ph.date, match=match, force=True)
   601                             force=True)
       
   602 
   601 
   603             if n is None:
   602             if n is None:
   604                 raise util.Abort(_("repo commit failed"))
   603                 raise util.Abort(_("repo commit failed"))
   605 
   604 
   606             if update_status:
   605             if update_status:
   761                     p.write("From: " + user + "\n\n")
   760                     p.write("From: " + user + "\n\n")
   762 
   761 
   763                 if hasattr(msg, '__call__'):
   762                 if hasattr(msg, '__call__'):
   764                     msg = msg()
   763                     msg = msg()
   765                 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
   764                 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
   766                 n = repo.commit(None, commitmsg, user, date, match=match, force=True)
   765                 n = repo.commit(commitmsg, user, date, match=match, force=True)
   767                 if n is None:
   766                 if n is None:
   768                     raise util.Abort(_("repo commit failed"))
   767                     raise util.Abort(_("repo commit failed"))
   769                 try:
   768                 try:
   770                     self.full_series[insert:insert] = [patchfn]
   769                     self.full_series[insert:insert] = [patchfn]
   771                     self.applied.append(statusentry(hex(n), patchfn))
   770                     self.applied.append(statusentry(hex(n), patchfn))
  1282                     raise
  1281                     raise
  1283 
  1282 
  1284                 try:
  1283                 try:
  1285                     # might be nice to attempt to roll back strip after this
  1284                     # might be nice to attempt to roll back strip after this
  1286                     patchf.rename()
  1285                     patchf.rename()
  1287                     n = repo.commit(None, message, user, ph.date,
  1286                     n = repo.commit(message, user, ph.date, match=match,
  1288                                     match=match, force=1)
  1287                                     force=True)
  1289                     self.applied.append(statusentry(hex(n), patchfn))
  1288                     self.applied.append(statusentry(hex(n), patchfn))
  1290                 except:
  1289                 except:
  1291                     ctx = repo[cparents[0]]
  1290                     ctx = repo[cparents[0]]
  1292                     repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1291                     repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1293                     self.save_dirty()
  1292                     self.save_dirty()
  1468             pp = r.dirstate.parents()
  1467             pp = r.dirstate.parents()
  1469             msg += "\nDirstate: %s %s" % (hex(pp[0]), hex(pp[1]))
  1468             msg += "\nDirstate: %s %s" % (hex(pp[0]), hex(pp[1]))
  1470         msg += "\n\nPatch Data:\n"
  1469         msg += "\n\nPatch Data:\n"
  1471         text = msg + "\n".join([str(x) for x in self.applied]) + '\n' + (ar and
  1470         text = msg + "\n".join([str(x) for x in self.applied]) + '\n' + (ar and
  1472                    "\n".join(ar) + '\n' or "")
  1471                    "\n".join(ar) + '\n' or "")
  1473         n = repo.commit(None, text, force=1)
  1472         n = repo.commit(text, force=True)
  1474         if not n:
  1473         if not n:
  1475             self.ui.warn(_("repo commit failed\n"))
  1474             self.ui.warn(_("repo commit failed\n"))
  1476             return 1
  1475             return 1
  1477         self.applied.append(statusentry(hex(n),'.hg.patches.save.line'))
  1476         self.applied.append(statusentry(hex(n),'.hg.patches.save.line'))
  1478         self.applied_dirty = 1
  1477         self.applied_dirty = 1