File: versiondiff.sh

package info (click to toggle)
shotcut 25.10.31%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,412 kB
  • sloc: cpp: 76,422; javascript: 11,690; sh: 2,896; xml: 104; python: 84; makefile: 34; ansic: 6
file content (56 lines) | stat: -rwxr-xr-x 1,345 bytes parent folder | download | duplicates (5)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

set -eu

catIfValid() {
    cat $1 2>/dev/null
}

printVersions() {
    VERSIONFILEPATH=$1
    if [ $(basename $VERSIONFILEPATH) = "versions" ]; then
        cat $VERSIONFILEPATH
    elif catIfValid $VERSIONFILEPATH/Shotcut.app/versions; then
        return 0
    elif catIfValid $VERSIONFILEPATH/Shotcut/Shotcut.app/versions; then
        return 0
    elif file $VERSIONFILEPATH | grep -q "compressed data"; then
        >&2 echo "Reading version from $VERSIONFILEPATH"...
        tar xOf $VERSIONFILEPATH Shotcut/Shotcut.app/versions
        if [ "$?" -ne "0" ]; then
            >&2 echo No versions file found in $VERSIONFILEPATH
            return 1
        fi
    else
        return 1
    fi
}

oldVersion=$(mktemp)
newVersion=$(mktemp)
trap "rm -f $oldVersion $newVersion" EXIT

printVersions $1 > $oldVersion
printVersions $2 > $newVersion

cd $(dirname $0)/../../

cat $oldVersion | while read dir sha; do
    pushd $dir > /dev/null

    oldsha=$sha
    newsha=$(egrep "^$dir" $newVersion | cut -f2 -d' ')
    if [ "$oldsha" = "$newsha" ]; then
        echo $dir: No new commits
        popd > /dev/null
        continue
    fi
    sharange=$oldsha..$newsha
    commitcount=$(git rev-list $sharange | wc -l)

    echo
    echo ---- $dir: $commitcount new commits
    git log --oneline $sharange

    popd > /dev/null
done