Bug 3246 - Command qprev doesn't work with an applied guarded patch
Summary: Command qprev doesn't work with an applied guarded patch
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-03 10:28 UTC by Jonathan Keatley
Modified: 2012-05-13 04:52 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Keatley 2012-02-03 10:28 UTC
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.
Comment 1 Patrick Mézard 2012-02-03 11:20 UTC
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?
Comment 2 Patrick Mézard 2012-02-03 11:23 UTC
At the same time, the intent is ambiguous as qprev with only one patch
applied is hardcoded to print:

  "only one patch applied"
Comment 3 Matt Mackall 2012-02-03 12:30 UTC
To be even vaguely useful, qprev should return the patch you'll get if you qpop.
Comment 4 Patrick Mézard 2012-02-03 12:53 UTC
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!
Comment 5 HG Bot 2012-02-03 16:00 UTC
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)
Comment 6 Bugzilla 2012-05-12 09:27 UTC

--- 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