From c142a78896e27cf6b43135a12379c2f8ae1eb572 Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:49 +0200 Subject: Add a -t (tag) switch for the commit command Hello Jesse, this patch implenents a -t (tag) switch for the commit command. Because you have wrote, that you don't like to see additional function in the PackageModule class, I have refactor this patch to fullfill your requirements. Best Regards: Jochen Schmitt --- src/fedpkg.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 405eb3f..3a9b65a 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -440,6 +440,7 @@ def clone(args): sys.exit(1) def commit(args): + mymodule = None if args.clog: try: mymodule = pyfedpkg.PackageModule(args.path) @@ -453,6 +454,18 @@ def commit(args): except pyfedpkg.FedpkgError, e: log.error('Could not commit: %s' % e) sys.exit(1) + if args.tag: + try: + if not mymodule: + mymodule = pyfedpkg.PackageModule(args.path) + tagname = mymodule.getnvr() + filename = args.file + if args.clog: + filename = 'clog' + pyfedpkg.add_tag(tagname, True, args.message, filename) + except pyfedpkg.FedpkgError, e: + log.error('Coult not create a tag: %s' % e) + sys.exit(1) if args.push: push(args) @@ -921,6 +934,10 @@ packages will be built sequentially. default = False, action = 'store_true', help = 'Generate the commit message from the %Changelog section') + parser_commit.add_argument('-t', '--tag', + default = False, + action = 'store_true', + help = 'Create a tag for this commit') parser_commit.add_argument('-m', '--message', default = None, help = 'Use the given as the commit message') -- cgit