Skip to content

Commit

Permalink
html version with source diff with the help of https://github.com/rtf…
Browse files Browse the repository at this point in the history
  • Loading branch information
palaniraja committed Mar 14, 2019
1 parent b70fdbb commit 30f731d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 9 deletions.
25 changes: 25 additions & 0 deletions head.html

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions tail.html
@@ -0,0 +1,24 @@
</table>
<script type="text/javascript">

function doDiff(){
for (var i = 0; i <fileCount; i++) {
var rawDiff = document.getElementById('rawDiff'+i).value;
var outDiff = document.getElementById('outDiff'+i)

var diffHtml = Diff2Html.getPrettyHtml(rawDiff, {
inputFormat: 'diff',
showFiles: false,
matching: 'words',
outputFormat: 'side-by-side'
}
);
outDiff.innerHTML = diffHtml;
}
}

doDiff();

</script>
</body>
</html>
35 changes: 26 additions & 9 deletions whatchanged.sh
@@ -1,27 +1,44 @@


echo "Usage: $0 <startCommitSHA> <startCommitSHA>\n\n" echo "===========================================\n"
echo "Usage: $0 <startCommitSHA> <startCommitSHA>\n"
echo "===========================================\n\n\n"


outputFile="out.html" outputFile="diff.html"
rm $outputFile && touch $outputFile rm $outputFile && touch $outputFile
# 3b9aea39c7..37c07544408b # 3b9aea39c7..37c07544408b
diffString=""
index=0


echo "Start from Commit SHA: $1\n" echo "Start from Commit SHA: $1\n"
echo "End at Commit SHA: $2" echo "End at Commit SHA: $2"


`echo "<html><head><style>td{white-space: pre;}</style></head><body><table border=1>" >> $outputFile` `cat head.html >> $outputFile`


echo "<p>Files changed between <b>$1</b> and <b>$2</b></p>" >> $outputFile
echo "<table border=1 style='border-collapse: collapse;'>" >> $outputFile
git log --pretty='format:' --name-only $1..$2 | sort -u | while read line git log --pretty='format:' --name-only $1..$2 | sort -u | while read line
do do
if [ -n "${line}" ]; then if [ -n "${line}" ]; then
`echo "<tr>" >> $outputFile` `echo "<tr>" >> $outputFile`
`echo "<td>File: ($line)</td>" >> $outputFile` `echo "<td> <h3>File: ($line)</h3>" >> $outputFile`
`echo "<td>" >> $outputFile` `echo "<p>" >> $outputFile`
git log --pretty=oneline --abbrev-commit $1..$2 -- $line >> $outputFile
`echo "</td></tr>" >> $outputFile`


git log --pretty=oneline --abbrev-commit $1..$2 -- $line >> $outputFile
# --all --full-history # --all --full-history

`echo "</p><textarea class='rawDiff' id='rawDiff$index'>" >> $outputFile`

diffString=$(git diff $1..$2 -- $line)
`echo "$diffString</textarea><div class='outDiff' id='outDiff$index'>PRETTY HERE</div></td></tr>" >> $outputFile`

index=$((index + 1))

# TODO: need to fix why $index is different on outside of loop, reseting on everyfile now to get the job done.
`echo "<script type='text/javascript'>var fileCount=$index;//test</script>" >> $outputFile`
fi fi
done done
`echo "</table></body></html>" >> $outputFile`


echo "\n\nSaved to $outputFile"
`cat tail.html >> $outputFile`

echo "\n\nSaved to $outputFile"

0 comments on commit 30f731d

Please sign in to comment.