Show More
@@ -1,42 +1,42 b'' | |||||
1 | #!/bin/rc |
|
1 | #!/bin/rc | |
2 | # 9diff - Mercurial extdiff wrapper for diff(1) |
|
2 | # 9diff - Mercurial extdiff wrapper for diff(1) | |
3 |
|
3 | |||
4 | rfork e |
|
4 | rfork e | |
5 |
|
5 | |||
6 | fn getfiles{ |
|
6 | fn getfiles { | |
7 |
cd $1 && |
|
7 | cd $1 && | |
8 | for(f in `{du -as | awk '{print $2}'}) |
|
8 | for(f in `{du -as | awk '{print $2}'}) | |
9 | test -f $f && echo `{cleanname $f} |
|
9 | test -f $f && echo `{cleanname $f} | |
10 | } |
|
10 | } | |
11 |
|
11 | |||
12 | fn usage{ |
|
12 | fn usage { | |
13 | echo >[1=2] usage: 9diff [diff options] parent child root |
|
13 | echo >[1=2] usage: 9diff [diff options] parent child root | |
14 | exit usage |
|
14 | exit usage | |
15 | } |
|
15 | } | |
16 |
|
16 | |||
17 | opts=() |
|
17 | opts=() | |
18 | while(~ $1 -*){ |
|
18 | while(~ $1 -*){ | |
19 | opts=($opts $1) |
|
19 | opts=($opts $1) | |
20 | shift |
|
20 | shift | |
21 | } |
|
21 | } | |
22 | if(! ~ $#* 3) |
|
22 | if(! ~ $#* 3) | |
23 | usage |
|
23 | usage | |
24 |
|
24 | |||
25 | # extdiff will set the parent and child to a single file if there is |
|
25 | # extdiff will set the parent and child to a single file if there is | |
26 | # only one change. If there are multiple changes, directories will be |
|
26 | # only one change. If there are multiple changes, directories will be | |
27 | # set. diff(1) does not cope particularly with directories; instead we |
|
27 | # set. diff(1) does not cope particularly with directories; instead we | |
28 | # do the recursion ourselves and diff each file individually. |
|
28 | # do the recursion ourselves and diff each file individually. | |
29 | if(test -f $1) |
|
29 | if(test -f $1) | |
30 | diff $opts $1 $2 |
|
30 | diff $opts $1 $2 | |
31 | if not{ |
|
31 | if not{ | |
32 | # extdiff will create a snapshot of the working copy to prevent |
|
32 | # extdiff will create a snapshot of the working copy to prevent | |
33 | # conflicts during the diff. We circumvent this behavior by |
|
33 | # conflicts during the diff. We circumvent this behavior by | |
34 | # diffing against the repository root to produce plumbable |
|
34 | # diffing against the repository root to produce plumbable | |
35 | # output. This is antisocial. |
|
35 | # output. This is antisocial. | |
36 | for(f in `{sort -u <{getfiles $1} <{getfiles $2}}){ |
|
36 | for(f in `{sort -u <{getfiles $1} <{getfiles $2}}){ | |
37 | file1=$1/$f; test -f $file1 || file1=/dev/null |
|
37 | file1=$1/$f; test -f $file1 || file1=/dev/null | |
38 | file2=$3/$f; test -f $file2 || file2=/dev/null |
|
38 | file2=$3/$f; test -f $file2 || file2=/dev/null | |
39 | diff $opts $file1 $file2 |
|
39 | diff $opts $file1 $file2 | |
40 | } |
|
40 | } | |
41 | } |
|
41 | } | |
42 | exit '' |
|
42 | exit '' |
@@ -1,37 +1,37 b'' | |||||
1 | APE=/sys/src/ape |
|
1 | APE=/sys/src/ape | |
2 | <$APE/config |
|
2 | <$APE/config | |
3 |
|
3 | |||
4 | PYTHON=python |
|
4 | PYTHON=python | |
5 | PYTHONBIN=/rc/bin |
|
5 | PYTHONBIN=/rc/bin | |
6 | SH=ape/psh |
|
6 | SH=ape/psh | |
7 |
|
7 | |||
8 | PURE=--pure |
|
8 | PURE=--pure | |
9 | ROOT=../.. |
|
9 | ROOT=../.. | |
10 |
|
10 | |||
11 | # This is slightly underhanded; Plan 9 does not support GNU gettext nor |
|
11 | # This is slightly underhanded; Plan 9 does not support GNU gettext nor | |
12 | # does it support dynamically loaded extension modules. We work around |
|
12 | # does it support dynamically loaded extension modules. We work around | |
13 | # this by calling build_py and build_scripts directly; this avoids |
|
13 | # this by calling build_py and build_scripts directly; this avoids | |
14 | # additional platform hacks in setup.py. |
|
14 | # additional platform hacks in setup.py. | |
15 | build:VQ: |
|
15 | build:VQ: | |
16 | @{ |
|
16 | @{ | |
17 | cd $ROOT |
|
17 | cd $ROOT | |
18 | $SH -c '$PYTHON setup.py $PURE build_py build_scripts' |
|
18 | $SH -c '$PYTHON setup.py $PURE build_py build_scripts' | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | clean:VQ: |
|
21 | clean:VQ: | |
22 | @{ |
|
22 | @{ | |
23 | cd $ROOT |
|
23 | cd $ROOT | |
24 | $SH -c '$PYTHON setup.py $PURE clean --all' |
|
24 | $SH -c '$PYTHON setup.py $PURE clean --all' | |
25 | } |
|
25 | } | |
26 |
|
26 | |||
27 | install:VQ: build |
|
27 | install:VQ: build | |
28 | @{ |
|
28 | @{ | |
29 | cd $ROOT |
|
29 | cd $ROOT | |
30 | $SH -c '$PYTHON setup.py $PURE install \ |
|
30 | $SH -c '$PYTHON setup.py $PURE install \ | |
31 | --install-scripts $PYTHONBIN \ |
|
31 | --install-scripts $PYTHONBIN \ | |
32 |
--skip-build |
|
32 | --skip-build \ | |
33 | --force |
|
33 | --force' | |
34 | } |
|
34 | } | |
35 | mkdir -p /lib/mercurial/hgrc.d |
|
35 | mkdir -p /lib/mercurial/hgrc.d | |
36 | dircp hgrc.d /lib/mercurial/hgrc.d |
|
36 | dircp hgrc.d /lib/mercurial/hgrc.d/ | |
37 | cp 9diff /rc/bin |
|
37 | cp 9diff /rc/bin/ |
General Comments 0
You need to be logged in to leave comments.
Login now