Skip to content

Commit e79dbc5

Browse files
committed
Add a script to help find screenshot changes.
This script is a minor modification of a script I wrote in October 2017, which was part of the internal Git repository prior to open sourcing. I'm not preserving its commit history because that script doesn't have any history of interest -- just adding comments and examples over time.
1 parent d418faf commit e79dbc5

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

bin/find_screenshot_changes

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#! /usr/bin/env zsh
2+
3+
setopt ERR_EXIT NO_UNSET PIPE_FAIL
4+
5+
# This script helps identify changes that show up in screenshots.
6+
#
7+
# Set $COMMIT to the oldest commit this script should consider:
8+
# ideally, that's the commit when the current screenshots were taken.
9+
#
10+
# Lines in the output that start with whitespace are unchanged since $COMMIT.
11+
# Lines that start with a commit ID were changed in that commit, after $COMMIT.
12+
#
13+
# To check whether we need to re-shoot the screenshots,
14+
# run this script and check whether any lines start with commit IDs.
15+
# For example:
16+
#
17+
# ./bin/find_screenshot_changes.zsh | grep -v '^ '
18+
#
19+
# To show those commits that made scheenshot changes:
20+
#
21+
# ./bin/find_screenshot_changes.zsh |
22+
# cut -d ' ' -f 1 |
23+
# sort -u |
24+
# xargs -L1 git --no-pager log -1
25+
26+
BEGIN='<!-- Apple Books screenshot begins here -->'
27+
END='<!-- Apple Books screenshot ends here -->'
28+
29+
# The commit when these comment markers were originally added.
30+
# COMMIT=64627a260ed600015dbad1a853d8b85f611b61d4
31+
32+
# The commit when the content was converted from RST to markdown.
33+
COMMIT=96f0925407c6bd9eadd9d58d253bad3e1ef7a9f2
34+
35+
cd Sources/TSPL/TSPL.docc
36+
git grep --files-with-matches $BEGIN | while IFS= read -r FILE
37+
do
38+
git --no-pager blame -bs $COMMIT.. -L /$BEGIN/,/$END/ $FILE
39+
echo
40+
echo
41+
done

0 commit comments

Comments
 (0)