Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to