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-02-01 16:23:45 +0100
commit18ea3c13dc5bcda0c086efe11809795773f5167b (patch)
tree3c0cf9658ff6894d796df5697176ce0ad403897e
parentc139cc05d3101187d7292e220b1734bb03be99da (diff)
downloadfedora-packager-5/initial-merge.zip
fedora-packager-5/initial-merge.tar.gz
fedora-packager-5/initial-merge.tar.xz
Add "fedpkg clone --initial-merge" argument5/initial-merge
-rw-r--r--src/fedpkg.bash2
-rwxr-xr-xsrc/fedpkg.py14
-rw-r--r--src/pyfedpkg/__init__.py7
-rwxr-xr-xsrc/pyfedpkg/initial_merge.py10
4 files changed, 27 insertions, 6 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
index 5a20446..da37740 100644
--- a/src/fedpkg.bash
+++ b/src/fedpkg.bash
@@ -110,7 +110,7 @@ _fedpkg()
options="--dry-run -x"
;;
clone|co)
- options="--branches --anonymous"
+ options="--branches --anonymous --initial-merge"
options_branch="-b"
after="package"
;;
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 90c3be7..75770f5 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)
@@ -947,9 +949,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 83b54f7..401f738 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 ]