Created
September 9, 2016 20:37
-
-
Save robintw/885b8a9a6638170cd880cc69a12bd340 to your computer and use it in GitHub Desktop.
Example `reproduce` command for recipy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from tinydb import where | |
from recipyCommon.utils import open_or_create_db | |
id_string = sys.argv[1] | |
db = open_or_create_db() | |
results = db.search(where('unique_id').matches('%s.*' % id_string))[0] | |
# Deal with the fact that the repo is cloned to a different place | |
# so we need to change the path to the script that we call | |
results['scriptname'] = results['script'].replace(results['gitrepo'], '') | |
if results['scriptname'].startswith('/'): | |
results['scriptname'] = results['scriptname'][1:] | |
script = """mkdir reproduction1 | |
cd reproduction1 | |
git clone {gitorigin} . | |
git checkout {gitcommit} | |
git apply << EOF | |
{diff} | |
EOF | |
{command} {scriptname} {command_args} | |
""".format(**results) | |
print(script) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment