diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -66,6 +66,7 @@ from mercurial import commands, cmdutil, from mercurial import repair, extensions, error, phases from mercurial import patch as patchmod from mercurial import localrepo +from mercurial import subrepo import os, re, errno, shutil commands.norepo += " qclone" @@ -800,6 +801,14 @@ class queue(object): p1, p2 = repo.dirstate.parents() repo.setparents(p1, merge) + if all_files and '.hgsubstate' in all_files: + wctx = repo['.'] + mctx = actx = repo[None] + overwrite = False + mergedsubstate = subrepo.submerge(repo, wctx, mctx, actx, + overwrite) + files += mergedsubstate.keys() + match = scmutil.matchfiles(repo, files or []) oldtip = repo['tip'] n = newcommit(repo, None, message, ph.user, ph.date, match=match, @@ -1459,6 +1468,8 @@ class queue(object): self.ui.status(_("popping %s\n") % patch.name) del self.applied[start:end] self.strip(repo, [rev], update=False, backup='strip') + for s, state in repo['.'].substate.items(): + repo['.'].sub(s).get(state) if self.applied: self.ui.write(_("now at: %s\n") % self.applied[-1].name) else: diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t --- a/tests/test-mq-subrepo.t +++ b/tests/test-mq-subrepo.t @@ -230,6 +230,8 @@ handle subrepos safely on qpush/qpop $ hg -R sub commit -m foo $ hg commit -m1 $ hg qimport -r "0:tip" + $ hg -R sub id --id + aa037b301eba qpop $ hg -R sub update 0000 @@ -244,13 +246,11 @@ qpop popping 1.diff now at: 0.diff $ hg status -AS - M sub/a C .hgsub C .hgsubstate - $ hg debugsub - path sub - source sub - revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31 + C sub/a + $ hg -R sub id --id + b2fdb12cd82b qpush $ hg -R sub update 0000 @@ -263,15 +263,14 @@ qpush adding sub/a $ hg qpush applying 1.diff + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved now at: 1.diff $ hg status -AS - M .hgsubstate C .hgsub + C .hgsubstate C sub/a - $ hg debugsub - path sub - source sub - revision aa037b301eba54f350c75951b5486727fb98cbb5 + $ hg -R sub id --id + aa037b301eba $ cd ..