3 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 from optparse import OptionParser, make_option
22 from stgit.commands.common import *
23 from stgit.utils import *
24 from stgit import stack, git
25 from stgit.config import config
28 help = 'generate a new commit for the current patch'
29 usage = '%prog [options]'
31 options = [make_option('-f', '--force',
32 help = 'force the refresh even if HEAD and '\
34 action = 'store_true'),
35 make_option('-e', '--edit',
36 help = 'invoke an editor for the patch '\
38 action = 'store_true'),
39 make_option('-m', '--message',
40 help = 'use MESSAGE as the patch ' \
42 make_option('--authname',
43 help = 'use AUTHNAME as the author name'),
44 make_option('--authemail',
45 help = 'use AUTHEMAIL as the author e-mail'),
46 make_option('--authdate',
47 help = 'use AUTHDATE as the author date'),
48 make_option('--commname',
49 help = 'use COMMNAME as the committer name'),
50 make_option('--commemail',
51 help = 'use COMMEMAIL as the committer ' \
55 def func(parser, options, args):
57 parser.error('incorrect number of arguments')
59 if config.has_option('stgit', 'autoresolved'):
60 autoresolved = config.get('stgit', 'autoresolved')
64 if autoresolved != 'yes':
67 patch = crt_series.get_current()
69 raise CmdException, 'No patches applied'
72 check_head_top_equal()
74 if git.local_changes() \
75 or not crt_series.head_top_equal() \
76 or options.edit or options.message \
77 or options.authname or options.authemail or options.authdate \
78 or options.commname or options.commemail:
79 print 'Refreshing patch "%s"...' % patch,
82 if autoresolved == 'yes':
84 crt_series.refresh_patch(message = options.message,
86 author_name = options.authname,
87 author_email = options.authemail,
88 author_date = options.authdate,
89 committer_name = options.commname,
90 committer_email = options.commemail)
94 print 'Patch "%s" is already up to date' % patch