1 from stgit
.argparse
import opt
, patch_range
2 from stgit
.commands
.common
import CmdException
, DirectoryHasRepository
, parse_patches
3 from stgit
.lib
import transaction
6 Copyright (C) 2009, 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 = 'Unhide a hidden patch'
23 usage
= ['[options] [--] <patch-range>']
25 Unhide a hidden range of patches so that they are shown in the plain
26 'stg series' command output."""
28 args
= [patch_range('hidden_patches')]
33 args
=['stg_branches'],
34 short
='Use BRANCH instead of the default branch',
38 directory
= DirectoryHasRepository()
41 def func(parser
, options
, args
):
42 """Unhide a range of patch in the series."""
43 stack
= directory
.repository
.current_stack
44 trans
= transaction
.StackTransaction(stack
, 'unhide')
47 parser
.error('No patches specified')
49 patches
= parse_patches(args
, trans
.all_patches
)
51 if p
not in trans
.hidden
:
52 raise CmdException('Patch "%s" not hidden' % p
)
54 applied
= list(trans
.applied
)
55 unapplied
= trans
.unapplied
+ patches
56 hidden
= [p
for p
in trans
.hidden
if p
not in set(patches
)]
58 trans
.reorder_patches(applied
, unapplied
, hidden
)