-
Notifications
You must be signed in to change notification settings - Fork 0
/
niceDiff.bat
38 lines (30 loc) · 3.75 KB
/
niceDiff.bat
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
33
34
35
36
37
38
@echo OFF
SETLOCAL ENABLEEXTENSIONS
:: name of running script
SET me=%~n0
:: path to script folder
SET parent=%~dp0
SET branchA=%1
SET branchB=%2
SET comparePath=%3
:: validate 1st parametr
IF "%branchA%"=="" (
echo %me%: incorrect parameters. Please use: niceDiff ^<branch1-name^> ^<branch2-name^> [optional ^<path-to-comparing-files^>]
GOTO:EOF
)
:: validate 2nd parametr
IF "%branchB%"=="" (
echo %me%: incorrect parameters. Please use: niceDiff ^<branch1-name^> ^<branch2-name^> [optional ^<path-to-comparing-files^>]
GOTO:EOF
)
:: get difference and write into file
ECHO preparing raw difference...
git diff --minimal %branchA% %branchB% %3 > %parent%/diff.txt
:: note: --minimal flag get line different, --word-diff is nuclear diff
:: parce file into html
:: add top part of template
TYPE %parent%template_top_report.html> niceDiff-report.html
:: add branches to the header
SET svgBranch="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCAxNzIgMTcyIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2UtbGluZWNhcD0iYnV0dCIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2UtZGFzaGFycmF5PSIiIHN0cm9rZS1kYXNob2Zmc2V0PSIwIiBmb250LWZhbWlseT0ibm9uZSIgZm9udC13ZWlnaHQ9Im5vbmUiIGZvbnQ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