diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-01-20 16:14:09 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-01-20 16:14:43 +0000 |
commit | ab196c1135af59e4c695d098fb3c505beecb337d (patch) | |
tree | dffaea94acac75ff6f5153815f0d87cbb031592a /lorry | |
parent | 88a2edc80ca6e06649102471b7571b182ecf8b1e (diff) | |
download | lorry-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-x | lorry | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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): |