""" Generates a patch and interdiff from an existing patch that needs changes.""" from gitCmds import GitRepo import os import sys import glob git = GitRepo(os.getcwd()) # Check if we're in new_patch branch and if old_patch exists if not git.check_old_new_correct(): print "Something is wrong with the branches, are you on new_patch? Exiting." sys.exit(1) # Make sure before commit that old_patch and new_patch diff is zero. if not git.diff('old_patch') == '': print "Something is wrong : the new_patch HEAD and old_patch are different" print "Committing changes to new_patch" git.commit('New Patch') for patch_filename in glob.glob('*.patch'): print patch_filename # Input block issue_no = raw_input("Enter The Issue #: ") issue_slug = raw_input("Enter The Issue Slug: ") arch_extra_info = raw_input("Enter The Arch/Extra Info: ") old_patch_no = raw_input("Enter The Old Patch Comment #: ") new_patch_no = raw_input("Enter The New Patch Comment #: ")
is_new_branch=True, commit_hash=hash_to_checkout ) patch_result_output = git.patch(patch_filename, dry_run=True) if 'patch failed:' in patch_result_output or 'error: ' in patch_result_output: print "Patch doesn't apply cleanly on OLD hash, restart and try an older date." sys.exit(1) else: print 'Patch applied cleanly on OLD hash, applying patch with git' git.apply_patch(patch_filename) choice = raw_input("Wish to continue and rebase? ").lower() if choice in yes_values_list: thread_url = raw_input("Thread URL (with comment anchor)? ") git.commit('Applying patch from ' + thread_url) print git.rebase() choice = raw_input("Rebase Clean? ").lower() if choice in yes_values_list: print "Generating New Patch\n" new_patch_filename_string = raw_input("Patch Filename: ") git.diff('8.0.x', new_patch_filename_string) print "Patch Generated!" sys.exit(0) else: print "Rebase paused, add files and rebase --continue" sys.exit(1) print "Exiting due to concerns." sys.exit(1) else: print "Patch applies cleanly, reverting working directory." git.cleanup()
#! /usr/bin/env python """ Generates a patch and interdiff from a repository after updating a patch.""" from gitCmds import GitRepo import os git = GitRepo(os.getcwd()) new_patch_filename = raw_input("Enter Patch Filename #: ") git.diff('8.0.x', output_to_file=new_patch_filename)
git.checkout(branch=project_string, is_new_branch=True, commit_hash=hash_to_checkout) patch_result_output = git.patch(patch_filename, dry_run=True) if 'patch failed:' in patch_result_output or 'error: ' in patch_result_output: print "Patch doesn't apply cleanly on OLD hash, restart and try an older date." sys.exit(1) else: print 'Patch applied cleanly on OLD hash, applying patch with git' git.apply_patch(patch_filename) choice = raw_input("Wish to continue and rebase? ").lower() if choice in yes_values_list: thread_url = raw_input("Thread URL (with comment anchor)? ") git.commit('Applying patch from ' + thread_url) print git.rebase() choice = raw_input("Rebase Clean? ").lower() if choice in yes_values_list: print "Generating New Patch\n" new_patch_filename_string = raw_input("Patch Filename: ") git.diff('8.0.x', new_patch_filename_string) print "Patch Generated!" sys.exit(0) else: print "Rebase paused, add files and rebase --continue" sys.exit(1) print "Exiting due to concerns." sys.exit(1) else: print "Patch applies cleanly, reverting working directory." git.cleanup()