Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
dedal
Commits
009c2f1b
Commit
009c2f1b
authored
1 year ago
by
Philipp Spilger
Browse files
Options
Downloads
Patches
Plain Diff
chore: Remove unused gerrit functions from commons.sh
Change-Id: I0492165c33dfcbb1da51ee069fc114b85da1a105
parent
551ec623
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/yashchiki/commons.sh
+0
-105
0 additions, 105 deletions
lib/yashchiki/commons.sh
with
0 additions
and
105 deletions
lib/yashchiki/commons.sh
+
0
−
105
View file @
009c2f1b
...
...
@@ -596,108 +596,3 @@ EOF
${
MY_SPACK_BIN
}
find
-vL
"
$@
"
|
awk
-f
"
${
FILE_AWK
}
"
|
sort
-V
|
cut
-d
' '
-f
2 |
tail
-n
1
rm
"
${
FILE_AWK
}
"
}
##########
# GERRIT #
##########
# Get gerrit username
gerrit_username
()
{
get_host_env GERRIT_USERNAME hudson
}
# Read the current gerrit config from `.gitreview` into global variables:
# * gerrit_branch
# * gerrit_remote
# * gerrit_host
# * gerrit_port
# * gerrit_project
#
# Unfortunately, since we cannot return values from function, they have to be
# global variables.
gerrit_read_config
()
{
local
git_dir
git_dir
=
"
$(
git rev-parse
--show-toplevel
)
"
# remote branch
gerrit_branch
=
"
$(
grep
"^defaultbranch="
"
${
git_dir
}
/.gitreview"
|
cut
-d
=
-f
2
)
"
gerrit_remote
=
"
$(
grep
"^defaultremote="
"
${
git_dir
}
/.gitreview"
|
cut
-d
=
-f
2
)
"
gerrit_host
=
"
$(
grep
"^host="
"
${
git_dir
}
/.gitreview"
|
cut
-d
=
-f
2
)
"
gerrit_port
=
"
$(
grep
"^port="
"
${
git_dir
}
/.gitreview"
|
cut
-d
=
-f
2
)
"
gerrit_project
=
"
$(
grep
"^project="
"
${
git_dir
}
/.gitreview"
|
cut
-d
=
-f
2
)
"
}
# Ensure that the gerrit remote is properly set up in the current git directory.
gerrit_ensure_setup
()
{
gerrit_read_config
if
!
git remote |
grep
-q
"
${
gerrit_remote
}
"
;
then
# ensure git review is set up
git remote add
"
${
gerrit_remote
}
"
"ssh://
$(
gerrit_username
)
@
${
gerrit_host
}
:
${
gerrit_port
}
/
${
gerrit_project
}
"
fi
git fetch
"
${
gerrit_remote
}
"
"
${
gerrit_branch
}
"
}
gerrit_filter_current_change_commits
()
{
awk
'$1 ~ /^commit$/ { commit=$2 }; $1 ~ /^Change-Id:/ { print commit }'
}
# Get the current stack of changesets in the current git repo as commit ids.
gerrit_get_current_change_commits
()
{
gerrit_ensure_setup
# only provide change-ids that are actually present in gerrit
comm
-1
-2
\
<
(
git log
"
${
gerrit_remote
}
/
${
gerrit_branch
}
..HEAD"
\
| gerrit_filter_current_change_commits |
sort
)
\
<
(
git ls-remote
"
${
gerrit_remote
}
"
|
awk
'$2 ~ /^refs\/changes/ { print $1 }'
|
sort
)
}
# Convenience method to print the ssh command necessary to connect to gerrit.
#
# Note: Make sure the gerrit config was read prior to calling this!
gerrit_cmd_ssh
()
{
echo
-n
"ssh -p
${
gerrit_port
}
$(
gerrit_username
)
@
${
gerrit_host
}
gerrit"
}
# Post comment on the given change-id
#
# Gerrit host/post will be read from current git repository.
#
# Args:
# -c <change>
# -m <message>
gerrit_notify_change
()
{
local
change
=
""
local
message
=
""
local
verified
=
""
local
opts OPTIND OPTARG
while
getopts
":c:m:v:"
opts
;
do
case
"
${
opts
}
"
in
c
)
change
=
"
${
OPTARG
}
"
;;
m
)
message
=
"
${
OPTARG
}
"
;;
v
)
verified
=
"
${
OPTARG
}
"
;;
*
)
echo
"Invalid argument:
${
opts
}
"
>
&2
return
1
;;
esac
done
shift
$((
OPTIND
-
1
))
if
[
-z
"
${
change
}
"
]
;
then
echo
"ERROR: No change to post to given!"
>
&2
return
1
fi
if
[
-z
"
${
message
}
"
]
;
then
echo
"ERROR: No message given!"
>
&2
return
1
fi
gerrit_read_config
$(
gerrit_cmd_ssh
)
review
--message
"
\"
${
message
}
\"
"
\
"
$(
[
-n
"
${
verified
}
"
]
&&
echo
--verified
"
${
verified
}
"
)
"
\
"
${
change
}
"
}
This diff is collapsed.
Click to expand it.
Preview
0%
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