From 752b39b5b5803ef9b27e366c82ced9b7669d461c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 26 Jul 2010 13:34:56 -0700 Subject: Impliment pushing. Thanks Jochen@herr-schmitt.de --- src/fedpkg.py | 16 ++++++++++++++-- src/pyfedpkg/__init__.py | 9 +++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/fedpkg.py b/src/fedpkg.py index f9db3c1..ba36f26 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -419,8 +419,7 @@ def commit(args): log.error('Could not commit: %s' % e) sys.exit(1) if args.push: - # do the push command here. - pass + push(args) def compile(args): arch = None @@ -559,6 +558,14 @@ def prep(args): log.error('Could not prep: %s' % e) sys.exit(1) +def push(args): + try: + mymodule = pyfedpkg.PackageModule(args.path) + mymodule.push() + except pyfedpkg.FedpkgError, e: + log.error('Could not push: %s' % e) + sys.exit(1) + def scratchbuild(args): # A scratch build is just a build with --scratch args.scratch = True @@ -855,6 +862,11 @@ packages will be built sequentially. parser_prep.add_argument('--arch', help = 'Prep for a specific arch') parser_prep.set_defaults(command = prep) + # Push stuff + parser_push = subparsers.add_parser('push', + help = 'Push changes to remote repository') + parser_push.set_defaults(command = push) + # scratch build parser_scratchbuild = subparsers.add_parser('scratch-build', help = 'Request scratch build', diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 07b3d60..0a941ca 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1266,6 +1266,15 @@ class PackageModule: if error: log.error(error) return proc.returncode + + def push(self): + """Push changes to the main repository""" + + cmd = ['git', 'push'] + _run_command(cmd) + return + + def sources(self, outdir=None): """Download source files""" -- cgit