2 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 from stgit
.argparse
import opt
19 from stgit
.commands
import common
20 from stgit
.out
import out
21 from stgit
import argparse
23 help = 'Print the name of the next patch'
27 Print the name of the next patch."""
31 opt('-b', '--branch', args
= [argparse
.stg_branches
],
32 short
= 'Use BRANCH instead of the default branch')]
34 directory
= common
.DirectoryHasRepositoryLib()
36 def func(parser
, options
, args
):
37 """Show the name of the next patch
40 parser
.error('incorrect number of arguments')
42 stack
= directory
.repository
.get_stack(options
.branch
)
43 unapplied
= stack
.patchorder
.unapplied
46 out
.stdout(unapplied
[0])
48 raise common
.CmdException
, 'No unapplied patches'