"tools" updates.
Remove backport-change. It didn't work as well as I had hoped. Remove backport-rev since we don't use Subversion any more. Remove DocBook code from gen-bugnote. Change-Id: I70f39444c6cdd380301691f64d27147ac09e5cae Reviewed-on: https://code.wireshark.org/review/348 Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
58db464aff
commit
57048843e9
|
@ -1,167 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# backport-change - Given a master git commit or trunk SVN revision, creates
|
||||
# a backport request in Gerrit.
|
||||
#
|
||||
# Copyright 2013 Gerald Combs
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
# A more complete and likely more robust workflow can be found at
|
||||
# http://www.mediawiki.org/wiki/Gerrit/Advanced_usage#Submitting_a_change_to_a_branch_for_review_.28.22backporting.22.29
|
||||
|
||||
export GIT_PAGER=""
|
||||
TOOLS_DIR=`dirname $0`
|
||||
COMMIT_MSG_HOOK=`git rev-parse --git-dir`/hooks/commit-msg
|
||||
|
||||
function exit_err
|
||||
{
|
||||
if [ -n "$*" ] ; then
|
||||
echo -e "Error: $*\n"
|
||||
fi
|
||||
echo "Usage:"
|
||||
echo `basename $0` "<svn revision|git sha>"
|
||||
echo "SVN revisions MUST be prefixed with \"r\""
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if pbcopy (or similar) is available...
|
||||
if [ `builtin type -p pbcopy` ] ; then
|
||||
PBCOPY="pbcopy"
|
||||
fi
|
||||
|
||||
if [ `builtin type -p xsel` ] ; then
|
||||
PBCOPY="xsel --clipboard --input"
|
||||
fi
|
||||
|
||||
if [ `builtin type -p putclip` ] ; then
|
||||
PBCOPY="putclip"
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure we have a destination
|
||||
#
|
||||
|
||||
git ls-remote --heads gerrit &> /dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit_err "Can't find a remote named \"gerrit\".\nAdd one with one of\n" \
|
||||
"\n git remote add gerrit https://your.username@code.wireshark.org/review/wireshark" \
|
||||
"\n git remote add gerrit ssh://your.username@code.wireshark.org:29418/wireshark"
|
||||
fi
|
||||
|
||||
if [ ! -f "$COMMIT_MSG_HOOK" ] ; then
|
||||
exit_err "Can't find a commit-msg hook.\nDownload it with one with one of\n" \
|
||||
"\n curl -Lo .git/hooks/commit-msg https://code.wireshark.org/review/tools/hooks/commit-msg" \
|
||||
"\n scp -p -P 29418 your.username@code.wireshark.org:hooks/commit-msg .git/hooks/"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Make sure our working directory is clean
|
||||
#
|
||||
|
||||
git diff --quiet HEAD || exit_err "You have changes in your working directory. Please clean them up."
|
||||
|
||||
#
|
||||
# Make sure we're up to date
|
||||
#
|
||||
git fetch gerrit
|
||||
|
||||
#
|
||||
# Find our change
|
||||
#
|
||||
|
||||
CHANGE="$1"
|
||||
LONG_HASH=""
|
||||
TOPIC=""
|
||||
|
||||
if [ -z "$CHANGE" ] ; then exit_err ; fi
|
||||
|
||||
if [[ $CHANGE = r* ]] ; then
|
||||
# Subversion
|
||||
SVN_REV=${CHANGE:1}
|
||||
LONG_HASH=`git log gerrit/master --grep "svn path=/trunk/; revision=${SVN_REV}\$" -1 --format=format:%H`
|
||||
if [ -z "$LONG_HASH" ] ; then exit_err "Can't find SVN revision $CHANGE" ; fi
|
||||
TOPIC="/backport-$CHANGE"
|
||||
else
|
||||
# Git
|
||||
LONG_HASH=`git rev-parse $CHANGE`
|
||||
SHORT_HASH=`git rev-parse --short $CHANGE`
|
||||
if [ -z "$LONG_HASH" ] ; then exit_err "Can't find git commit $CHANGE" ; fi
|
||||
TOPIC="/backport-g$SHORT_HASH"
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure our upstream is valid
|
||||
#
|
||||
|
||||
UPSTREAM_NAME=`git rev-parse --abbrev-ref --symbolic-full-name @{upstream}`
|
||||
UPSTREAM_NAME=`basename $UPSTREAM_NAME`
|
||||
|
||||
if [ $? -ne 0 -o -z "$UPSTREAM_NAME" ] ; then exit_err "Can't find upstream branch." ; fi
|
||||
|
||||
if [[ $UPSTREAM_NAME != master-[0-9].[0-9]* ]] ; then
|
||||
exit_err "Can't backport to remote branch $UPSTREAM_NAME."
|
||||
fi
|
||||
|
||||
PUSH_CMD="git push gerrit HEAD:refs/for/${UPSTREAM_NAME}${TOPIC}"
|
||||
|
||||
#
|
||||
# On with the show
|
||||
#
|
||||
|
||||
echo "Backporting $LONG_HASH"
|
||||
git cherry-pick -x --strategy=recursive -Xtheirs $LONG_HASH
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo "Running diff"
|
||||
git diff
|
||||
|
||||
# XXX We might want to install Gerrit's commit-msg hook instead, e.g.
|
||||
# scp -p -P 29418 <user>@code.wireshark.org:hooks/commit-msg .git/hooks/
|
||||
|
||||
echo
|
||||
echo "Attempting push to gerrit HEAD:refs/for/$UPSTREAM_NAME"
|
||||
$PUSH_CMD
|
||||
|
||||
if [ $? -ne 0 ] ; then
|
||||
# XXX - We might want to check for the commit-msg hook and if it's
|
||||
# present run git revert + git commit as described at
|
||||
# http://code.google.com/p/gerrit/issues/detail?id=843#c4
|
||||
cat <<FIN
|
||||
|
||||
Push failed. If the server is complaining about a missing change id
|
||||
copy it and run
|
||||
|
||||
git commit --amend
|
||||
# Insert the change id in your editor
|
||||
$PUSH_CMD
|
||||
FIN
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 4
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
# :indentSize=4:tabSize=8:noTabs=true:
|
||||
#
|
|
@ -1,157 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyrev - copies a revision from the Wireshark trunk to the current
|
||||
# directory.
|
||||
#
|
||||
# Usage: backport-rev <svn revision>
|
||||
#
|
||||
# Copyright 2013 Gerald Combs
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
if [ -z "$VISUAL" ] ; then
|
||||
VISUAL=$EDITOR
|
||||
fi
|
||||
|
||||
#Check if pbcopy (or similar) is available...
|
||||
if [ `builtin type -p pbcopy` ] ; then
|
||||
PBCOPY="pbcopy"
|
||||
fi
|
||||
|
||||
if [ `builtin type -p xsel` ] ; then
|
||||
PBCOPY="xsel --clipboard --input"
|
||||
fi
|
||||
|
||||
if [ `builtin type -p putclip` ] ; then
|
||||
PBCOPY="putclip"
|
||||
fi
|
||||
|
||||
if [ -z "$PBCOPY" ] ; then
|
||||
echo "Can't find a clipboard copy. Check if pbcopy, xsel or putclip is installed in your system"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function exit_err
|
||||
{
|
||||
if [ -n "$*" ] ; then
|
||||
echo "$*"
|
||||
fi
|
||||
echo -n $patchfile | $PBCOPY
|
||||
echo "Patch saved to $patchfile and copied to pasteboard"
|
||||
if [ -n "$VISUAL" ] ; then
|
||||
"$VISUAL" $patchfile $logfile
|
||||
else
|
||||
echo "Can't find an editor. You'll have to open $patchfile and $logfile yourself."
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
subdir=""
|
||||
trunk="trunk"
|
||||
|
||||
while getopts "at:" opt ; do
|
||||
case $opt in
|
||||
a)
|
||||
subdir="/asn1"
|
||||
;;
|
||||
t)
|
||||
trunk="trunk-$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Unknown option -$OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
svninfo="`svn info | grep ^URL | cut -f2 -d' '`"
|
||||
if [ -z "$svninfo" ] ; then
|
||||
exit_err "Can't find repository information. Are you running this from a Wireshark SVN directory?"
|
||||
fi
|
||||
|
||||
svnurl=`dirname $svninfo`
|
||||
svnurl="$svnurl/$trunk"
|
||||
#svnurl="$HOME/Development/wireshark"
|
||||
|
||||
rev="$1"
|
||||
|
||||
patchfile="/tmp/backport-rev-$rev.patch"
|
||||
logfile="/tmp/backport-rev-$rev.log"
|
||||
mergefile="/tmp/backport-rev-$rev.merge"
|
||||
oldrev=$(( $rev - 1 ))
|
||||
echo "Working on r$rev ($oldrev)"
|
||||
|
||||
echo -n "Attempting 'svn merge' dry run. "
|
||||
if [ -n "$subdir" ] ; then
|
||||
cd .$subdir
|
||||
fi
|
||||
|
||||
svn diff --diff-cmd /usr/bin/diff -x "-w -b -U 5" -c $rev $svnurl$subdir \
|
||||
> $patchfile || exit_err "Error"
|
||||
|
||||
svn log -v -r $rev $svnurl | sed -e 's/^..*/ &/' > $logfile || exit 1
|
||||
|
||||
merge_err=0
|
||||
# Some versions of svn always return 0. Check the return value then look
|
||||
# for a "Summary of conflicts" line.
|
||||
svn merge --dry-run -c$rev $svnurl > $mergefile 2>&1
|
||||
merge_err=$?
|
||||
grep '^Summary' $mergefile > /dev/null 2>&1 && merge_err=1
|
||||
|
||||
if [ $merge_err -ne 0 ] ; then
|
||||
echo "Error. Dry run output follows."
|
||||
echo ""
|
||||
cat $mergefile
|
||||
rm $mergefile
|
||||
echo ""
|
||||
dry_run_cmd="patch --batch --ignore-whitespace --strip=0 --dry-run"
|
||||
echo "Merge failed. Trying 'patch' dry run:"
|
||||
echo " $dry_run_cmd < $patchfile"
|
||||
echo ""
|
||||
$dry_run_cmd < $patchfile
|
||||
echo ""
|
||||
exit_err "Giving up. You'll have to merge the patch yourself."
|
||||
fi
|
||||
|
||||
rm $mergefile
|
||||
|
||||
echo "OK"
|
||||
echo "Attempting 'svn merge' live run:"
|
||||
svn merge -c$rev $svnurl
|
||||
|
||||
if [ -n "$subdir" ] ; then
|
||||
cd ..
|
||||
fi
|
||||
echo Done with r$rev
|
||||
|
||||
echo "Copy over revisions from the trunk:"
|
||||
echo ""
|
||||
uniq < $logfile
|
||||
|
||||
rm -v $patchfile $logfile
|
||||
|
||||
#
|
||||
# Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
#
|
||||
# Local variables:
|
||||
# c-basic-offset: 4
|
||||
# tab-width: 8
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
#
|
||||
# vi: set shiftwidth=4 tabstop=8 expandtab:
|
||||
# :indentSize=4:tabSize=8:noTabs=true:
|
||||
#
|
|
@ -22,19 +22,6 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
output_fmt="docbook"
|
||||
if [ -f release-notes.asciidoc -o -f docbook/release-notes.asciidoc ] ; then
|
||||
output_fmt="asciidoc"
|
||||
fi
|
||||
|
||||
while getopts "o:" OPT ; do
|
||||
case $OPT in
|
||||
o) output_fmt=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
bz_url_pfx="https://bugs.wireshark.org/bugzilla/show_bug.cgi?id="
|
||||
bug_id="$1"
|
||||
|
||||
|
@ -71,22 +58,8 @@ bug_title=`
|
|||
-e 's/[^\.]$/&./' \
|
||||
`
|
||||
|
||||
case "$output_fmt" in
|
||||
asciidoc)
|
||||
echo -e "* $bug_title (ws-buglink:$bug_id[])\n" \
|
||||
| $recode_cmd \
|
||||
| $clipboard_cmd
|
||||
;;
|
||||
docbook)
|
||||
$clipboard_cmd <<Fin
|
||||
<listitem><para>
|
||||
$bug_title
|
||||
(<ulink url="https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=$bug_id">Bug
|
||||
$bug_id</ulink>)
|
||||
</para></listitem>
|
||||
|
||||
Fin
|
||||
;;
|
||||
esac
|
||||
echo -e "* $bug_title (ws-buglink:$bug_id[])\n" \
|
||||
| $recode_cmd \
|
||||
| $clipboard_cmd
|
||||
|
||||
echo "Copied $bug_id: $bug_title"
|
||||
|
|
Loading…
Reference in New Issue