Skip to content
Snippets Groups Projects
Commit ff3a31f2 authored by Sam Gleske's avatar Sam Gleske
Browse files

Merge branch 'feature/hg_mirror' into development

parents 60b2ddd1 82e80f84
No related branches found
No related tags found
No related merge requests found
## v0.4.4
* Added Mercurial mirroring support. `add_mirror.sh` now has the `--hg` option when adding a repository.
---
## v0.4.3
* Added `no_create_set` option to `config.sh`. This option forces the user to always provide a remote for pushing repositories via the `--no-create` option in `add_mirror.sh`.
......
......@@ -5,7 +5,7 @@ The [gitlab-mirrors](https://github.com/sag47/gitlab-mirrors) project is designe
## Features
* Mirror different types of repositories: Bazaar, git, subversion.
* Mirror different types of source repositories: Bazaar, Git, Mercurial, Subversion. Mirror all into git.
* GitLab mirror adding.
* When adding a mirror if the project doesn't exist in GitLab it will be auto-created.
* Set project creation defaults (e.g. issues enabled, wiki enabled, etc.)
......
......@@ -24,6 +24,7 @@ PROGVERSION="${VERSION}"
svn=false
git=false
bzr=false
hg=false
project_name=""
mirror=""
force=false
......@@ -76,13 +77,15 @@ REPOSITORY TYPES:
--git Mirror a git repository (must be explicitly set)
--hg Mirror a Mercurial repository (must be explicitly set)
--svn Mirror a SVN repository (must be explicitly set)
EOF
}
#Short options are one letter. If an argument follows a short opt then put a colon (:) after it
SHORTOPTS="hvfm:n:p:"
LONGOPTS="help,version,force,git,svn,bzr,mirror:,no-create:,project-name:,authors-file:"
LONGOPTS="help,version,force,git,svn,bzr,hg,mirror:,no-create:,project-name:,authors-file:"
ARGS=$(getopt -s bash --options "${SHORTOPTS}" --longoptions "${LONGOPTS}" --name "${PROGNAME}" -- "$@")
eval set -- "$ARGS"
while true; do
......@@ -107,6 +110,10 @@ while true; do
bzr=true
shift
;;
--hg)
hg=true
shift
;;
-f|--force)
force=true
set +e
......@@ -160,6 +167,10 @@ function preflight() {
((types += 1))
selected_types+=('--bzr')
fi
if ${hg};then
((types += 1))
selected_types+=('--hg')
fi
if [ "${types}" -eq "0" ];then
red_echo -n "Must select at least one repository type. e.g. "
yellow_echo "--git"
......@@ -428,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
......
......@@ -15,6 +15,10 @@ If you plan on mirroring BZR repositories then you'll need the following adition
* [git-bzr-helper][8]
If you plan on mirroring Mercurial repositories then you'll need the following aditional options.
* [git-hg-helper][9]
### Required software install snippets
#### python-gitlab
......@@ -48,8 +52,15 @@ Your git should now be located in `/usr/local/bin/git`. You should edit `/etc/p
sudo -i -u gitmirror
mkdir ~/bin
wget https://raw.github.com/felipec/git/fc/master/git-remote-bzr.py -O ~/bin/git-remote-bzr
chmod 755 ~bin/git-remote-bzr
chmod 755 ~/bin/git-remote-bzr
#### git-hg-helper
sudo -i -u gitmirror
sudo apt-get install python-rope
mkdir ~/bin
wget https://raw.github.com/felipec/git/fc/master/git-remote-hg.py -O ~/bin/git-remote-hg
chmod 755 ~/bin/git-remote-hg
---
Next up is [Installation and Setup](installation.md).
......@@ -62,3 +73,4 @@ Next up is [Installation and Setup](installation.md).
[6]: http://git-scm.com/book/en/Getting-Started-Installing-Git
[7]: https://www.kernel.org/pub/software/scm/git/docs/git-svn.html
[8]: https://github.com/felipec/git/wiki/git-remote-bzr
[9]: https://github.com/felipec/git/wiki/git-remote-hg
VERSION="v0.4.4pre"
VERSION="v0.4.4"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment