Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 17153:54da604fefee
mq: check subrepo synchronizations against parent of workdir or other appropriate context
Before this patch, MQ checks each subrepo synchronizations against the
working directory context, so ".hgsubstate" updating is not imported
into MQ revision correctly in cases below:
- qrefresh when current ".hgsubstate" is already synchronized with
each subrepos: you can reproduce this easily by just twice or more
qrefresh invocations
- qnew just after rollback of commit which updates ".hgsubstate"
This patch resolves this by checking subrepo states against:
- the parent of "qtop" for qrefresh, or
- the parent of working context otherwise
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 27 Jun 2012 22:03:27 +0900 |
parents | f287d4a62031 |
children | 5884812686f7 |
line wrap: on
line diff
--- a/hgext/mq.py Wed Jun 27 22:03:27 2012 +0900 +++ b/hgext/mq.py Wed Jun 27 22:03:27 2012 +0900 @@ -933,16 +933,20 @@ return top, patch return None, None - def checksubstate(self, repo): + def checksubstate(self, repo, baserev=None): '''return list of subrepos at a different revision than substate. Abort if any subrepos have uncommitted changes.''' inclsubs = [] wctx = repo[None] + if baserev: + bctx = repo[baserev] + else: + bctx = wctx.parents()[0] for s in wctx.substate: if wctx.sub(s).dirty(True): raise util.Abort( _("uncommitted changes in subrepository %s") % s) - elif wctx.sub(s).dirty(): + elif s not in bctx.substate or bctx.sub(s).dirty(): inclsubs.append(s) return inclsubs @@ -1488,13 +1492,14 @@ raise util.Abort(_("cannot refresh immutable revision"), hint=_('see "hg help phases" for details')) - inclsubs = self.checksubstate(repo) + cparents = repo.changelog.parents(top) + patchparent = self.qparents(repo, top) + + inclsubs = self.checksubstate(repo, hex(patchparent)) if inclsubs: inclsubs.append('.hgsubstate') substatestate = repo.dirstate['.hgsubstate'] - cparents = repo.changelog.parents(top) - patchparent = self.qparents(repo, top) ph = patchheader(self.join(patchfn), self.plainmode) diffopts = self.diffopts({'git': opts.get('git')}, patchfn) if msg: