Skip to content

Commit

Permalink
Code review: 265950043: Improved diffbase support in review scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Dec 31, 2015
1 parent e80d876 commit c3d2d84
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/dpkg/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ python-plaso (1.3.1-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline <[email protected]> Sat, 05 Sep 2015 19:18:41 +0200
-- Log2Timeline <[email protected]> Tue, 15 Sep 2015 07:16:33 +0200
2 changes: 1 addition & 1 deletion plaso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__version__ = '1.3.1'

VERSION_DEV = True
VERSION_DATE = '20150905'
VERSION_DATE = '20150915'


def GetVersion():
Expand Down
8 changes: 5 additions & 3 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ linting_is_correct_remote_origin()
}

# Function to check if the linting is correct.
# Version for usage with remote upstream
linting_is_correct_remote_upstream()
# Version for usage with a remote git repository as the diffbase.
linting_is_correct_remote_diffbase()
{
DIFFBASE=$1;

# Determine the current pylint version.
PYLINT_VERSION=`pylint --version 2> /dev/null | awk '/pylint/ {print $2}' | rev | cut -c2- | rev`;

Expand All @@ -226,7 +228,7 @@ linting_is_correct_remote_upstream()
LINTER="pylint --rcfile=utils/pylintrc";
RESULT=${TRUE};

FILES=`git diff --name-only upstream/master | grep "\.py$"`;
FILES=`git diff --name-only ${DIFFBASE} | grep "\.py$"`;

for FILE in ${FILES};
do
Expand Down
6 changes: 4 additions & 2 deletions utils/review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ done

if test ${SHOW_HELP} -ne 0;
then
echo "Usage: ./${SCRIPTNAME} [--nobrowser] [--noclfile]";
echo "Usage: ./${SCRIPTNAME} [--diffbase DIFFBASE] [--help] [--nobrowser] [--noclfile]";
echo "";
echo " --diffbase: the name of the branch to use as diffbase for the CL.";
echo " The default is upstream/master";
echo "";
echo " --help: shows this help.";
echo "";
echo " --nobrowser: forces upload.py not to open a separate browser";
echo " process to obtain OAuth2 credentials for Rietveld";
echo " (https://codereview.appspot.com).";
Expand Down Expand Up @@ -165,7 +167,7 @@ then
fi
fi

if ! linting_is_correct_remote_upstream;
if ! linting_is_correct_remote_diffbase ${DIFFBASE};
then
echo "Review aborted - fix the issues reported by the linter.";

Expand Down
37 changes: 36 additions & 1 deletion utils/run_linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
EXIT_FAILURE=1;
EXIT_SUCCESS=0;

DIFFBASE="upstream/master";
SHOW_HELP=0;

if ! test -f "utils/common.sh";
then
echo "Unable to find common scripts (utils/common.sh).";
Expand All @@ -15,6 +18,38 @@ fi
# Exports GIT_URL and PROJECT_NAME.
. utils/common.sh

while test $# -gt 0;
do
case $1 in
--diffbase )
shift;
DIFFBASE=$1;
shift;
;;

-h | --help )
SHOW_HELP=1;
shift;
;;

*)
;;
esac
done

if test ${SHOW_HELP} -ne 0;
then
echo "Usage: ./${SCRIPTNAME} [--diffbase DIFFBASE] [--help]";
echo "";
echo " --diffbase: the name of the branch to use as diffbase for the CL.";
echo " The default is upstream/master";
echo "";
echo " --help: shows this help.";
echo "";

exit ${EXIT_SUCCESS};
fi

if ! linting_is_correct_remote_origin;
then
echo "Linting aborted - fix the reported issues.";
Expand All @@ -36,7 +71,7 @@ then
fi
git fetch upstream;

if ! linting_is_correct_remote_upstream;
if ! linting_is_correct_remote_diffbase ${DIFFBASE};
then
echo "Linting aborted - fix the reported issues.";

Expand Down
6 changes: 4 additions & 2 deletions utils/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fi

if test -z "${CL_NUMBER}";
then
echo "Usage: ./${SCRIPTNAME} [--nobrowser] [CL_NUMBER]";
echo "Usage: ./${SCRIPTNAME} [--diffbase DIFFBASE] [--help] [--nobrowser] [CL_NUMBER]";
echo "";
echo " CL_NUMBER: optional change list (CL) number that is to be updated.";
echo " If no CL number is provided the value is read from the";
Expand All @@ -77,6 +77,8 @@ then
echo " --diffbase: the name of the branch to use as diffbase for the CL.";
echo " The default is upstream/master";
echo "";
echo " --help: shows this help.";
echo "";
echo " --nobrowser: forces upload.py not to open a separate browser";
echo " process to obtain OAuth2 credentials for Rietveld";
echo " (https://codereview.appspot.com).";
Expand Down Expand Up @@ -131,7 +133,7 @@ then
fi
fi

if ! linting_is_correct_remote_upstream;
if ! linting_is_correct_remote_diffbase ${DIFFBASE};
then
echo "Update aborted - fix the issues reported by the linter.";

Expand Down

0 comments on commit c3d2d84

Please sign in to comment.