Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
fe49f235
Kaydet (Commit)
fe49f235
authored
Haz 20, 2012
tarafından
Bjoern Michaelsen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add helper script for gerrit CLI integration
Change-Id: I5705530ee4d5b93bc66ca23463098ac45f49323d
üst
ade85a43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
187 additions
and
0 deletions
+187
-0
logerrit
logerrit
+187
-0
No files found.
logerrit
0 → 100755
Dosyayı görüntüle @
fe49f235
#!/bin/sh
#GERRITHOST=gerrit.libreoffice.org
GERRITHOST
=
logerrit
GERRITURL
=
ssh://
$GERRITHOST
/core
get_SHA_for_change
()
{
SHA
=
`
ssh
${
GERRITHOST
?
}
gerrit query
--all-approvals
change:
$1
|grep ref|tail
-1
|cut
-d
:
-f2
`
}
ask_tristate
()
{
case
$1
in
[
yY]
|
[
yY][Ee][Ss]
|
[
+]
)
ANSWER
=
y
;;
[
nN]
|
[
n|N][O|o]
|
[
-]
)
ANSWER
=
n
;;
[]
)
ANSWER
=
;;
*
)
echo
"Please answer with either +,-,y,n,yes,no or the empty string."
exit
1
;;
esac
}
case
"
$1
"
in
help
)
echo
"Usage: ./logerrit subcommand [options]"
echo
"subcommands:"
echo
" test test your gerrit setup"
echo
" submit [BRANCH] submit your change for review to a branch"
echo
" nextchange [BRANCH] reset branch to the remote to start with the next change"
echo
" checkout CHANGEID checkout the changes for review"
echo
" pull CHANGEID pull (and merge) the changes on current branch"
echo
" cherry-pick CHANGEID cherry-pick the change on current branch"
echo
" patch CHANGEID show the change as a patch"
echo
" review [CHANGEID] interactively review a change (current one if no changeid given)"
echo
" query .... query for changes for review on project core"
echo
" <any other gerrit command>"
exit
;;
test
)
if
test
-n
"
`
ssh
$GERRITHOST
2>&1|grep
\"
Welcome to Gerrit Code Review
\"
`
"
then
echo
"Your gerrit setup was succesfull!"
else
echo
"There seems to be trouble."
echo
"please have the output of: ssh -vvvv logerrit"
echo
"at hand when looking for help."
fi
;;
submit
)
BRANCH
=
$2
if
test
-z
"
$BRANCH
"
then
BRANCH
=
`
git symbolic-ref HEAD 2> /dev/null
`
BRANCH
=
"
${
BRANCH
##refs/heads/
}
"
if
test
-z
"
$BRANCH
"
then
echo
"no branch specified, and could not guess the current branch"
exit
1
fi
echo
"no branch specified, guessing current branch
$BRANCH
"
fi
git push
$GERRITURL
HEAD:refs/for/
$BRANCH
;;
nextchange
)
CHANGEID
=
`
git log
--format
=
format:%b
-1
HEAD|grep Change-Id|cut
-d
:
-f2
|tr
-d
\
`
if
test
-z
"
$CHANGEID
"
then
CHANGEID
=
"NOCHANGEID"
fi
BACKUPBRANCH
=
backup/
$CHANGEID
-
`
date
+%F-%H%M%S
`
git branch
$BACKUPBRANCH
echo
"current state backed up as
$BACKUPBRANCH
"
BRANCH
=
$2
if
test
-z
"
$BRANCH
"
then
BRANCH
=
`
git symbolic-ref HEAD 2> /dev/null
`
BRANCH
=
"
${
BRANCH
##refs/heads/
}
"
if
test
-z
"
$BRANCH
"
then
echo
"no branch specified, and could not guess the current branch"
exit
1
fi
echo
"no branch specified, guessing current branch
$BRANCH
"
fi
git reset
--hard
remotes/origin/
$BRANCH
;;
review
)
CHANGEID
=
$2
if
test
-z
"
$CHANGEID
"
then
CHANGEID
=
`
git log
--format
=
format:%b
-1
HEAD|grep Change-Id|cut
-d
:
-f2
`
if
test
-z
"
$CHANGEID
"
then
echo
"could not find a Change-Id in your last commit, sorry"
exit
1
fi
echo
"no Change-Id given on the command line, reviewing change
$CHANGEID
"
fi
MESSAGEREQ
=
""
read
-p
'was the change verified to build sucessfully (+) or found not to build (-) or none of that ()? '
VERIFIED
ask_tristate
$VERIFIED
case
"
$ANSWER
"
in
"y"
)
VERIFIEDFLAG
=
--verified
=
+1
;;
"n"
)
VERIFIEDFLAG
=
"--verified=-1"
MESSAGEREQ
=
"
$MESSAGEREQ
and explain why you could not verify this"
;;
*
)
VERIFIEDFLAG
=
"--verified=0"
;;
esac
read
-p
'is the code looking good (+), bad (-) or none of that ()? '
CODEREVIEW
ask_tristate
$CODEREVIEW
case
"
$ANSWER
"
in
"y"
)
read
-p
'do you approve and submit the change (+) too, or prefer someone else to do that ()? '
CODEREVIEW
ask_tristate
$CODEREVIEW
case
"
$ANSWER
"
in
"y"
)
CODEREVIEWFLAG
=
"--codereview=2 --submit"
;;
"n"
)
CODEREVIEWFLAG
=
"--codereview=1"
;;
*
)
CODEREVIEWFLAG
=
"--codereview=1"
;;
esac
;;
"n"
)
read
-p
'do you still allow the change to go in () or not (-)? '
CODEREVIEW
ask_tristate
$CODEREVIEW
case
"
$ANSWER
"
in
"y"
)
CODEREVIEWFLAG
=
"--codereview=-1"
MESSAGEREQ
=
"
$MESSAGEREQ
and explain why you have reservations about the code"
;;
"n"
)
CODEREVIEWFLAG
=
"--codereview=-2"
MESSAGEREQ
=
"
$MESSAGEREQ
and explain why you want to block this"
;;
*
)
CODEREVIEWFLAG
=
"--codereview=-1"
MESSAGEREQ
=
"
$MESSAGEREQ
and explain why you have reservations about the code"
;;
esac
;;
*
)
;;
esac
read
-p
"please type a friendly comment
$MESSAGEREQ
: "
MESSAGE
echo
ssh
${
GERRITHOST
?
}
gerrit review
-m
\"
$MESSAGE
\"
$VERIFIEDFLAG
$CODEREVIEWFLAG
$CHANGEID
;;
checkout
)
get_SHA_for_change
$2
git fetch
$GERRITURL
$SHA
&&
git checkout FETCH_HEAD
;;
pull
)
get_SHA_for_change
$2
git pull
$GERRITURL
$SHA
;;
cherry-pick
)
get_SHA_for_change
$2
git fetch
$GERRITURL
$SHA
&&
git cherry-pick FETCH_HEAD
;;
patch
)
get_SHA_for_change
$2
git fetch
$GERRITURL
$SHA
&&
git format-patch
-1
--stdout
FETCH_HEAD
;;
query
)
shift
ssh
${
GERRITHOST
?
}
gerrit query project:core
$@
;;
*
)
ssh
${
GERRITHOST
?
}
gerrit
$@
;;
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment