From f9443e37b7ca3863ba79f9603d074bcd7c749abe Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:46 +0200 Subject: Implementation of a pull command Hello Jesse, this patch implemts a pull command for fedpkg. Best Regards: Jochen Schmitt --- src/fedpkg.bash | 2 +- src/fedpkg.py | 14 ++++++++++++++ src/pyfedpkg/__init__.py | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 8c81ccc..bb57b94 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -36,7 +36,7 @@ _fedpkg() local options="-h --help -v -q" local options_value="-u --user --path" local commands="build chain-build ci clean clog clone co commit compile diff gimmespec giturl help \ - import install lint local mockbuild new new-sources patch prep push scratch-build sources srpm \ + import install lint local mockbuild new new-sources patch prep pull push scratch-build sources srpm \ switch-branch tag tag-request unused-patches update upload verrel" # parse main options and get command diff --git a/src/fedpkg.py b/src/fedpkg.py index 0319c70..257d7a7 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -598,6 +598,14 @@ def prep(args): log.error('Could not prep: %s' % e) sys.exit(1) +def pull(args): + try: + mymodule = pyfedpkg.PackageModule(args.path) + mymodule.pull() + except pyfedpkg.FedpkgError, e: + log.error('Could not push: %s' % e) + sys.exit(1) + def push(args): try: mymodule = pyfedpkg.PackageModule(args.path) @@ -1024,6 +1032,12 @@ packages will be built sequentially. parser_prep.add_argument('--arch', help = 'Prep for a specific arch') parser_prep.set_defaults(command = prep) + # Pull stuff + parser_pull = subparsers.add_parser('pull', + help = 'Pull changes from remote repository') + parser_pull.set_defaults(command = pull) + + # Push stuff parser_push = subparsers.add_parser('push', help = 'Push changes to remote repository') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index c975afc..790cb93 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1543,7 +1543,14 @@ class PackageModule: # Run the command _run_command(cmd, shell=True) return + + def pull(self): + """Pull changes from the main repository""" + cmd = ['git', 'pull'] + _run_command(cmd) + return + def push(self): """Push changes to the main repository""" -- cgit