File: dbdiff.sh

package info (click to toggle)
qgis 3.40.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,185,444 kB
  • sloc: cpp: 1,616,454; python: 372,967; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,829; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (28 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (13)
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
#!/usr/bin/env bash

if [ "$1" = "-h" ]; then
	echo "usage: $0 [-h] [database] [sha1] [sha2]"
	echo "  -h         show this help"
	echo "  database   databases to compare (defaults to resources/srs.db"
	echo "  sha1	   sha of previous state (defaults to HEAD^)"
	echo "  sha2	   sha of next state (defaults to HEAD)"
	exit 1
fi

set -e

db=${1:-resources/srs.db}
prev=${2:-HEAD^}
next=${3:-HEAD}

echo "db:$db prev:$prev next:$next"

git cat-file blob $prev:resources/srs.db >/tmp/prev.db
git cat-file blob $next:resources/srs.db >/tmp/next.db

sqlite3 /tmp/prev.db .dump >/tmp/prev.sql
sqlite3 /tmp/next.db .dump >/tmp/curr.sql

diff -u /tmp/prev.sql /tmp/curr.sql

rm /tmp/prev.db /tmp/next.db /tmp/prev.sql /tmp/curr.sql