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

Re: Revert, but give it a different name?

From: Ryan Schmidt <subversion-2018_at_ryandesign.com>
Date: Wed, 15 Aug 2018 06:10:38 -0500

On Aug 15, 2018, at 03:02, Daniel Shahaf wrote:

> Nathan Hartman wrote on Tue, 14 Aug 2018 12:36 -0400:
>> Suppose I modified filename.c. Can I revert, but instead of throwing away
>> my changes, revert to a separate file like filename.c.old and keep my
>> modified filename.c for comparison in my favorite tool?
>
> svn cat filename.c_at_BASE > filename.c.old
>
> but a better way to achieve what you're trying to do is to use a custom diff-cmd.

Right. As an example, here's the "svnbbdiff" script I use (an updated version of the "svntwdiff" script I previously posted), which opens the svn diff into the macOS text editor BBEdit; you could easily change it to open a different editor.

#!/bin/sh

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

set -euo pipefail

PATH="/Applications/BBEdit.app/Contents/Helpers:$PATH"

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

FILE="$1"

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

: "${TMPDIR=/tmp}"

svn info -- "${FILE}"@ > /dev/null

TMPFILE=$(mktemp "${TMPDIR}"/svnbbdiff.XXXXXX)
trap 'rm -f -- "${TMPFILE}"' EXIT

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

bbdiff --wait --resume -- "${FILE}" "${TMPFILE}"
Received on 2018-08-15 13:10:57 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.