1 from stgit
.argparse
import opt
2 from stgit
.commands
.common
import CmdException
, DirectoryHasRepository
3 from stgit
.out
import out
6 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as
10 published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see http://www.gnu.org/licenses/.
21 help = 'Print the name of the top patch'
25 Print the name of the current (topmost) patch."""
32 args
=['stg_branches'],
33 short
='Use BRANCH instead of the default branch',
37 directory
= DirectoryHasRepository()
40 def func(parser
, options
, args
):
41 """Show the name of the topmost patch"""
43 parser
.error('incorrect number of arguments')
45 stack
= directory
.repository
.get_stack(options
.branch
)
46 applied
= stack
.patchorder
.applied
49 out
.stdout(applied
[-1])
51 raise CmdException('No patches applied')