summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2010-08-10 13:13:15 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2011-01-11 15:56:11 +0100
commit8b73d6cb31d0a3fed328acd31d524a671238f51a (patch)
tree71ef34c193717ed8378268d565395abcc98884fc
parentc3f6a19ac55170baa33fbbfb583ff3f0d4ad2710 (diff)
downloadfedora-packager-initial-merge/3.zip
fedora-packager-initial-merge/3.tar.gz
fedora-packager-initial-merge/3.tar.xz
Add "fedpkg clone --initial-merge" argumentinitial-merge/3
-rwxr-xr-xsrc/fedpkg.py14
-rw-r--r--src/pyfedpkg/__init__.py7
-rwxr-xr-xsrc/pyfedpkg/initial_merge.py10
3 files changed, 26 insertions, 5 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index eaea4ac..b5e7b0d 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -446,6 +446,8 @@ def clone(args):
pyfedpkg.clone_with_dirs(args.module[0], user)
else:
pyfedpkg.clone(args.module[0], user, args.path, args.branch)
+ if args.initial_merge:
+ pyfedpkg.initial_merge.handle_repo(args.module[0])
except pyfedpkg.FedpkgError, e:
log.error('Could not clone: %s' % e)
sys.exit(1)
@@ -938,9 +940,15 @@ packages will be built sequentially.
parser_clone = subparsers.add_parser('clone',
help = 'Clone and checkout a module')
# Allow an old style clone with subdirs for branches
- parser_clone.add_argument('--branches', '-B',
- action = 'store_true',
- help = 'Do an old style checkout with subdirs for branches')
+ parser_clone_branches_group = parser_clone.add_mutually_exclusive_group()
+ parser_clone_branches_group.add_argument(
+ '--branches', '-B',
+ action = 'store_true',
+ help = 'Do an old style checkout with subdirs for branches')
+ parser_clone_branches_group.add_argument(
+ '--initial-merge', '-i',
+ action = 'store_true',
+ help = 'Run initial-merge on the cloned repo immediately')
# provide a convenient way to get to a specific branch
parser_clone.add_argument('--branch', '-b',
help = 'Check out a specific branch')
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 51982ea..9c76fc0 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -31,8 +31,6 @@ import OpenSSL
import fnmatch
import offtrac
-from . import initial_merge
-
# Define some global variables, put them here to make it easy to change
LOOKASIDE = 'http://pkgs.fedoraproject.org/repo/pkgs'
@@ -50,6 +48,11 @@ BRANCHFILTER = 'f\d\d\/master|master|el\d\/master|olpc\d\/master'
class FedpkgError(Exception):
pass
+
+# This module needs FedpkgError to be defined
+from . import initial_merge
+
+
# Setup our logger
# Null logger to avoid spurrious messages, add a handler in app code
class NullHandler(logging.Handler):
diff --git a/src/pyfedpkg/initial_merge.py b/src/pyfedpkg/initial_merge.py
index 4964745..f22453f 100755
--- a/src/pyfedpkg/initial_merge.py
+++ b/src/pyfedpkg/initial_merge.py
@@ -169,7 +169,17 @@ class Filter(object):
self.branch_list = [item]
+class UnknownRepoTypeError(pyfedpkg.FedpkgError):
+ pass
+
+
def handle_repo(repo, dry_run=False):
+ if type(repo) == str:
+ repo = git.Repo(repo)
+ elif isinstance(repo, git.Repo):
+ pass
+ else:
+ raise UnknownRepoTypeError("%s" % repo)
log.info("######## initial-merge %s ########" % repo.working_tree_dir)
_locals, remotes = pyfedpkg._list_branches(repo=repo)
aa = [ Branch(repo.git.rev_parse('%s^{tree}' % b), b) for b in remotes ]