summaryrefslogtreecommitdiff
path: root/hacking
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-05-21 12:41:22 -0700
committerToshio Kuratomi <a.badger@gmail.com>2018-05-21 14:50:24 -0500
commit5634dae290d83ba9bce0cef1ff9a92dacaaf49d3 (patch)
tree292e2df871d177aee884c8dfc5a5af9f2119cf35 /hacking
parent32d6a354d74c2ac18bb73e50b843d5bbf55c6b13 (diff)
downloadansible-5634dae290d83ba9bce0cef1ff9a92dacaaf49d3.tar.gz
Remove the cherrypick script
We only needed it for migrating cherrypicks between the unified repo and the ansible-modules-* repos. Now that we aren't supporting 2.3, we no longer need this script.
Diffstat (limited to 'hacking')
-rwxr-xr-xhacking/cherrypick.py53
1 files changed, 0 insertions, 53 deletions
diff --git a/hacking/cherrypick.py b/hacking/cherrypick.py
deleted file mode 100755
index d99f405595..0000000000
--- a/hacking/cherrypick.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import sh
-import sys
-import tempfile
-
-REPO_PATH = {
- 'extras': '/srv/ansible/stable-2.2/lib/ansible/modules/extras',
- 'core': '/srv/ansible/stable-2.2/lib/ansible/modules/core'
-}
-
-
-if __name__ == '__main__':
- commit_hash = sys.argv[1]
- which_modules = sys.argv[2]
- git = sh.git.bake('--no-pager', _tty_out=False)
- try:
- # Get the change
- git('checkout', 'devel')
- patch = git('format-patch', '-1', '--stdout', commit_hash).stdout
- finally:
- git('checkout', '-')
-
- # Transform the change for the new repo
- patch = patch.replace(b'lib/ansible/modules/', b'')
- new_patch = []
- patch_stream = (l for l in patch.split(b'\n'))
- for line in patch_stream:
- if line.strip() == b'---':
- new_patch.append(b'(cherry picked from %s)' % commit_hash.encode('utf-8'))
- new_patch.append(line)
- break
- new_patch.append(line)
- new_patch.extend(list(patch_stream))
-
- # Save the patch
- try:
- fh, patchfilename = tempfile.mkstemp()
- os.write(fh, b'\n'.join(new_patch))
- os.close(fh)
-
- # Apply the patch
- try:
- orig_dir = os.getcwd()
- os.chdir(REPO_PATH[which_modules])
- git('am', patchfilename)
- finally:
- os.chdir(orig_dir)
- except:
- print("Problem occurred. Patch saved in: {0}".format(patchfilename))
- else:
- os.remove(patchfilename)