When a series of patches is applied, and there is an unapplied patch above the current one that is guarded, then hg qprev returns nothing. For example: 1. Create a series of patches: A.patch, B.patch, and C.patch. Then apply a guard to A.patch: $ hg qguard A.patch +a $ hg qser -v 0 G A.patch 1 U B.patch 2 U C.patch 3. Now go to C.patch: $ hg qgoto C.patch applying B.patch applying C.patch now at: C.patch 4. Now try qprev: $ hg qprev 5. The command, which should output "B.patch", outputs nothing.
I can reproduce it, qprev is buggy wrt guards. The following question is: do qprev/qnext should return the prev/next patch or the next/prev *pushable* patch? Right now the implementation make them return the prev/next patch in the series, irrespectively of guards. I would say they should return *pushable* ones. @mpm: would you invoke backward compatibility here?
At the same time, the intent is ambiguous as qprev with only one patch applied is hardcoded to print: "only one patch applied"
To be even vaguely useful, qprev should return the patch you'll get if you qpop.
Patch submitted here: http://selenic.com/pipermail/mercurial-devel/2012-February/037836.html And a related one for qnext: http://selenic.com/pipermail/mercurial-devel/2012-February/037835.html Thanks for reporting this!
Fixed by http://selenic.com/repo/hg/rev/7e5a281a082c Patrick Mezard <pmezard@gmail.com> mq: make qprev return the previous applied patch (issue3245) (please test the fix)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:27 EDT --- This bug was previously known as _bug_ 3245 at http://mercurial.selenic.com/bts/issue3245