[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Fri, 13 Apr 2012 12:43:23 +0300

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.

>
Received on 2012-04-13 11:44:11 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.