From 463c41996dc652a6fc7920d55ce8935e28b697a3 Mon Sep 17 00:00:00 2001
From: agb80 <atin81@gmail.com>
Date: Thu, 7 Nov 2013 21:18:41 -0600
Subject: [PATCH] Added bzr support (Initial commit)

---
 add_mirror.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/add_mirror.sh b/add_mirror.sh
index 361f1d1..681bdcb 100755
--- a/add_mirror.sh
+++ b/add_mirror.sh
@@ -63,6 +63,7 @@ DESCRIPTION:
 
   --svn              Mirror a SVN repository (must be explicitly set)
 
+  --bzr              Mirror a Bazar repository (must be explicitly set)
 
 EOF
 }
@@ -89,6 +90,10 @@ while true; do
         svn=true
         shift
       ;;
+    --bzr)
+        bzr=true
+        shift
+      ;;
     -f|--force)
         force=true
         set +e
@@ -347,6 +352,22 @@ elif ${svn};then
   git push gitlab
   git config --bool core.bare false
   green_echo "All done!" 1>&2
+elif ${bzr};then
+  #create a mirror
+  green_echo "Creating mirror from ${mirror}" 1>&2
+  cd "${repo_dir}/${gitlab_namespace}"
+  git clone bzr::"${mirror}" "${project_name}"
+  # cleaning repo
+  cd "${project_name}"
+  git gc --aggressive
+  #add the gitlab remote
+  git remote add gitlab "${gitlab_remote}"
+  git config --add remote.gitlab.push '+refs/heads/*:refs/heads/*'
+  git config --add remote.gitlab.push '+refs/tags/*:refs/tags/*'
+  #Check the initial repository into gitlab
+  green_echo "Checking the mirror into gitlab." 1>&2
+  git push gitlab
+  green_echo "All done!" 1>&2
 else
   red_echo "Something has gone very wrong.  You should never see this message."
   exit 1
-- 
GitLab