[PATCH 2/3] remote-bzr: add support for pushing
From: Felipe Contreras <hidden>
Date: 2016-06-15 22:55:11
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Felipe Contreras <redacted> --- contrib/remote-helpers/git-remote-bzr | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 76a609a..de37217 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr@@ -26,6 +26,9 @@ bzrlib.plugin.load_plugins() import bzrlib.revisionspec from bzrlib.plugins.fastimport import exporter as bzr_exporter +from bzrlib.plugins.fastimport.processors import generic_processor as bzr_generic_processor + +import fastimport.parser import sys import os
@@ -140,9 +143,38 @@ def do_import(parser): sys.stdout.flush() +def do_export(parser): + global dirname + + parser.next() # can't handle 'done'? + + controldir = parser.repo.bzrdir + + path = os.path.join(dirname, 'marks-bzr') + params = { 'import-marks': path, 'export-marks': path } + + proc = bzr_generic_processor.GenericProcessor(controldir, params) + p = fastimport.parser.ImportParser(sys.stdin) + proc.process(p.iter_commands) + + if parser.repo.last_revision() != marks.get_tip('master'): + print 'ok %s' % 'refs/heads/master' + + print + def do_capabilities(parser): + global dirname + print "import" + print "export" print "refspec refs/heads/*:%s/heads/*" % prefix + + path = os.path.join(dirname, 'marks-git') + + if os.path.exists(path): + print "*import-marks %s" % path + print "*export-marks %s" % path + print def do_list(parser):
@@ -178,6 +210,8 @@ def main(args): do_list(parser) elif parser.check('import'): do_import(parser) + elif parser.check('export'): + do_export(parser) else: die('unhandled command: %s' % line) sys.stdout.flush()
--
1.8.0