Skip to content

Instantly share code, notes, and snippets.

@meeuw
Created March 1, 2014 20:05
Show Gist options
  • Save meeuw/9296294 to your computer and use it in GitHub Desktop.
Save meeuw/9296294 to your computer and use it in GitHub Desktop.
script to cherrypick a list of subversion revisions
#!/usr/bin/python
import subprocess
import fileinput
if False:
revs = []
for line in subprocess.check_output(['svn', 'merge', '../branches/dev', '--dry-run']).split('\n'):
if line.startswith('--- Merging'):
s = line.split(' ')
revs.append((s[2][1:], s[4][1:]))
for rev in revs:
log = ''
for line in subprocess.check_output(['svn', 'log', '../branches/dev', '-r%s:%s' % rev]).split('\n'):
if line == '-'*72:
print log
log = ''
else:
log += line+' '
else:
revs = []
for line in fileinput.input('merge.txt'):
cmd = line.split(' ')[0].strip()
if cmd:
revs.append('-c'+cmd[1:])
subprocess.check_call(['svn', 'merge', '../branches/dev'] + revs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment