Create patch-files for a bunch of svn revisions.

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Create patch-files for a bunch of svn revisions.

Post by CuteAlien »

Some problem I did run into each time I merged Irrlicht's branches. With svn you have either one huge patch or have to type in each revision number on it's own. So this time I finally wrote a bash-script automatizing it:

Code: Select all

 
#!/bin/bash
# Create patch-files for each svn revision between two given revision numbers
# Author: Michael Zeilfelder
# License: Don't care - use as you want.
 
if [ ! $1 ] || [ ! $2 ]|| [ ! $3 ]; then
    echo Create patch-files for each svn revision between two given revision numbers:
    echo $0 r1:r2 target
    echo Where r1 and r2 are svn revisions, r2 > r1 and target is the basename of the patchfiles
    exit
fi
 
t=`expr $2 - 1`
for i in $(eval echo {$1..$t})
do
    # create a patch file for a single version using the diff from the system
    k=`expr $i + 1`
    name="$k""$3"
    svn diff --diff-cmd /usr/bin/diff -r"$i":"$k" > "$name"
    
    # delete empty diff files
    if [ ! -s $name ] ; then
        rm $name
    fi
done
 
Probably only useful for maintainers. Also I'm no bash-coder and I guess code quality is correspondingly ...

edit: Just learned that in svn 1.7 the same can be done with: svn log --diff
Oh well, thanks to using Debian stable I don't have newest svn, so my work wasn't a copmlete waste ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Create patch-files for a bunch of svn revisions.

Post by hendu »

*cough* other VCS *cough* better merging *cough*

I really need this cough checked ;)
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Create patch-files for a bunch of svn revisions.

Post by CuteAlien »

One day that cough will be fixed ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply