Repository: mesos Updated Branches: refs/heads/master f47dfb726 -> 68c298e64
Updated verify_reviews.py to use the git pre-commit hook. Review: https://reviews.apache.org/r/26798 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/68c298e6 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/68c298e6 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/68c298e6 Branch: refs/heads/master Commit: 68c298e640bd75a7e848b2c98046a83073046221 Parents: f47dfb7 Author: Cody Maloney <[email protected]> Authored: Thu Oct 16 18:31:53 2014 -0700 Committer: Vinod Kone <[email protected]> Committed: Thu Oct 16 18:31:53 2014 -0700 ---------------------------------------------------------------------- support/apply-review.sh | 13 ++++++++++--- support/verify-reviews.py | 16 +++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/68c298e6/support/apply-review.sh ---------------------------------------------------------------------- diff --git a/support/apply-review.sh b/support/apply-review.sh index 75ac842..bda2483 100755 --- a/support/apply-review.sh +++ b/support/apply-review.sh @@ -17,17 +17,22 @@ function usage { cat <<EOF Apache Mesos apply patch tool. -Usage: $0 [-h] [-r | -g] <ID Number> +Usage: $0 [-h] [-n] [-r | -g] <ID Number> -h Print this help message and exit + -n Don't amend the commit message -r Apply a patch from Review Board (default) -g Apply a patch from Github EOF } +AMEND=true REVIEW_LOCATION='reviewboard' -while getopts ":hrg" opt; do +while getopts ":nhrg" opt; do case $opt in + n) + AMEND=false + ;; r) REVIEW_LOCATION='reviewboard' ;; @@ -111,4 +116,6 @@ echo "Successfully applied: ${MESSAGE}" git commit --author="${AUTHOR}" -am "${MESSAGE}" || \ { echo "${RED}Failed to commit patch${NORMAL}"; exit 1; } -git commit --amend +if $AMEND; then + git commit --amend +fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mesos/blob/68c298e6/support/verify-reviews.py ---------------------------------------------------------------------- diff --git a/support/verify-reviews.py b/support/verify-reviews.py index ec8a108..13f879c 100755 --- a/support/verify-reviews.py +++ b/support/verify-reviews.py @@ -44,6 +44,9 @@ def shell(command): command, stderr=subprocess.STDOUT, shell=True) +HEAD = shell("git rev-parse HEAD") + + def api(url, data=None): auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password( @@ -59,13 +62,8 @@ def api(url, data=None): def apply_review(review_id): - review_id = str(review_id) - patch = review_id + ".patch" - diff_url = REVIEWBOARD_URL + "/r/" + review_id + "/diff/raw/" - print "Applying review %s" % review_id - shell("wget --no-check-certificate -O %s %s" % (patch, diff_url)) - shell("git apply --index %s" % patch) + shell("./support/apply-review.sh -n -r %s" % review_id) def apply_reviews(review_request, applied): @@ -97,7 +95,7 @@ def post_review(review_request, message): def cleanup(): try: shell("git clean -fd") - shell("git reset --hard HEAD") + shell("git reset --hard %s" % HEAD) except subprocess.CalledProcessError as e: print "Failed command: %s\n\nError: %s" % (e.cmd, e.output) @@ -109,10 +107,6 @@ def verify_review(review_request): applied = [] apply_reviews(review_request, applied) - # Make sure the patch is style conformant. - # TODO(vinod): Only check files/lines changed by the review. - shell("./support/mesos-style.py") - # Make sure build succeeds. shell("./bootstrap") shell("./configure")
