hgext/mq.py
changeset 17153 54da604fefee
parent 17152 f287d4a62031
child 17191 5884812686f7
equal deleted inserted replaced
17152:f287d4a62031 17153:54da604fefee
   931             if top not in pp:
   931             if top not in pp:
   932                 raise util.Abort(_("working directory revision is not qtip"))
   932                 raise util.Abort(_("working directory revision is not qtip"))
   933             return top, patch
   933             return top, patch
   934         return None, None
   934         return None, None
   935 
   935 
   936     def checksubstate(self, repo):
   936     def checksubstate(self, repo, baserev=None):
   937         '''return list of subrepos at a different revision than substate.
   937         '''return list of subrepos at a different revision than substate.
   938         Abort if any subrepos have uncommitted changes.'''
   938         Abort if any subrepos have uncommitted changes.'''
   939         inclsubs = []
   939         inclsubs = []
   940         wctx = repo[None]
   940         wctx = repo[None]
       
   941         if baserev:
       
   942             bctx = repo[baserev]
       
   943         else:
       
   944             bctx = wctx.parents()[0]
   941         for s in wctx.substate:
   945         for s in wctx.substate:
   942             if wctx.sub(s).dirty(True):
   946             if wctx.sub(s).dirty(True):
   943                 raise util.Abort(
   947                 raise util.Abort(
   944                     _("uncommitted changes in subrepository %s") % s)
   948                     _("uncommitted changes in subrepository %s") % s)
   945             elif wctx.sub(s).dirty():
   949             elif s not in bctx.substate or bctx.sub(s).dirty():
   946                 inclsubs.append(s)
   950                 inclsubs.append(s)
   947         return inclsubs
   951         return inclsubs
   948 
   952 
   949     def putsubstate2changes(self, substatestate, changes):
   953     def putsubstate2changes(self, substatestate, changes):
   950         for files in changes[:3]:
   954         for files in changes[:3]:
  1486                 raise util.Abort(_("cannot refresh a revision with children"))
  1490                 raise util.Abort(_("cannot refresh a revision with children"))
  1487             if not repo[top].mutable():
  1491             if not repo[top].mutable():
  1488                 raise util.Abort(_("cannot refresh immutable revision"),
  1492                 raise util.Abort(_("cannot refresh immutable revision"),
  1489                                  hint=_('see "hg help phases" for details'))
  1493                                  hint=_('see "hg help phases" for details'))
  1490 
  1494 
  1491             inclsubs = self.checksubstate(repo)
  1495             cparents = repo.changelog.parents(top)
       
  1496             patchparent = self.qparents(repo, top)
       
  1497 
       
  1498             inclsubs = self.checksubstate(repo, hex(patchparent))
  1492             if inclsubs:
  1499             if inclsubs:
  1493                 inclsubs.append('.hgsubstate')
  1500                 inclsubs.append('.hgsubstate')
  1494                 substatestate = repo.dirstate['.hgsubstate']
  1501                 substatestate = repo.dirstate['.hgsubstate']
  1495 
  1502 
  1496             cparents = repo.changelog.parents(top)
       
  1497             patchparent = self.qparents(repo, top)
       
  1498             ph = patchheader(self.join(patchfn), self.plainmode)
  1503             ph = patchheader(self.join(patchfn), self.plainmode)
  1499             diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
  1504             diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
  1500             if msg:
  1505             if msg:
  1501                 ph.setmessage(msg)
  1506                 ph.setmessage(msg)
  1502             if newuser:
  1507             if newuser: