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

svn diff on renamed files

From: Chris Hecker <checker_at_d6.com>
Date: 2003-06-26 09:20:18 CEST

Like an idiot, I typed up a huge email before looking at the issues
list. Anyway, 1093 covers a fair bit of this, but it seems like there are
some issues and ideas mentioned in this mail that I didn't see in the bug
report, so I figured it has some value and I'd send it instead of deleting
it.

----------

Hopefully I'm not making some total newbie mistake here, although if I am
that's good because it means what I want is possible. :)

I have a file that has a number of revisions as old.txt, and then it gets
renamed to new.txt and gets some more revisions. I've got an up-to-date
repository, so I have new.txt in my directory. I want to diff two earlier
versions of the file, before the rename, or do a diff across the
rename. It looks like I have to use an absolute URL to do this?

That's really, uh, tedious. First, it means you have to know exactly when
the file got renamed or you get bogus diffs, since svn diff assumes an
empty file if you specify a revision before the file existed (in other
words, old.txt renamed to new.txt at r5, then svn diff -r2:7 new.txt gives
the complete new.txt at r7, not the diff between foo@2 and bar@7). Knowing
means scrolling through a log of the file's entire history looking for the
A ... (from ...) line, and there might be multiple ones, and you have to
keep track of which versions were which names to do a correct
diff. Second, it means you have to use the full URL even if you've got an
up to date working copy and you want to compare the current wc file against
a previous version, and so you need to know it, so you need to run svn info
and figure it out, etc. diff also seems to not want to diff urls and wc
files, since it prints out a TBD warning, meaning it's currently impossible
to diff a pre-rename version of a file against the wc (without cat'ing the
old file to a temp), unless I'm missing something.

I suggest three things (that aren't that well thought out, but here goes
anyway):

1. Fixing diff so it tracks renames on the file, so -r2:7 new.txt works
like you'd expect (meaning you didn't have to know the file was renamed 6
times before you joined the company 18000 versions ago). Log already sort
of works this way (although not completely, because you can't svn log -r3:4
new.txt if it didn't exist before r4, but it works if you just svn log
new.txt), in fact you have to use svn log -v file.txt to even figure out
the file was renamed as far as I can tell.

2. Making a symbol for URL-to-the-current-wc-directory (like the symbols
for HEAD, PREV, etc.), so I can just say REP_URL/foo.txt (or whatever) to
specify the full path. This would just get the Url: from info and use it,
nothing fancy, just a shorthand. You should also be able to do
REP_URL/../../blah/other.txt and have it work too, although that's less
important (and there's some ambiguity about whether you mean the Url from
this directory or the blah directory). This, incidentally, would also help
clean up the svn:externals "modules" url problem from the FAQ, since it
would just do the right thing for your current directory regardless of
which repository it's from.

3. If there's an @ symbol on a non-full-url'd file name, still look for it
at that revision number in the repository. In other words, old.txt is not
in my wc, but old.txt@3 makes total sense contextually, even though there's
no old.txt in my wc. This would save a lot of typing.

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 26 09:21:22 2003

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

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