Mercurial > hg
comparison hgext/mq.py @ 19638:20096384754f
mq: update subrepos when applying / unapplying patches that change .hgsubstate
Up until now applying or unapplying a patch that modified .hgsubstate would not
work as expected because it would not update the subrepos according to the
.hgsubstate change. This made it very easy to lose subrepo changes when using
mq.
This revision also changes the test-mq-subrepo test so that on the qpop / qpush
tests. We no longer use the debugsub command to check the state of the subrepos
after the qpop and qpush operations. Instead we directly run the id command on
the subrepos that we want to check. The reason is that using the debugsub
command is misleading because it does not really check the state of the subrepos
on the working directory (it just returns what the change that is specified on a
given revision). Because of this the tests did not detect the problem that this
revision fixes (i.e. that applying a patch did not update the subrepos to the
corresponding revisions).
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1376350710 -7200
# Tue Aug 13 01:38:30 2013 +0200
# Node ID 60897e264858cdcd46f89e27a702086f08adca02
# Parent 2defb5453f223c3027eb2f7788fbddd52bbb3352
mq: update subrepos when applying / unapplying patches that change .hgsubstate
Up until now applying or unapplying a patch that modified .hgsubstate would not
work as expected because it would not update the subrepos according to the
.hgsubstate change. This made it very easy to lose subrepo changes when using
mq.
This revision also changes the test-mq-subrepo test so that on the qpop / qpush
tests. We no longer use the debugsub command to check the state of the subrepos
after the qpop and qpush operations. Instead we directly run the id command on
the subrepos that we want to check. The reason is that using the debugsub
command is misleading because it does not really check the state of the subrepos
on the working directory (it just returns what the change that is specified on a
given revision). Because of this the tests did not detect the problem that this
revision fixes (i.e. that applying a patch did not update the subrepos to the
corresponding revisions).
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Tue, 13 Aug 2013 01:38:30 +0200 |
parents | 6bbce5efc67b |
children | 11fdf9f754b7 |
comparison
equal
deleted
inserted
replaced
19637:cc338115d3b2 | 19638:20096384754f |
---|---|
64 from mercurial.lock import release | 64 from mercurial.lock import release |
65 from mercurial import commands, cmdutil, hg, scmutil, util, revset | 65 from mercurial import commands, cmdutil, hg, scmutil, util, revset |
66 from mercurial import repair, extensions, error, phases | 66 from mercurial import repair, extensions, error, phases |
67 from mercurial import patch as patchmod | 67 from mercurial import patch as patchmod |
68 from mercurial import localrepo | 68 from mercurial import localrepo |
69 from mercurial import subrepo | |
69 import os, re, errno, shutil | 70 import os, re, errno, shutil |
70 | 71 |
71 commands.norepo += " qclone" | 72 commands.norepo += " qclone" |
72 | 73 |
73 seriesopts = [('s', 'summary', None, _('print first line of patch header'))] | 74 seriesopts = [('s', 'summary', None, _('print first line of patch header'))] |
797 repo.dirstate.remove(f) | 798 repo.dirstate.remove(f) |
798 for f in merged: | 799 for f in merged: |
799 repo.dirstate.merge(f) | 800 repo.dirstate.merge(f) |
800 p1, p2 = repo.dirstate.parents() | 801 p1, p2 = repo.dirstate.parents() |
801 repo.setparents(p1, merge) | 802 repo.setparents(p1, merge) |
803 | |
804 if all_files and '.hgsubstate' in all_files: | |
805 wctx = repo['.'] | |
806 mctx = actx = repo[None] | |
807 overwrite = False | |
808 mergedsubstate = subrepo.submerge(repo, wctx, mctx, actx, | |
809 overwrite) | |
810 files += mergedsubstate.keys() | |
802 | 811 |
803 match = scmutil.matchfiles(repo, files or []) | 812 match = scmutil.matchfiles(repo, files or []) |
804 oldtip = repo['tip'] | 813 oldtip = repo['tip'] |
805 n = newcommit(repo, None, message, ph.user, ph.date, match=match, | 814 n = newcommit(repo, None, message, ph.user, ph.date, match=match, |
806 force=True) | 815 force=True) |
1457 repo.setparents(qp, nullid) | 1466 repo.setparents(qp, nullid) |
1458 for patch in reversed(self.applied[start:end]): | 1467 for patch in reversed(self.applied[start:end]): |
1459 self.ui.status(_("popping %s\n") % patch.name) | 1468 self.ui.status(_("popping %s\n") % patch.name) |
1460 del self.applied[start:end] | 1469 del self.applied[start:end] |
1461 self.strip(repo, [rev], update=False, backup='strip') | 1470 self.strip(repo, [rev], update=False, backup='strip') |
1471 for s, state in repo['.'].substate.items(): | |
1472 repo['.'].sub(s).get(state) | |
1462 if self.applied: | 1473 if self.applied: |
1463 self.ui.write(_("now at: %s\n") % self.applied[-1].name) | 1474 self.ui.write(_("now at: %s\n") % self.applied[-1].name) |
1464 else: | 1475 else: |
1465 self.ui.write(_("patch queue now empty\n")) | 1476 self.ui.write(_("patch queue now empty\n")) |
1466 finally: | 1477 finally: |