Changes between Version 2 and Version 3 of GitCommit
- Timestamp:
- 06/11/2010 02:45:58 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GitCommit
v2 v3 37 37 GIT_COMMIT = '/usr/lib/git-core/git-commit' 38 38 GIT_CHECKOUT = '/usr/lib/git-core/git-checkout' 39 GIT_ FORMAT_PATCH = '/usr/lib/git-core/git-format-patch'39 GIT_CHERRY_PICK = '/usr/lib/git-core/git-cherry-pick' 40 40 41 41 if __name__ == '__main__': … … 65 65 continue 66 66 current_branch = branch 67 67 68 68 # Check to make sure that the provided branches are valid 69 69 for branch in branches: 70 70 if branch not in local_branches: 71 print >> sys.stderr, 'invalid branch: %s' % branch71 sys.stderr.write('invalid branch: %s\n' % branch) 72 72 sys.exit(1) 73 73 74 74 # Perform the main commit 75 subprocess.call([GIT_COMMIT] + git_args) 75 p = subprocess.Popen([GIT_COMMIT] + git_args, stdout=subprocess.PIPE) 76 if p.wait() > 0: 77 sys.stdout.write(p.stdout.read()) 78 sys.exit(1) 79 80 # Get the commit tag without using regex 81 try: 82 commit_tag = p.stdout.readline().split(' ')[1].split(']')[0] 83 except: 84 sys.stderr.write('unable to read commit tag\n') 85 sys.exit(1) 76 86 77 87 # Loop through the specified branches applying the commit to all of … … 79 89 for branch in branches: 80 90 subprocess.call([GIT_CHECKOUT, branch]) 81 p1 = subprocess.Popen([GIT_FORMAT_PATCH, '-k', '--stdout', '-1', 82 current_branch], stdout=subprocess.PIPE) 83 p2 = subprocess.Popen([GIT, 'am', '-3', '-k'], stdin=p1.stdout) 84 p2.communicate() 91 sys.stdout.write('Applying commit %s to %s\n' % (commit_tag, branch)) 92 subprocess.call([GIT_CHERRY_PICK, commit_tag], stdout=subprocess.PIPE) 85 93 86 94 # Switch back to the original branch