File: stg-mdiff

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (51 lines) | stat: -rwxr-xr-x 1,049 bytes parent folder | download | duplicates (8)
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
#!/bin/bash
set -e

# stg-mdiff - display meta-diffs, ie. diffs of diffs

# Main use: show evolutions of a patch.
# eg. stg-mdiff foo@stable foo
#     stg-mdiff foo 012345567ABCD # sha1 for "foo" as integrated upstream

# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
# Subject to the GNU GPL, version 2.

usage()
{
    echo "Usage: [-o <diff-flags>] [-O <gitdiff-flags>] $(basename $0) <from1>..[<to1>]|<patch1> <from2>..[<to2>]|<patch2>"
    exit 1
}

diffopts=
subdiffopts=
while [ "$#" -gt 0 ]; do
    case "$1" in
	-o) diffopts="$2"; shift ;;
	-O) subdiffopts="-O $2"; shift ;;
	-*) usage ;;
	*) break ;;
    esac
    shift
done

if [ "$#" != 2 ]; then
    usage
fi

if [ -z "$diffopts" ]; then
    diffopts="-u"
fi

case "$1" in
*..*) cmd1="stg diff $subdiffopts -r" ;;
*)    cmd1="stg show $subdiffopts" ;;
esac
case "$2" in
*..*) cmd2="stg diff $subdiffopts -r" ;;
*)    cmd2="stg show $subdiffopts" ;;
esac

colordiff $diffopts \
    -I '^index [0-9a-b]*..[0-9a-b]*' \
    -I '^@@ .* @@' \
    <($cmd1 "$1") <($cmd2 "$2") | less -RFX