diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2010-08-10 13:13:15 +0200 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2011-01-21 11:00:22 +0100 |
commit | 39b9be927e4cbbfeed1ee2e28a1badde0db5c19d (patch) | |
tree | 644365d61d1bc642f341ec55f933df30311e2b7e | |
parent | bd606390a95b6364b90dedcc4bfcbd6d3ad76dd6 (diff) | |
download | fedora-packager-39b9be927e4cbbfeed1ee2e28a1badde0db5c19d.tar.gz fedora-packager-39b9be927e4cbbfeed1ee2e28a1badde0db5c19d.tar.xz fedora-packager-39b9be927e4cbbfeed1ee2e28a1badde0db5c19d.zip |
Add "fedpkg clone --initial-merge" argument4/initial-merge
-rw-r--r-- | src/fedpkg.bash | 2 | ||||
-rwxr-xr-x | src/fedpkg.py | 14 | ||||
-rw-r--r-- | src/pyfedpkg/__init__.py | 7 | ||||
-rwxr-xr-x | src/pyfedpkg/initial_merge.py | 10 |
4 files changed, 27 insertions, 6 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 2331f98..fe709a2 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -108,7 +108,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 c897b4c..c54c057 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) @@ -940,9 +942,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 ] |