Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gitlab-mirrors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wonko
gitlab-mirrors
Commits
bd717573
Commit
bd717573
authored
11 years ago
by
Sam Gleske
Browse files
Options
Downloads
Patches
Plain Diff
Adding force option to add_mirror.sh
parent
c8e5665c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG
+1
-0
1 addition, 0 deletions
CHANGELOG
add_mirror.sh
+12
-8
12 additions, 8 deletions
add_mirror.sh
with
13 additions
and
8 deletions
CHANGELOG
+
1
−
0
View file @
bd717573
...
...
@@ -3,6 +3,7 @@ gitlab-mirrors v0.2
* Colorized output enabled for all commands!
* Better argument handling on all commands!
* Project creation defaults can now be set in config.sh!
* New options for add_mirror.sh, see ./add_mirror.sh -h
* New delete_mirror.sh command!
* Knit and grit changes
* add_mirror.sh has more robust error checking.
...
...
This diff is collapsed.
Click to expand it.
add_mirror.sh
+
12
−
8
View file @
bd717573
...
...
@@ -20,6 +20,7 @@ svn=false
git
=
false
project_name
=
""
mirror
=
""
force
=
false
#
# ARGUMENT HANDLING
...
...
@@ -48,6 +49,8 @@ DESCRIPTION:
An authors file to pass to git-svn for mapping
SVN users to git users.
-f,--force Force add project even if it already exists.
--git Mirror a git repository (must be explicitly set)
-m,--mirror URL Repository URL to be mirrored.
...
...
@@ -61,8 +64,8 @@ DESCRIPTION:
EOF
}
#Short options are one letter. If an argument follows a short opt then put a colon (:) after it
SHORTOPTS
=
"hvm:p:"
LONGOPTS
=
"help,version,git,svn,mirror:,project-name:,authors-file:"
SHORTOPTS
=
"hv
f
m:p:"
LONGOPTS
=
"help,version,
force,
git,svn,mirror:,project-name:,authors-file:"
ARGS
=
$(
getopt
-s
bash
--options
"
${
SHORTOPTS
}
"
--longoptions
"
${
LONGOPTS
}
"
--name
"
${
PROGNAME
}
"
--
"
$@
"
)
eval set
--
"
$ARGS
"
while
true
;
do
...
...
@@ -83,6 +86,10 @@ while true; do
svn
=
true
shift
;;
-f
|
--force
)
force
=
true
shift
;;
-p
|
--project-name
)
project_name
=
"
${
2
}
"
shift
2
...
...
@@ -163,8 +170,8 @@ if [ ! -e "${repo_dir}/${gitlab_namespace}" ];then
elif
[
!
-d
"
${
repo_dir
}
/
${
gitlab_namespace
}
"
]
;
then
red_echo
"Error:
\"
${
repo_dir
}
/
${
gitlab_namespace
}
\"
exists but is not a directory."
1>&2
exit
1
elif
[
-d
"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
"
]
;
then
red_echo
"Error:
\"
${
repo_dir
}
/
${
gitlab_namespace
}
\"
exists already. Aborting command."
1>&2
elif
[
-d
"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
"
]
&&
!
${
force
}
;
then
red_echo
"Error:
\"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
\"
exists already. Aborting command."
1>&2
exit
1
fi
#Resolve the $authors_file path because of changing working directories
...
...
@@ -237,9 +244,6 @@ elif ${svn};then
echo
"Creating mirror from
${
mirror
}
"
cd
"
${
repo_dir
}
/
${
gitlab_namespace
}
"
if
[
!
-z
"
${
authors_file
}
"
]
;
then
echo
"
${
authors_file
}
"
#git svn clone ${git_svn_additional_options} --authors-file="${authors_file}" "${mirror}" "${project_name}"
git svn clone
"
${
mirror
}
"
"
${
project_name
}
"
${
git_svn_additional_options
}
--authors-file
=
"
${
authors_file
}
"
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment