Skip to content

Instantly share code, notes, and snippets.

@yariksheptykin
Created May 31, 2017 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yariksheptykin/645aa43ccb22844131e631c21cb5209b to your computer and use it in GitHub Desktop.
Save yariksheptykin/645aa43ccb22844131e631c21cb5209b to your computer and use it in GitHub Desktop.
Generates a list of partial diffs for https://reviewboard.mozilla.org/r/117282
#!/usr/bin/env bash
# assumuing the file is in toolkit/componetsn/telemetry
TELEMETRY="Telemetry.cpp"
# Get the copy of Telemety
hg revert -r central $TELEMETRY
declare -A COMPARE_FILE_AREAS=(
# Filename => from:to (Telemetry.cpp) | from:to (Filename)
["KeyedStackCapturer.cpp"]="427:610|15:164"
["KeyedStackCapturer.h"]="472:510|22:72"
["CombinedStacks.cpp"]="103:244|15:193"
["CombinedStacks.h"]="108:137|19:45"
["HangReports.cpp"]="246:425|12:153"
["HangReports.h"]="246:308|20:78"
)
mkdir -p /tmp/diffs/
for filename in $"${!COMPARE_FILE_AREAS[@]}"; do
# Parse the line diff rage
IFS='|' read range1 range2 <<< ${COMPARE_FILE_AREAS[$filename]}
bash ./diff-lines.sh $range1@$TELEMETRY $range2@$filename > /tmp/diffs/$TELEMETRY-vs-$filename.diff
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment