Files.app: Use core-icon for the dropdown button of combobutton.
[chromium-blink-merge.git] / build / tree_truth.sh
blob617092dc8a43b859a7c7868af1ced93634020a1f
1 #!/bin/bash
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 "".
9 # $1: path to repo
10 # $2: tag name
11 tt_sha1_for_tag() {
12 oneline=$(cd $1 && git log -1 $2 --format='%H' 2>/dev/null)
13 if [ $? -eq 0 ] ; then
14 echo $oneline
18 # Return the sha1 of HEAD, or ""
19 # $1: path to repo
20 tt_sha1_for_head() {
21 ( cd $1 && git log HEAD -n1 --format='%H' | cat )
24 # For the given repo, set tag to HEAD.
25 # $1: path to repo
26 # $2: tag name
27 tt_tag_head() {
28 ( cd $1 && git tag -f $2 )
31 # For the given repo, delete the tag.
32 # $1: path to repo
33 # $2: tag name
34 tt_delete_tag() {
35 ( cd $1 && git tag -d $2 )
38 # For the given repo, set tag to "three commits ago" (for testing).
39 # $1: path to repo
40 # $2: tag name
41 tt_tag_three_ago() {
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.
50 # $1: path to repo
51 # $2: tag name
52 # $3: simple/short repo name to use for display
53 tt_list_commits() {
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
58 return
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)
65 else
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.
72 tt_clean_all() {
73 for project in $@; do
74 tt_delete_tag $CHROME_SRC/../$project tree_truth
75 done
78 # Print tree truth for all clank repos.
79 tt_print_all() {
80 for project in $@; do
81 local full_path=$CHROME_SRC/../$project
82 tt_list_commits $full_path tree_truth $project
83 tt_tag_head $full_path tree_truth
84 done
87 # Print a summary of the last 10 commits for each repo.
88 tt_brief_summary() {
89 echo "@@@BUILD_STEP Brief summary of recent CLs in every branch@@@"
90 for project in $@; do
91 echo $project:
92 local full_path=$CHROME_SRC/../$project
93 (cd $full_path && git log -n 10 --format=" %H %s %an, %ad" | cat)
94 echo "================================================================="
95 done
98 CHROME_SRC=$1
99 shift
100 PROJECT_LIST=$@
101 tt_brief_summary $PROJECT_LIST
102 tt_print_all $PROJECT_LIST