Re: [announce] 'patchview' ver. 003

From: Tejun Heo
Date: Thu Jul 21 2005 - 21:28:30 EST


randy_dunlap wrote:
Hi,

[version 003]

'patchview' merges a patch file and a source tree to a set of
temporary modified files. This enables better patch (re)viewing
and more viewable context. (hopefully)


The patchview script is here:
http://www.xenotime.net/linux/scripts/patchview


usage: patchview [-f] patchfile srctree {ver. 003}
-f : force tkdiff even if 'patch' has errors
-s : single tkdiff even if patchfile contains multiple files


It uses (requires) lsdiff (from patchutils) and tkdiff.

patchutils: http://cyberelk.net/tim/patchutils/
tkdiff: http://sourceforge.net/projects/tkdiff/

---
~Randy


Changes for ver. 003:
- handle patch making empty .orig files (for new files)
with permission of 000

Hi, Randy.

Here's a small modification to make it work with mtkdiff (my hacked version of tkdiff which supports multiple files). mtkdiff+patchview tarball is available at the following url.


http://home-tj.org/mtkdiff/files/patchview-mtkdiff.tar.gz


--- patchview.orig 2005-07-22 11:19:26.000000000 +0900
+++ patchview/patchview 2005-07-22 11:21:01.000000000 +0900
@@ -5,7 +5,7 @@
# uses patchutils (lsdiff) and tkdiff

PROG=patchview
-VERSION=003
+VERSION=004

# usage: help message and exit
function usage()
@@ -40,7 +40,12 @@

force=0
single=0
+mtkdiff=0
VIEWER="tkdiff"
+if [ -x "`which mtkdiff`" ]; then
+ VIEWER="mtkdiff"
+ mtkdiff=1
+fi
# or maybe "sh -c colordiff" would work

while [ -n "$1" ]
@@ -117,15 +122,29 @@
exit 1
fi

-for pf in $pfiles ; do
- $VIEWER $WORKDIR/$pf.orig $WORKDIR/$pf &
- if [ ${single} -eq 1 ]; then
- wait # for viewer to exit
- fi
-done
+if [ $mtkdiff -ne 0 ]; then
+ i=0
+ argv[i++]="-gdesc"
+ argv[i++]=`diffstat $patchfile`
+ for pf in $pfiles ; do
+ argv[i++]="-fname"
+ argv[i++]="$pf"
+ argv[i++]="$WORKDIR/$pf.orig"
+ argv[i++]="$WORKDIR/$pf"
+ done

-if [ ${single} -eq 0 ]; then
- wait # for all viewers to exit
+ mtkdiff "${argv[@]}"
+else
+ for pf in $pfiles ; do
+ $VIEWER $WORKDIR/$pf.orig $WORKDIR/$pf &
+ if [ ${single} -eq 1 ]; then
+ wait # for viewer to exit
+ fi
+ done
+
+ if [ ${single} -eq 0 ]; then
+ wait # for all viewers to exit
+ fi
fi

rm -rf $WORKDIR

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/