gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu-arch-users] Re: Creating a diif (-uN) from two revisions


From: Catalin Marinas
Subject: [Gnu-arch-users] Re: Creating a diif (-uN) from two revisions
Date: Mon, 25 Oct 2004 13:36:43 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Esben Mose Hansen <address@hidden> writes:
> (1) tla get revision1
> (2) tla get revision2
>
> (3) delete arch-files
>
> (4) diff -uN revision1 revision2 > patchfile

I need to create patches quite often and I ended up writing some
scripts.

Instead of (3) and (4) you can use something like this:

diff -x \{arch\} -x .arch-ids -x .arch-inventory -x \, revision1 revision2

Another option is to use "tla changes/delta --diffs" and fix the
generated patch with the attached script.

Catalin

#!/bin/sh
#
# Fixes the diff generated by the cvs diff -Nu -r<tag> command

FILE=$1

filterdiff -x "*/{arch}/*" -x "*/.arch-*" $FILE > $FILE~

cat $FILE~ | sed -ne '
# remove the garbage lines
/^[^-+@ ].*$/ b
/^$/ b

# fix the ,,what-changed lines generated by tla
s%^--- /.*/,,what-changed\.[^/]*/[^/]*/./\(.*\)$%--- orig/\1%
s%^+++ /.*/,,what-changed\.[^/]*/[^/]*/./\(.*\)$%+++ mod/\1%

# copy the --- and +++ lines to the hold space, move them back to the
# pattern space and process it
/^--- .*$/ {
        h
        b
}
/^+++ .*$/ {
        H
        g

        # generate the "diff -Nru", "---" and "+++" lines
        s%^--- \([^\t]*\).*\n+++ \([^\t]*\).*$%diff -Nru \1 \2\n--- \1\n+++ \2%
}

# print the pattern space
p
' > $FILE

reply via email to

[Prev in Thread] Current Thread [Next in Thread]