summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-01-20 16:14:09 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-01-20 16:14:43 +0000
commitab196c1135af59e4c695d098fb3c505beecb337d (patch)
treedffaea94acac75ff6f5153815f0d87cbb031592a /lorry
parent88a2edc80ca6e06649102471b7571b182ecf8b1e (diff)
downloadlorry-ab196c1135af59e4c695d098fb3c505beecb337d.tar.gz
lorry: git svn rebase after fetch
git svn fetch updates the remote tracking branch it does not alter the master branch to include the changes so git svn rebase must be used to do this It may be possible to just push the remote tracking branch to gitorious but other imports push the working branches, so this keeps it simpler without that much extra overhead as the rebase should be cheap This also adds a couple of extra options, to get command output before the program finishes, useful for long programs
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry18
1 files changed, 16 insertions, 2 deletions
diff --git a/lorry b/lorry
index 5a04e9e..061f13a 100755
--- a/lorry
+++ b/lorry
@@ -45,6 +45,12 @@ class Lorry(cliapp.Application):
self.settings.boolean(['repack'],
'repack git repositories when an import has'
'been updated (default: %default)', default=True)
+ self.settings.string(['command-stdout'],
+ 'write the stdout of commands to this file',
+ default=None)
+ self.settings.string(['command-stderr'],
+ 'write the stderr of commands to this file',
+ default=None)
def process_args(self, args):
for arg in args:
@@ -166,7 +172,10 @@ class Lorry(cliapp.Application):
'--branches', layout["branches"]])
else:
self.progress('.. updating existing clone')
+ # update the remote tracking branch
self.run_program(['git', 'svn', 'fetch'], cwd=gitdir)
+ # update the master branch with these changes
+ self.run_program(['git', 'svn', 'rebase'] cwd=gitdir
def gitify_cvs(self, dirname, gitdir, spec):
self.run_program(['git', 'cvsimport', '-d', spec['url'],
@@ -230,14 +239,19 @@ class Lorry(cliapp.Application):
self.run_program(['git', 'push', '--tags', 'gitorious'], cwd=gitdir)
def run_program(self, argv, **kwargs):
+ if self.settings['command-stdout']:
+ kwargs['stdout'] = open(self.settings['command-stdout'], 'a')
+ if self.settings['command-stderr']:
+ kwargs['stderr'] = open(self.settings['command-stderr'], 'a')
logging.debug('Running: argv=%s kwargs=%s' %
(repr(argv), repr(kwargs)))
exit, out, err = self.runcmd_unchecked(argv, **kwargs)
logging.debug('Command: %s\nExit: %s\nStdout:\n%sStderr:\n%s' %
- (argv, exit, self.indent(out), self.indent(err)))
+ (argv, exit, self.indent(out or ''),
+ self.indent(err or '')))
if exit != 0:
raise Exception('%s failed (exit code %s):\n%s' %
- (' '.join(argv), exit, self.indent(err)))
+ (' '.join(argv), exit, self.indent(err or '')))
return out
def indent(self, string):