* [announce] 'patchview' script
@ 2005-07-19 18:51 randy_dunlap
2005-07-19 20:11 ` Nick Wilson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: randy_dunlap @ 2005-07-19 18:51 UTC (permalink / raw)
To: lkml
Hi,
Someone asked me about a tool like this and I didn't know of one,
so I made this little script.
'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)
Are there already other tools that do something similar to this?
(other than SCMs)
The patchview script is here:
http://www.xenotime.net/linux/scripts/patchview
usage: patchview [-f] patchfile srctree
-f : force tkdiff even if 'patch' has errors
It uses (requires) lsdiff (from patchutils) and tkdiff.
patchutils: http://cyberelk.net/tim/patchutils/
tkdiff: http://sourceforge.net/projects/tkdiff/
---
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [announce] 'patchview' script
2005-07-19 18:51 [announce] 'patchview' script randy_dunlap
@ 2005-07-19 20:11 ` Nick Wilson
2005-07-19 20:20 ` Jan Engelhardt
2005-07-19 21:36 ` K.R. Foley
2 siblings, 0 replies; 4+ messages in thread
From: Nick Wilson @ 2005-07-19 20:11 UTC (permalink / raw)
To: randy_dunlap; +Cc: lkml
On Tue, Jul 19, 2005 at 11:51:03AM -0700, randy_dunlap wrote:
>
> Hi,
>
> Someone asked me about a tool like this and I didn't know of one,
> so I made this little script.
>
> '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)
>
> Are there already other tools that do something similar to this?
> (other than SCMs)
>
>
> The patchview script is here:
> http://www.xenotime.net/linux/scripts/patchview
Hey Randy,
The mktemp command fails for me, but patchview keeps on going.
[njw@njw ~/tmp]$ patchview mypatch.patch linux-2.6.13-rc3
mktemp: cannot make temp dir /home/njw/tmp/XXXXXX/tmp.xV1xRT: No such file or directory
failed mktemp for patch files dir.
mkdir: cannot create directory `/fs': Permission denied
cp: cannot create regular file `/fs/Kconfig': No such file or directory
mkdir: cannot create directory `/fs': Permission denied
cp: cannot create regular file `/fs/Makefile': No such file or directory
[ ... ]
This patch makes mktemp work correctly for me and causes patchview to exit
if it happens to fail.
Thanks,
Nick Wilson
--- patchview.orig 2005-07-19 12:50:20.000000000 -0700
+++ patchview 2005-07-19 13:07:12.000000000 -0700
@@ -48,7 +48,7 @@
else
TMPDIR=/tmp
fi
-WORKDIR=`mktemp -d -p ${TMPDIR}/XXXXXX` || echo "failed mktemp for patch files dir."
+WORKDIR=`mktemp -d -p ${TMPDIR} XXXXXX` || { echo "failed mktemp for patch files dir."; exit 1; }
pfiles=`lsdiff --strip 1 $patchfile`
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [announce] 'patchview' script
2005-07-19 18:51 [announce] 'patchview' script randy_dunlap
2005-07-19 20:11 ` Nick Wilson
@ 2005-07-19 20:20 ` Jan Engelhardt
2005-07-19 21:36 ` K.R. Foley
2 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2005-07-19 20:20 UTC (permalink / raw)
To: randy_dunlap; +Cc: lkml
>Hi,
>
>Someone asked me about a tool like this and I didn't know of one,
>so I made this little script.
>
>'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)
>
>Are there already other tools that do something similar to this?
>(other than SCMs)
I use unionfs for this purpose because it avoids copying around the full
kernel tree. This is also good for applying or rediffing in general, since
after you unmount the union, the "delta directory" contains only modified
files and you can use diff -Pdpru 2.6.13-rc1 deltadir to get a PGP - a pretty
good patchfile. :)
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [announce] 'patchview' script
2005-07-19 18:51 [announce] 'patchview' script randy_dunlap
2005-07-19 20:11 ` Nick Wilson
2005-07-19 20:20 ` Jan Engelhardt
@ 2005-07-19 21:36 ` K.R. Foley
2 siblings, 0 replies; 4+ messages in thread
From: K.R. Foley @ 2005-07-19 21:36 UTC (permalink / raw)
To: randy_dunlap; +Cc: lkml
[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]
randy_dunlap wrote:
> Hi,
>
> Someone asked me about a tool like this and I didn't know of one,
> so I made this little script.
>
> '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)
>
> Are there already other tools that do something similar to this?
> (other than SCMs)
>
>
> The patchview script is here:
> http://www.xenotime.net/linux/scripts/patchview
>
> usage: patchview [-f] patchfile srctree
> -f : force tkdiff even if 'patch' has errors
>
>
> It uses (requires) lsdiff (from patchutils) and tkdiff.
>
> patchutils: http://cyberelk.net/tim/patchutils/
> tkdiff: http://sourceforge.net/projects/tkdiff/
>
> ---
> ~Randy
Randy,
As Nick already pointed out, mktemp fails if the parent dir doesn't
exist. The attached patch tries to create the parent if it doesn't
exist. It also accepts a [-s] argument to bring up a single viewer at a
time. Otherwise, if there are many different files being touched by the
patch it dies a horrible death on my machine. Nice utility, btw.
--
kr
[-- Attachment #2: patchview.patch01 --]
[-- Type: text/plain, Size: 2042 bytes --]
--- patchview.orig 2005-07-19 16:08:21.000000000 -0500
+++ patchview 2005-07-19 16:30:07.000000000 -0500
@@ -3,7 +3,6 @@
# License: GPL v2.
#
# uses patchutils (lsdiff) and tkdiff
-
# returns 'base'
function strip_filename()
{
@@ -25,20 +24,55 @@
}
force=0
-patchfile=$1
-srctree=$2
+single=0
VIEWER="tkdiff"
# or maybe "sh -c colordiff" would work
-if [ "$patchfile" == "-f" ]; then
- force=1
- patchfile=$2
- srctree=$3
-fi
+while [ -n "$1" ]
+do
+ case $1 in
+ -f)
+ force=1
+ ;;
+
+ -s)
+ single=1
+ ;;
+ -*)
+ if [ "${1#-}" = '?' ]
+ then
+ echo "usage: patchview [-f] [-s] patchfile srctree"
+ echo " -f : force tkdiff even if 'patch' has errors"
+ echo " -s : single tkdiff even if 'patch' contains multiple files"
+ exit 0
+ fi
+ ;;
+
+ *)
+ # Accept filename or report a warning
+ if [ -z "${patchfile}" ]
+ then
+ patchfile=$1
+ srctree=$2
+ break
+ else
+ echo "usage: patchview [-f] [-s] patchfile srctree"
+ echo " -f : force tkdiff even if 'patch' has errors"
+ echo " -s : single tkdiff even if 'patch' contains multiple files"
+ exit 0
+ fi
+ ;;
+ esac
+
+ # Shift argument 2 into argument 1's slot. Loop to check the argument.
+ shift
+done
+
if [ "$patchfile" = "" -o "$srctree" = "" ]; then
echo "usage: patchview [-f] patchfile srctree"
echo " -f : force tkdiff even if 'patch' has errors"
+ echo " -s : single tkdiff even if 'patch' contains multiple files"
exit 1
fi
@@ -48,6 +82,10 @@
else
TMPDIR=/tmp
fi
+if [ ! -d ${TMPDIR}/XXXXXX ];then
+ mkdir ${TMPDIR}/XXXXXX || echo "failed mktemp for patch files dir."
+fi
+
WORKDIR=`mktemp -d -p ${TMPDIR}/XXXXXX` || echo "failed mktemp for patch files dir."
pfiles=`lsdiff --strip 1 $patchfile`
@@ -73,8 +111,13 @@
for pf in $pfiles ; do
$VIEWER $WORKDIR/$pf.orig $WORKDIR/$pf &
+ if [ ${single} -eq 1 ];then
+ wait # for viewer to exit
+ fi
done
-wait # for all viewers to exit
+if [ ${single} -eq 0 ];then
+ wait # for all viewers to exit
+fi
rm -rf $WORKDIR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-19 21:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-19 18:51 [announce] 'patchview' script randy_dunlap
2005-07-19 20:11 ` Nick Wilson
2005-07-19 20:20 ` Jan Engelhardt
2005-07-19 21:36 ` K.R. Foley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox