From d940b7c737052d3316cb061c10d0196c9f82106e Mon Sep 17 00:00:00 2001
From: Sam Gleske <sag47@drexel.edu>
Date: Tue, 4 Feb 2014 16:13:03 -0500
Subject: [PATCH] hg mirror logic

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

diff --git a/add_mirror.sh b/add_mirror.sh
index 662a438..78bb85d 100755
--- a/add_mirror.sh
+++ b/add_mirror.sh
@@ -439,6 +439,22 @@ elif ${bzr};then
   green_echo "Checking the mirror into gitlab." 1>&2
   git push gitlab
   green_echo "All done!" 1>&2
+elif ${hg};then
+  #create a mirror
+  green_echo "Creating mirror from ${mirror}" 1>&2
+  cd "${repo_dir}/${gitlab_namespace}"
+  git clone --mirror hg::"${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