From: Catalin Marinas Date: Tue, 10 Apr 2007 21:47:10 +0000 (+0100) Subject: Add --description option to branch X-Git-Tag: v0.13~104 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/302600dcf151882ac09cdee1dcec3ae7d42178e9 Add --description option to branch This options allows one to set the description text of a branch. Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index 5f79f7e..b043c69 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -51,6 +51,8 @@ options = [make_option('-c', '--create', make_option('--delete', help = 'delete an existing development branch', action = 'store_true'), + make_option('-d', '--description', + help = 'set the branch description'), make_option('--force', help = 'force a delete when the series is not empty', action = 'store_true'), @@ -275,6 +277,24 @@ def func(parser, options, args): return + elif options.description is not None: + + if len(args) == 0: + branch_name = crt_series.get_branch() + elif len(args) == 1: + branch_name = args[0] + else: + parser.error('incorrect number of arguments') + branch = stack.Series(branch_name) + + if not branch.is_initialised(): + raise CmdException, 'Branch "%s" is not controlled by StGIT' \ + % branch_name + + branch.set_description(options.description) + + return + elif len(args) == 1: if __is_current_branch(args[0]):