# HG changeset patch # User Matt Mackall # Date 1308956429 18000 # Node ID 13011330885637d05262f2abceb8098fe4b8884b # Parent 39293595233e8461ef844955775a25efa983b53a# Parent e9ed3506f066fe5ca88db31fbdea76e0244a9d7f merge with stable diff -r 39293595233e -r 130113308856 hgext/mq.py --- a/hgext/mq.py Fri Jun 24 13:35:44 2011 -0500 +++ b/hgext/mq.py Fri Jun 24 18:00:29 2011 -0500 @@ -1134,6 +1134,8 @@ if start == len(self.series): self.ui.warn(_('patch series already fully applied\n')) return 1 + if not force: + self.checklocalchanges(repo, refresh=self.applied) if exact: if move: @@ -1172,19 +1174,6 @@ end = self.series.index(patch, start) + 1 s = self.series[start:end] - - if not force: - mm, aa, rr, dd = repo.status()[:4] - wcfiles = set(mm + aa + rr + dd) - if wcfiles: - for patchname in s: - pf = os.path.join(self.path, patchname) - patchfiles = patchmod.changedfiles(self.ui, repo, pf) - if wcfiles.intersection(patchfiles): - self.localchangesfound(self.applied) - elif mergeq: - self.checklocalchanges(refresh=self.applied) - all_files = set() try: if mergeq: @@ -1265,6 +1254,9 @@ break update = needupdate + if not force and update: + self.checklocalchanges(repo) + self.applieddirty = 1 end = len(self.applied) rev = self.applied[start].node @@ -1287,12 +1279,6 @@ qp = self.qparents(repo, rev) ctx = repo[qp] m, a, r, d = repo.status(qp, top)[:4] - parentfiles = set(m + a + r + d) - if not force and parentfiles: - mm, aa, rr, dd = repo.status()[:4] - wcfiles = set(mm + aa + rr + dd) - if wcfiles.intersection(parentfiles): - self.localchangesfound() if d: raise util.Abort(_("deletions found between repo revs")) for f in a: diff -r 39293595233e -r 130113308856 tests/test-mq-qpush-exact.t --- a/tests/test-mq-qpush-exact.t Fri Jun 24 13:35:44 2011 -0500 +++ b/tests/test-mq-qpush-exact.t Fri Jun 24 18:00:29 2011 -0500 @@ -163,12 +163,8 @@ $ hg update 1 -q $ echo c0 >> f0 $ hg qpush -e - applying p0 - now at: p0 - $ cat f0 - c0 - $ hg qpop -aq - patch queue now empty + abort: local changes found + [255] $ hg qpush -ef applying p0 now at: p0 @@ -182,13 +178,8 @@ $ hg update 1 -q $ echo c0 >> f0 $ hg qpush -e p1 - applying p0 - applying p1 - now at: p1 - $ cat f0 - c0 - $ hg qpop -aq - patch queue now empty + abort: local changes found + [255] $ hg qpush -e p1 -f applying p0 applying p1 diff -r 39293595233e -r 130113308856 tests/test-mq.t --- a/tests/test-mq.t Fri Jun 24 13:35:44 2011 -0500 +++ b/tests/test-mq.t Fri Jun 24 18:00:29 2011 -0500 @@ -1259,65 +1259,6 @@ now at: changea $ cd .. -test qpop with local changes, issue2780 - - $ hg init forcepop - $ cd forcepop - $ echo 1 > 1 - $ hg ci -Am 1 - adding 1 - $ hg qnew foo - $ echo 2 > 2 - $ hg add - adding 2 - -unrelated changes - - $ hg qpop - popping foo - patch queue now empty - -related changes - - $ hg forget 2 - $ rm 2 - $ hg qpush - applying foo - patch foo is empty - now at: foo - $ echo 2 >> 1 - $ hg qrefresh - $ echo 2 >> 1 - $ hg qpop - abort: local changes found, refresh first - [255] - $ hg st - M 1 - -related changes with force - $ hg qpop --force - popping foo - patch queue now empty - $ hg st - -related renamed source without change - $ hg qpush - applying foo - now at: foo - $ echo 1 > 1 - $ hg mv 1 2 - $ hg qref --git - $ hg qpop - popping foo - patch queue now empty - $ echo 3 > 1 - $ hg st - M 1 - $ hg qpush - abort: local changes found - [255] - $ cd .. - test qpush with --force, issue1087 $ hg init forcepush @@ -1334,9 +1275,16 @@ $ echo world >> hello.txt -apply, should not discard changes with empty patch +qpush should fail, local changes $ hg qpush + abort: local changes found + [255] + + +apply force, should not discard changes with empty patch + + $ hg qpush -f applying empty patch empty is empty now at: empty