You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan Schmidt <su...@ryandesign.com> on 2012/04/13 10:55:34 UTC

Where is Subversion 1.7's pristine copy of a given file?

I have not upgraded to Subversion 1.7 yet. I'm still on 1.6.17.

One reason is that there is a script I like to use, that I wrote, called svntwdiff. It goes like this:


$ cat svntwdiff 
#!/bin/bash

if [ -z "$1" ]; then
    echo "usage: $0 <file>"
    exit 1
fi

FILE="$1"
FILEDIR="$(dirname "${FILE}")"
FILEBASE="$(basename "${FILE}")"
SVNDIR="${FILEDIR}/.svn"
ORIGFILE="${SVNDIR}/text-base/${FILEBASE}.svn-base"

if [ ! -f "${FILE}" ]; then
    echo "error: ${FILE} doesn't exist"
    exit 1
fi

if [ ! -d "${SVNDIR}" ]; then
    echo "error: ${SVNDIR} doesn't exist; maybe ${FILEDIR} isn't a working copy"
    exit 1
fi

if [ ! -f "${ORIGFILE}" ]; then
    echo "error: ${ORIGFILE} doesn't exist; maybe ${FILE} hasn't been committed yet"
    exit 1
fi

twdiff "${FILE}" "${ORIGFILE}"


"twdiff" is a command-line wrapper that comes with the GUI TextWrangler editor; it opens the two given textfiles in TextWrangler and lets me view and edit the differences between files. I often use svntwdiff to examine changes in a file and selectively back out portions of them.

How can I modify this script to be compatible with a Subversion 1.7 format working copy?



Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Ulrich Eckhardt <ul...@dominolaser.com>.
Am 13.04.2012 10:55, schrieb Ryan Schmidt:
> "twdiff" is a command-line wrapper that comes with the GUI
> TextWrangler editor; it opens the two given textfiles in TextWrangler
> and lets me view and edit the differences between files. I often use
> svntwdiff to examine changes in a file and selectively back out
> portions of them.

Take a look at "diffuse". That said, I have no idea if diffuse works
with SVN 1.7 ... I myself haven't upgraded either.

Uli
**************************************************************************************
Domino Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at http://www.dominolaser.com
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Domino Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************


Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Daniel Shahaf <da...@elego.de>.
Ryan Schmidt wrote on Fri, Apr 13, 2012 at 05:28:41 -0500:
> 
> On Apr 13, 2012, at 04:58, Daniel Shahaf wrote:
> 
> > Ryan Schmidt wrote on Fri, Apr 13, 2012 at 04:55:17 -0500:
> >> 
> >> On Apr 13, 2012, at 04:43, Daniel Shahaf wrote:
> >> 
> >>> 1.x-compatible:
> >>> use 'svn cat' to obtain a tempfile. 
> >> 
> >> That's a good idea. It sounds like this would be less work and
> >> automatically backward- and future-compatible.
> > 
> > Indeed.  Just make sure to pass @BASE to avoid a round trip to the server.
> > 
> > (you may want to double-check that it indeed avoids a server round-trip
> > in that case; it should, but I never verified whether it does.)
> 
> There didn't appear to be any traffic to my repository regardless if
> I added @BASE or not but I added it anyway since you said to.

Well, it doesn't hurt, but it's not necessary either because the peg
revision for non-URL targets defaults to @BASE.

You're welcome.

Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 13, 2012, at 04:58, Daniel Shahaf wrote:

> Ryan Schmidt wrote on Fri, Apr 13, 2012 at 04:55:17 -0500:
>> 
>> On Apr 13, 2012, at 04:43, Daniel Shahaf wrote:
>> 
>>> 1.x-compatible:
>>> use 'svn cat' to obtain a tempfile. 
>> 
>> That's a good idea. It sounds like this would be less work and
>> automatically backward- and future-compatible.
> 
> Indeed.  Just make sure to pass @BASE to avoid a round trip to the server.
> 
> (you may want to double-check that it indeed avoids a server round-trip
> in that case; it should, but I never verified whether it does.)

There didn't appear to be any traffic to my repository regardless if I added @BASE or not but I added it anyway since you said to.

Here's the new script for anyone interested. Thanks again for your help.


$ cat svntwdiff 
#!/bin/bash

# http://svn.haxx.se/users/archive-2012-04/0090.shtml

if [ -z "$1" ]; then
    echo "usage: $0 <file>"
    exit 1
fi

FILE="$1"

if [ ! -f "${FILE}" ]; then
    echo "error: ${FILE} doesn't exist"
    exit 1
fi

if [ -z "${TMPDIR}" ]; then
    TMPDIR=/tmp
fi

svn info "${FILE}" >/dev/null || exit $?

TMPFILE="$(mktemp "${TMPDIR}/svntwdiff.XXXXXXXXXX")"

svn cat "${FILE}"@BASE > "${TMPFILE}"

twdiff --wait --resume "${FILE}" "${TMPFILE}"

rm -f "${TMPFILE}"




Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Daniel Shahaf <da...@elego.de>.
Ryan Schmidt wrote on Fri, Apr 13, 2012 at 04:55:17 -0500:
> 
> On Apr 13, 2012, at 04:43, Daniel Shahaf wrote:
> 
> > 1.x-compatible:
> > use 'svn cat' to obtain a tempfile. 
> 
> That's a good idea. It sounds like this would be less work and
> automatically backward- and future-compatible.

Indeed.  Just make sure to pass @BASE to avoid a round trip to the server.

(you may want to double-check that it indeed avoids a server round-trip
in that case; it should, but I never verified whether it does.)

Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 13, 2012, at 04:43, Daniel Shahaf wrote:

> Ryan Schmidt wrote on Fri, Apr 13, 2012 at 03:55:34 -0500:
> 
>> How can I modify this script to be compatible with a Subversion 1.7
>> format working copy?
> 
> 1.7-specific, relies on implementation details:
> `svn info`[Working Copy Root Dir]`/.svn/pristine/`svn info`[SHA-1 checksum]`

Thanks! That was the info I needed.


> 1.x-compatible:
> use 'svn cat' to obtain a tempfile. 

That's a good idea. It sounds like this would be less work and automatically backward- and future-compatible.


> 1.8:
> we might move to compressed pristines.  And if we do, we might provide
> a "give me a disk path of the uncompressed file that I can pass to my
> diff tool" API.



Re: Where is Subversion 1.7's pristine copy of a given file?

Posted by Daniel Shahaf <da...@elego.de>.
Ryan Schmidt wrote on Fri, Apr 13, 2012 at 03:55:34 -0500:
> I have not upgraded to Subversion 1.7 yet. I'm still on 1.6.17.
> 
> One reason is that there is a script I like to use, that I wrote, called svntwdiff. It goes like this:
> 
> 
> $ cat svntwdiff 
> #!/bin/bash
> 

You could use #!/bin/sh here.

> if [ -z "$1" ]; then
>     echo "usage: $0 <file>"
>     exit 1
> fi
> 
> FILE="$1"
> FILEDIR="$(dirname "${FILE}")"
> FILEBASE="$(basename "${FILE}")"
> SVNDIR="${FILEDIR}/.svn"
> ORIGFILE="${SVNDIR}/text-base/${FILEBASE}.svn-base"
> 
> if [ ! -f "${FILE}" ]; then
>     echo "error: ${FILE} doesn't exist"
>     exit 1
> fi
> 
> if [ ! -d "${SVNDIR}" ]; then
>     echo "error: ${SVNDIR} doesn't exist; maybe ${FILEDIR} isn't a working copy"
>     exit 1
> fi
> 
> if [ ! -f "${ORIGFILE}" ]; then
>     echo "error: ${ORIGFILE} doesn't exist; maybe ${FILE} hasn't been committed yet"
>     exit 1
> fi
> 
> twdiff "${FILE}" "${ORIGFILE}"
> 
> 
> "twdiff" is a command-line wrapper that comes with the GUI
> TextWrangler editor; it opens the two given textfiles in TextWrangler
> and lets me view and edit the differences between files. I often use
> svntwdiff to examine changes in a file and selectively back out
> portions of them.
> 
> How can I modify this script to be compatible with a Subversion 1.7
> format working copy?
> 

1.7-specific, relies on implementation details:
`svn info`[Working Copy Root Dir]`/.svn/pristine/`svn info`[SHA-1 checksum]`

1.x-compatible:
use 'svn cat' to obtain a tempfile. 

1.8:
we might move to compressed pristines.  And if we do, we might provide
a "give me a disk path of the uncompressed file that I can pass to my
diff tool" API.

>