forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prstat
executable file
·32 lines (27 loc) · 1.05 KB
/
prstat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# prstat -- Report the lines of code added or changed in the current tree vs
# upsteam/master, excluding files that are known not to count against the line
# limit for platform review.
set -e
# Exclude data files and files that are in a /dev/ folder.
excludes=""
excludes="$excludes --exclude=*.mtl"
excludes="$excludes --exclude=*.obj"
excludes="$excludes --exclude=*.sdf"
excludes="$excludes --exclude=*.urdf"
excludes="$excludes --exclude=*.xml"
excludes="$excludes --exclude=*/dev/*"
# Also exclude files that contain the reviewable.io phrase that indicates
# generated code. See https://github.com/Reviewable/Reviewable/wiki/FAQ.
marker="GENERATED FILE ""DO NOT EDIT"
toplevel=$(git rev-parse --show-toplevel)
git_base_path=upstream/master
for relpath in $(git diff $git_base_path | lsdiff $excludes --strip=1); do
if fgrep -s -q -e"$marker" $toplevel/$relpath; then
excludes="$excludes --exclude=$relpath"
fi
done
# Display a final summary.
git diff $git_base_path |
filterdiff --strip-match=1 --strip=1 $excludes |
diffstat -p 0