2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # Script for printing recent commits in a buildbot run.
8 # Return the sha1 of the given tag. If not present, return "".
12 oneline=$(cd $1 && git log -1 $2 --format='%H' 2>/dev/null)
13 if [ $? -eq 0 ] ; then
18 # Return the sha1 of HEAD, or ""
21 ( cd $1 && git log HEAD -n1 --format='%H' | cat )
24 # For the given repo, set tag to HEAD.
28 ( cd $1 && git tag -f $2 )
31 # For the given repo, delete the tag.
35 ( cd $1 && git tag -d $2 )
38 # For the given repo, set tag to "three commits ago" (for testing).
42 local sh=$(cd $1 && git log --pretty=oneline -n 3 | tail -1 | awk '{print $1}')
43 ( cd $1 && git tag -f $2 $sh )
46 # List the commits between the given tag and HEAD.
47 # If the tag does not exist, only list the last few.
48 # If the tag is at HEAD, list nothing.
49 # Output format has distinct build steps for repos with changes.
52 # $3: simple/short repo name to use for display
54 local tag_sha1=$(tt_sha1_for_tag $1 $2)
55 local head_sha1=$(tt_sha1_for_head $1)
56 local display_name=$(echo $3 | sed 's#/#_#g')
57 if [ "${tag_sha1}" = "${head_sha1}" ] ; then
60 if [ "${tag_sha1}" = "" ] ; then
61 echo "@@@BUILD_STEP Recent commits in repo $display_name@@@"
62 echo "NOTE: git tag was not found so we have no baseline."
63 echo "Here are some recent commits, but they may not be new for this build."
64 ( cd $1 && git log -n 10 --stat | cat)
66 echo "@@@BUILD_STEP New commits in repo $display_name@@@"
67 ( cd $1 && git log -n 500 $2..HEAD --stat | cat)
71 # Clean out the tree truth tags in all repos. For testing.
74 tt_delete_tag $CHROME_SRC/../$project tree_truth
78 # Print tree truth for all clank repos.
81 local full_path=$CHROME_SRC/../$project
82 tt_list_commits $full_path tree_truth $project
83 tt_tag_head $full_path tree_truth
87 # Print a summary of the last 10 commits for each repo.
89 echo "@@@BUILD_STEP Brief summary of recent CLs in every branch@@@"
92 local full_path=$CHROME_SRC/../$project
93 (cd $full_path && git log -n 10 --format=" %H %s %an, %ad" | cat)
94 echo "================================================================="
101 tt_brief_summary $PROJECT_LIST
102 tt_print_all $PROJECT_LIST