diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2010-08-04 02:01:01 +0200 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2010-08-04 02:01:01 +0200 |
commit | ba42541c45596435812de4bd1e9fba3a9fe9b82b (patch) | |
tree | 204aa3c75e04201fd21967abc12e5b563819fa02 | |
parent | 633417f97eeaf9e9fb7bbb6c55f9831c4d1c78d0 (diff) | |
download | fedora-packager-ba42541c45596435812de4bd1e9fba3a9fe9b82b.tar.gz fedora-packager-ba42541c45596435812de4bd1e9fba3a9fe9b82b.tar.xz fedora-packager-ba42541c45596435812de4bd1e9fba3a9fe9b82b.zip |
refactoring initial-merge
-rwxr-xr-x | src/fedpkg.py | 9 | ||||
-rwxr-xr-x | src/pyfedpkg/initial_merge.py | 32 |
2 files changed, 28 insertions, 13 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py index 005b152..b1819f6 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -636,6 +636,10 @@ def verrel(args): sys.exit(1) print('%s-%s-%s' % (mymodule.module, mymodule.ver, mymodule.rel)) +def initial_merge(args): + import pyfedpkg.initial_merge + pyfedpkg.initial_merge.handle_path(args.path) + # THe main code goes here if __name__ == '__main__': # Create the parser object @@ -934,6 +938,11 @@ packages will be built sequentially. ' name-version-release') parser_verrel.set_defaults(command = verrel) + # Initial branch merges + parser_initial_merge = subparsers.add_parser('initial-merge', + help = 'FIXME') + parser_initial_merge.set_defaults(command = initial_merge) + # Parse the args args = parser.parse_args() diff --git a/src/pyfedpkg/initial_merge.py b/src/pyfedpkg/initial_merge.py index 22134ad..8a3cf6d 100755 --- a/src/pyfedpkg/initial_merge.py +++ b/src/pyfedpkg/initial_merge.py @@ -1,7 +1,7 @@ #!/usr/bin/python -"""initial-merge.py - perform initial merge after dist-git migration +"""initial_merge.py - perform initial merge after dist-git migration -initial-merge.py performs a merge of all git branches with the same +initial_merge.py performs a merge of all git branches with the same content in the directory tree, i.e. with the same packages. This is useful after Fedora's dist-cvs to dist-git migration, as often @@ -11,8 +11,9 @@ filesystem. After these merges, future merges between the branches will be a lot easier. -Note that this is a standalone script which calls fedpkg via subprocess.Popen, -as fedpkg has a bunch of issues with changing CWD. +Note that this also works as a standalone script which calls fedpkg +via subprocess.Popen, as fedpkg has a bunch of issues with changing +CWD. """ import sys @@ -127,8 +128,7 @@ class Consumer: self.__flush() -def handle_directory(): - +def handle_curdir(): git_branch_cmd = """for branch in $(git branch -r | grep -v '/HEAD'); do echo "$(git rev-parse "$branch^{tree}") $branch"; done""" retcode, stdout, stderr = run_cmd_out(git_branch_cmd, dry_run=False, shell=True) @@ -155,17 +155,23 @@ def handle_directory(): print "FINISHED." +def handle_path(path=None): + if not path: + path = os.getcwd() + oldcwd = os.getcwd() + os.chdir(d) + print "########", "Entering", d, "########" + handle_curdir() + print "Leaving", os.getcwd() + os.chdir(oldcwd) + + def main(args): if args: for d in args: - oldcwd = os.getcwd() - os.chdir(d) - print "########", "Entering", d, "########" - handle_directory() - print "Leaving", os.getcwd() - os.chdir(oldcwd) + handle_path(d) else: - handle_directory() + handle_curdir() if __name__ == '__main__': |