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
ca4c1045
Commit
ca4c1045
authored
11 years ago
by
Sam Gleske
Browse files
Options
Downloads
Patches
Plain Diff
New delete_mirror command. Updated CHANGELOG
parent
7d0d22ef
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG
+15
-0
15 additions, 0 deletions
CHANGELOG
add_mirror.sh
+4
-4
4 additions, 4 deletions
add_mirror.sh
delete_mirror.sh
+125
-0
125 additions, 0 deletions
delete_mirror.sh
with
144 additions
and
4 deletions
CHANGELOG
+
15
−
0
View file @
ca4c1045
gitlab-mirrors v0.2
* Renamed project from git-mirrors to gitlab-mirrors.
* Colorized output enabled for all commands!
* Better argument handling on all commands!
* Project creation defaults can now be set in config.sh!
* New delete_mirror.sh command!
* Knit and grit changes
* add_mirror.sh has more robust error checking.
* add_mirror.sh options can be out of order. Now using getopt for
better argument handling.
* lib/create_gitlab_project.py has been renamed to
lib/manage_gitlab_project.py
* manage_gitlab_project.py has a little better error handling.
Added optparse for better argument handling.
git-mirrors v0.1.1
* Minor update to documentation adding project URL to docs.
...
...
This diff is collapsed.
Click to expand it.
add_mirror.sh
+
4
−
4
View file @
ca4c1045
#!/bin/bash
#Tue Sep 10 23:01:08 EDT 2013
#USAGE
# ./add_mirror.sh --git --project-name
# ./add_mirror.sh --git --project-name
someproject --mirror http://example.com/project.git
#bash option stop on first error
set
-e
...
...
@@ -25,6 +25,7 @@ mirror=""
#
# ARGUMENT HANDLING
#
usage
()
{
cat
<<
EOF
...
...
@@ -44,9 +45,9 @@ DESCRIPTION:
-v,--version Show program version
--git Mirror a git repository (must be explicitly set)
--svn Mirror a SVN repository (must be explicitly set)
--project-name NAME
-p,
--project-name NAME
Set a GitLab project name to NAME.
--mirror URL
Repository URL to be mirrored.
-m,
--mirror URL Repository URL to be mirrored.
EOF
...
...
@@ -88,7 +89,6 @@ while true; do
;;
*
)
shift
break
;;
esac
done
...
...
This diff is collapsed.
Click to expand it.
delete_mirror.sh
0 → 100755
+
125
−
0
View file @
ca4c1045
#!/bin/bash
#Thu Sep 12 16:04:35 EDT 2013
#bash option stop on first error
set
-e
#Include all user options and dependencies
git_mirrors_dir
=
"
$(
dirname
"
${
0
}
"
)
"
cd
"
${
git_mirrors_dir
}
"
.
"config.sh"
.
"lib/VERSION"
.
"lib/functions.sh"
PROGNAME
=
"
${
0
##*/
}
"
PROGVERSION
=
"
${
VERSION
}
"
#Default script options
project_name
=
""
quiet
=
false
#
# ARGUMENT HANDLING
#
usage
()
{
cat
<<
EOF
${
PROGNAME
}
${
PROGVERSION
}
- MIT License by Sam Gleske
USAGE:
${
PROGNAME
}
--delete PROJECT
DESCRIPTION:
This program deletes a project so that it will no longer be mirrored.
-h,--help Show help
-v,--version Show program version
-d,--delete PROJECT
Deletes a project so it is no longer mirrored.
-q,--quiet Suppress user confirmation messages.
EOF
}
#Short options are one letter. If an argument follows a short opt then put a colon (:) after it
SHORTOPTS
=
"hvd:q"
LONGOPTS
=
"help,version,delete:,quiet"
ARGS
=
$(
getopt
-s
bash
--options
"
${
SHORTOPTS
}
"
--longoptions
"
${
LONGOPTS
}
"
--name
"
${
PROGNAME
}
"
--
"
$@
"
)
eval set
--
"
$ARGS
"
while
true
;
do
case
$1
in
-h
|
--help
)
usage
exit
1
;;
-v
|
--version
)
echo
"
${
PROGNAME
}
${
PROGVERSION
}
"
exit
1
;;
-d
|
--delete
)
project_name
=
"
${
2
}
"
shift
2
;;
-q
|
--quiet
)
quiet
=
true
shift
;;
--
)
shift
break
;;
*
)
shift
;;
esac
done
#
# Program functions
#
function
preflight
()
{
STATUS
=
0
if
[
-z
"
${
project_name
}
"
]
;
then
red_echo
-n
"Must specify "
1>&2
yellow_echo
-n
"--delete"
1>&2
red_echo
" option."
1>&2
STATUS
=
1
fi
return
${
STATUS
}
}
#
# Main execution
#
#Run a preflight check on options for compatibility.
if
!
preflight
;
then
echo
"Command aborted due to previous errors."
1>&2
exit
1
fi
if
!
${
quiet
}
;
then
echo
-n
"Will DELETE "
red_echo
"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
"
echo
echo
-n
"Are you sure you wish to delete project "
yellow_echo
-n
"
${
gitlab_namespace
}
/
${
project_name
}
"
echo
-n
"? (y/N): "
read
ans
echo
#convert upper case to lower case
ans
=
"
$(
echo
"
${
ans
}
"
|
tr
'[A-Z]'
'[a-z]'
)
"
if
[
!
"
${
ans
}
"
=
"y"
-a
!
"
${
ans
}
"
=
"yes"
]
;
then
echo
"User aborted operation."
1>&2
exit
1
fi
fi
rm
-rf
"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
"
green_echo
-n
"DELETED"
echo
"
${
repo_dir
}
/
${
gitlab_namespace
}
/
${
project_name
}
"
echo
yellow_echo
-n
"**NOTE**:"
echo
" You must log into the GitLab web interface in order to delete the project from GitLab!"
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