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

svn cat improperly described in svn-book ?

From: Arthur Kowalczyk <arthur_kowalczyk_at_yahoo.co.uk>
Date: 2007-09-12 11:09:09 CEST


IMHO there is a wrong/misleading description of "svn cat" command in

I refer to text from bottom of page # 208 from "svn-book.pdf" SVN 1.5
rev 2876:

    "If your working copy is out of date (or you have local
modifications) and you want
    to see the HEAD revision of a file in your working copy, svn cat
will automatically
    fetch the HEAD revision when you give it a path:

    $ cat foo.c
    This file is in my local working copy
    and has changes that I've made.
    $ svn cat foo.c
    Latest revision fresh from the repository!"

I do not agree that this particular 'svn cat foo.c' displays HEAD
revision of file from repository.
IMHO it displays pristine copy from your working copy - svn does not
even connect to repo in this case.

Let me prove it:

my test repo : svn://localhost/abc
svn command client : svn-win32-1.4.5

My test repo rev 122 is empty.
I import a file c:\test\foo.c - content = "This is my BASE"

    C:\test>svn import ./foo.c svn://localhost/abc/foo.c -m "test"
    Adding foo.c

    Committed revision 123.

I delete my local file and check out

    C:\test>del foo.c

    C:\test>svn checkout svn://localhost/abc
    A abc\foo.c
    Checked out revision 123.

Now I change my local copy of foo.c:

    C:\test>echo this is changed foo.c > ./abc/foo.c

    C:\test>cat abc/foo.c
    this is changed foo.c

Let's say that sb has created in my repo revision 124 by commiting foo.c
with new content = "newest foo.c in repo rev 124".
Now my WC is out of date (foo.c in rev 124 exists in repo), my local
copy was changed and my pristine copy is identical as rev 123.
Let's check what "svn cat" prints:

    C:\test>cd abc

    C:\test\abc>svn cat foo.c
    This is my BASE

So "svn cat foo.c" will not print HEAD revision - it does not even
consult repo - it takes pristine copy in this particular case.
In order to het HEAD we should issue this:

    C:\test\abc>svn cat foo.c@HEAD
    newest foo.c in repo rev 124
    C:\test\abc>svn cat foo.c -r HEAD
    newest foo.c in repo rev 124

Correct me if I am wrong as I started to learn SVN a week ago.

Artur Kowalczyk

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Sep 12 11:05:57 2007

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.