You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by SteveKing <st...@gmx.ch> on 2003/03/27 17:42:50 UTC
svn cat doesn't work on moved files
Hi,
it seems that
svn cat
doesn't follow moved/renamed files if given
a revision number:
working copy at revision 2
svn mv myfile.txt subfolder/myfile.txt
svn commit --message "file moved"
svn cat subfolder/myfile.txt -r 2
svn:RA layer request failed
svn: PROPFIND of /svn/repos/!svn/bc/2/trunk/project/subfolder/myfile.txt
404 Not Found
I guess that's a bug?
Stefan
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> I can imagine needing both methods. How about changing -r to follow
> history through the moves to wc/bar in rev X, and implement -R to go
> straight to wc/foo in rev X as -r does now?
>
> That way we get the following meanings of -r and -R:
>
> -rX: First locate the object using the specified name in the wc, then
> trace history backwards to revision X. If an URL is used, the HEAD
> version of the repo is used to identify the object whose history is
> traced back to rev X.
>
> -RX: In version X of the repository, locate the object by the specified
> name.
I would vote for that too.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Robert Pluim <rp...@bigfoot.com>.
Tobias Ringstrom writes:
>
> I can imagine needing both methods. How about changing -r to follow
> history through the moves to wc/bar in rev X, and implement -R to go
> straight to wc/foo in rev X as -r does now?
>
> That way we get the following meanings of -r and -R:
>
> -rX: First locate the object using the specified name in the wc, then
> trace history backwards to revision X. If an URL is used, the HEAD
> version of the repo is used to identify the object whose history is
> traced back to rev X.
>
> -RX: In version X of the repository, locate the object by the specified
> name.
When used with an URL, what's going to be the common case? I suspect
it's "give me the file that at rev X was called this", so I'd be tempted
to swap your -R and -r around. That means that my interpretation of
'svn cat -r wc/foo' would have to change, but that's no big deal.
Michael, consider me <unwacked> ;-)
--
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Robert Pluim <rp...@bigfoot.com>.
SteveKing writes:
> > OTOH, I agree that the semantics being different between the wc and
> > URL cases is not acceptable either. We just need to find a way to
> > make the wc case not confusing (or just document the heck out of it)
>
> Oh no, please don't do that. Just documenting that something is not
> possible is an easy way but not good.
Ok, we'll strike that option (I didn't like it anyway ;-)
--
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> OTOH, I agree that the semantics being different between the wc and
> URL cases is not acceptable either. We just need to find a way to
> make the wc case not confusing (or just document the heck out of it)
Oh no, please don't do that. Just documenting that something is not
possible is an easy way but not good.
Or can you give me another way to get a copy of a specific file
at a specific revision? And please only one file and not a whole
directory as with svn co.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Robert Pluim <rp...@bigfoot.com>.
> > I vote for "bar". To me that reads "In rev X, what did the filesystem
> > object that is called wc/foo in my wc contain? (if it existed at
> > all)", and thus the rename history should be followed back in time.
>
> I see specifying a working copy as a shortcut to prevent having to type
> a URL. I don't see it as having different semantics. Having the same
> command which "specifies a revision" give different answers depending on
> whether or not I give a wc path or a URL is just too wacky.
>
> In any event, there is extra wackiness here as an object "foo" exists at
> revision X. Your vote bothers me :)
Ah, but under your interpretation, 'svn cat -r X wc/foo' goes back to
rev X and retrieves a file that just happens to have the same name as
the one in our working copy, but is in fact a different file. That's
wacky to me :)
OTOH, I agree that the semantics being different between the wc and
URL cases is not acceptable either. We just need to find a way to
make the wc case not confusing (or just document the heck out of it)
--
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Michael Price <mp...@atl.lmco.com>.
Robert Pluim wrote:
> Philip Martin writes:
> >
> > I asked "straight to wc/foo in rev X" or "follow history to wc/bar".
> >
> > > I do a checkout of rev X. I know that a checkout of a single file is
> > > not possible in subversion, but svn cat should work like that.
> >
> > Lets try again
> >
> > rev X: wc/foo contains text "foo"
> > wc/bar contains text "bar"
> >
> > rev X+1: mv wc/foo wc/zig
> > mv wc/bar wc/zag
> > commit
> >
> > rev X+2: mv wc/zig wc/bar
> > mv wc/zag wc/foo
> > commit
> > wc/foo contains text "bar"
> > wc/bar contains text "foo"
> >
> > So the working copy contains wc/foo at rev X+2 with contents "bar".
> > When I run 'svn cat -rX wc/foo' do I get contents "foo" or contents
> > "bar"?
>
> I vote for "bar". To me that reads "In rev X, what did the filesystem
> object that is called wc/foo in my wc contain? (if it existed at
> all)", and thus the rename history should be followed back in time.
I see specifying a working copy as a shortcut to prevent having to type
a URL. I don't see it as having different semantics. Having the same
command which "specifies a revision" give different answers depending on
whether or not I give a wc path or a URL is just too wacky.
In any event, there is extra wackiness here as an object "foo" exists at
revision X. Your vote bothers me :)
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Robert Pluim <rp...@bigfoot.com>.
Philip Martin writes:
>
> I asked "straight to wc/foo in rev X" or "follow history to wc/bar".
>
> > I do a checkout of rev X. I know that a checkout of a single file is
> > not possible in subversion, but svn cat should work like that.
>
> Lets try again
>
> rev X: wc/foo contains text "foo"
> wc/bar contains text "bar"
>
> rev X+1: mv wc/foo wc/zig
> mv wc/bar wc/zag
> commit
>
> rev X+2: mv wc/zig wc/bar
> mv wc/zag wc/foo
> commit
> wc/foo contains text "bar"
> wc/bar contains text "foo"
>
> So the working copy contains wc/foo at rev X+2 with contents "bar".
> When I run 'svn cat -rX wc/foo' do I get contents "foo" or contents
> "bar"?
I vote for "bar". To me that reads "In rev X, what did the filesystem
object that is called wc/foo in my wc contain? (if it existed at
all)", and thus the rename history should be followed back in time.
--
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Colin Watson <cj...@flatline.org.uk>.
On Thu, Mar 27, 2003 at 10:18:00PM +0000, Philip Martin wrote:
> "SteveKing" <st...@gmx.ch> writes:
> > seems there was a slight misunderstanding.
> > lets make it clear:
> >
> > svn cat -rX+2 wc/foo
> > would output "bar"
> >
> > svn cat -rX+1 wc/foo
> > would output "bar"
> >
> > svn cat -rX wc/foo
> > would output "bar"
>
> How about 'svn cat -rX http://server/repo/foo'? I suppose that would
> output "foo". What about 'svn cat -rX+1 http://server/repo/foo'? I
> suppose that returns an error "foo not found". It seems that working
> copy paths and URLs produce different results.
That's certainly what I'd expect. Intuitively, working copy paths should
use context from what's in the working copy; URLs should not.
--
Colin Watson [cjwatson@flatline.org.uk]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> > Sure, it's possible to check the logs to find out at which revision(s)
> > the file was moved/renamed, but only if a) the log messages
> > are good (means the developer wrote about the move in the log)
>
> That's just not true. 'svn log -v' shows the move, even if the
> developer wrote an empty log message.
Sorry, my fault. It's been a while since I lasted used that with '-v'.
But I would really like svn cat to check if the file has been
moved/renamed and not let the user do that.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Ben Collins-Sussman <su...@collab.net>.
"SteveKing" <st...@gmx.ch> writes:
> Sure, it's possible to check the logs to find out at which revision(s)
> the file was moved/renamed, but only if a) the log messages
> are good (means the developer wrote about the move in the log)
That's just not true. 'svn log -v' shows the move, even if the
developer wrote an empty log message.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> How about 'svn cat -rX http://server/repo/foo'? I suppose that would
> output "foo". What about 'svn cat -rX+1 http://server/repo/foo'? I
> suppose that returns an error "foo not found". It seems that working
> copy paths and URLs produce different results.
yes, they would produce different results. When explicitely giving an URL
I would expect it to error if that "link" did not exist in the given
revision,
but giving a wc path should follow the moves/copies since its still the
same file, only at another location / with a different name.
Imagine a developer who wants an earlier version of a single file.
He does not know that the file was moved/renamed by another
developer before - he just wants to know how the file looked
at a specific revision. Then he'll use svn cat -rX wc/file > file_at_revX
and he's got the file.
Sure, it's possible to check the logs to find out at which revision(s)
the file was moved/renamed, but only if a) the log messages
are good (means the developer wrote about the move in the log)
and b) the number of revisions of the project are lower than about 100 -
or do you really think that a developer would search through more
than a 100 logs to find something? Maybe on *nix with grep and
good luck to give the correct search pattern, but never on windows.
Another way of getting the file's content would be the svn diff command,
but that does not produce a complete file but only the differences - and
many times that's enough. But this method is useless if you need the
complete file.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Philip Martin <ph...@codematters.co.uk>.
"SteveKing" <st...@gmx.ch> writes:
> > Lets try again
> >
> > rev X: wc/foo contains text "foo"
> > wc/bar contains text "bar"
> >
> > rev X+1: mv wc/foo wc/zig
> > mv wc/bar wc/zag
> > commit
> >
> > rev X+2: mv wc/zig wc/bar
> > mv wc/zag wc/foo
> > commit
> > wc/foo contains text "bar"
> > wc/bar contains text "foo"
> >
> > So the working copy contains wc/foo at rev X+2 with contents "bar".
> > When I run 'svn cat -rX wc/foo' do I get contents "foo" or contents
> > "bar"?
>
> seems there was a slight misunderstanding.
> lets make it clear:
>
> svn cat -rX+2 wc/foo
> would output "bar"
>
> svn cat -rX+1 wc/foo
> would output "bar"
>
> svn cat -rX wc/foo
> would output "bar"
How about 'svn cat -rX http://server/repo/foo'? I suppose that would
output "foo". What about 'svn cat -rX+1 http://server/repo/foo'? I
suppose that returns an error "foo not found". It seems that working
copy paths and URLs produce different results.
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> Lets try again
>
> rev X: wc/foo contains text "foo"
> wc/bar contains text "bar"
>
> rev X+1: mv wc/foo wc/zig
> mv wc/bar wc/zag
> commit
>
> rev X+2: mv wc/zig wc/bar
> mv wc/zag wc/foo
> commit
> wc/foo contains text "bar"
> wc/bar contains text "foo"
>
> So the working copy contains wc/foo at rev X+2 with contents "bar".
> When I run 'svn cat -rX wc/foo' do I get contents "foo" or contents
> "bar"?
seems there was a slight misunderstanding.
lets make it clear:
svn cat -rX+2 wc/foo
would output "bar"
svn cat -rX+1 wc/foo
would output "bar"
svn cat -rX wc/foo
would output "bar"
since the file itself didn't change in all revisions, only the name of the
file.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Philip Martin <ph...@codematters.co.uk>.
"SteveKing" <st...@gmx.ch> writes:
> > Now if I run 'svn cat -rX wc/foo' does it follow history through the
> > moves to wc/bar in rev X or does it go straight to wc/foo in rev X?
>
> I would expect it to go straight to wc/bar in rev X. The same as if
Huh? "straight to wc/bar in rev X"?
I asked "straight to wc/foo in rev X" or "follow history to wc/bar".
> I do a checkout of rev X. I know that a checkout of a single file is
> not possible in subversion, but svn cat should work like that.
Lets try again
rev X: wc/foo contains text "foo"
wc/bar contains text "bar"
rev X+1: mv wc/foo wc/zig
mv wc/bar wc/zag
commit
rev X+2: mv wc/zig wc/bar
mv wc/zag wc/foo
commit
wc/foo contains text "bar"
wc/bar contains text "foo"
So the working copy contains wc/foo at rev X+2 with contents "bar".
When I run 'svn cat -rX wc/foo' do I get contents "foo" or contents
"bar"?
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
> It is a little complicated though, suppose things move around
>
> rev X: wc/foo
> wc/bar
>
> mv wc/foo wc/zig
> mv wc/bar wc/zag
> commit
>
> rev X+1: wc/zig
> wc/zag
>
> mv wc/zig wc/bar
> mv wc/zag wc/foo
> commit
>
> rev X+2: wc/foo
> wc/bar
>
> Now if I run 'svn cat -rX wc/foo' does it follow history through the
> moves to wc/bar in rev X or does it go straight to wc/foo in rev X?
I would expect it to go straight to wc/bar in rev X. The same as if
I do a checkout of rev X. I know that a checkout of a single file is
not possible in subversion, but svn cat should work like that.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Branko Čibej <br...@xbc.nu>.
Tobias Ringstrom wrote:
>I can imagine needing both methods. How about changing -r to follow
>history through the moves to wc/bar in rev X, and implement -R to go
>straight to wc/foo in rev X as -r does now?
>
>That way we get the following meanings of -r and -R:
>
>-rX: First locate the object using the specified name in the wc, then
> trace history backwards to revision X. If an URL is used, the HEAD
> version of the repo is used to identify the object whose history is
> traced back to rev X.
>
>-RX: In version X of the repository, locate the object by the specified
> name.
>
>
Now, this *does* sound like a recipe for confusion. I don't understand
why people are so worried about URLs and WC paths acting differently.
After all, they already do, and for good reason. Take, for example, the
following:
svn mv wc/foo wc/bar
svn mv file:///repo/foo file:///repo/bar
These two commands don't do the same thing. The first creates an
uncommitted copy in the WC, using the current WC version as the copy
source; the second commits a copy of HEAD in the repository.
Let's look at "svn cat" in this light:
(1) svn cat wc/foo
(2) svn cat file:///repo/foo
To me, the most obvious interpretation of (1) is to get the contents of
the BASE version of wc/foo, regardless of local modifications; and of
(2), get the contents of "foo" at current HEAD of the repository. So, if
"wc/foo" hasn't been renamed in the working copy, these could be
rewritten to:
(1) svn cat -rBASE url-of(wc/foo)
(2) svn cat -rHEAD file:///repo/foo
where "url-of(wc/foo)" is whatever "svn info" tells you about the URL.
Extendinf this difference of interpretation, it seems obvious to me that
(3) svn cat -r15 wc/foo
(4) svn cat -r15 file:///repo/foo
have different meanings, too: (3) means get me the contents that the
file wc/foo had in revision 15, regardless of what its name was then;
and (4) means get the contents of whatever was called "foo" in revision
15 of the repository.
The idea that WC paths are just shortcuts for URLs is, IMNSHO, flawed.
If we do that, you really don't have any way of following rename history
without parsing the output of "svn log".
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Tobias Ringstrom <to...@ringstrom.mine.nu>.
On 27 Mar 2003, Philip Martin wrote:
> Yes, I think a lot of commands would benefit from the ability to
> follow copy history: diff, merge, ls, pl.
>
> It is a little complicated though, suppose things move around
>
> rev X: wc/foo
> wc/bar
>
> mv wc/foo wc/zig
> mv wc/bar wc/zag
> commit
>
> rev X+1: wc/zig
> wc/zag
>
> mv wc/zig wc/bar
> mv wc/zag wc/foo
> commit
>
> rev X+2: wc/foo
> wc/bar
>
> Now if I run 'svn cat -rX wc/foo' does it follow history through the
> moves to wc/bar in rev X or does it go straight to wc/foo in rev X?
I can imagine needing both methods. How about changing -r to follow
history through the moves to wc/bar in rev X, and implement -R to go
straight to wc/foo in rev X as -r does now?
That way we get the following meanings of -r and -R:
-rX: First locate the object using the specified name in the wc, then
trace history backwards to revision X. If an URL is used, the HEAD
version of the repo is used to identify the object whose history is
traced back to rev X.
-RX: In version X of the repository, locate the object by the specified
name.
By the way, is this really the first time this issue comes up? It would
surprise me if the long time developers haven't though hard about these
issues already.
/Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by Philip Martin <ph...@codematters.co.uk>.
"SteveKing" <st...@gmx.ch> writes:
> > Stefan, I was wrong -- this is not issue #891. It's not even a bug.
> >
> > You create subfolder/myfile.txt in revision *3*. Then you try to cat
> > it -- from revision 2. Of course that doesn't work :-). The path
> > doesn't exist in revision 2.
>
> I know that. But I would expect it to work like svn log also shows
> the log for the revisions before the move.
Yes, I think a lot of commands would benefit from the ability to
follow copy history: diff, merge, ls, pl.
It is a little complicated though, suppose things move around
rev X: wc/foo
wc/bar
mv wc/foo wc/zig
mv wc/bar wc/zag
commit
rev X+1: wc/zig
wc/zag
mv wc/zig wc/bar
mv wc/zag wc/foo
commit
rev X+2: wc/foo
wc/bar
Now if I run 'svn cat -rX wc/foo' does it follow history through the
moves to wc/bar in rev X or does it go straight to wc/foo in rev X?
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by SteveKing <st...@gmx.ch>.
>Yes, it is. Thanks for the excellent bug report (would still have
>been more excellent if it included the versions of client and server,
>but in this case the transcript was enough to identify a familiar
>issue.)
Sorry, forgot that. I'm always using the newest versions, sometimes
even 'unofficial' i.e. the newest revisions compiled myself.
> Stefan, I was wrong -- this is not issue #891. It's not even a bug.
>
> You create subfolder/myfile.txt in revision *3*. Then you try to cat
> it -- from revision 2. Of course that doesn't work :-). The path
> doesn't exist in revision 2.
I know that. But I would expect it to work like svn log also shows
the log for the revisions before the move.
Since I'm giving the working copy path and not the repository path
(in that case the error would be ok) I don't know if the file has
been moved before or not. I would have to check that first
with svn log, but that's not usable in a script or program since
the log messages describing the move can't be used.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by kf...@collab.net.
"SteveKing" <st...@gmx.ch> writes:
> it seems that
> svn cat
> doesn't follow moved/renamed files if given
> a revision number:
>
> working copy at revision 2
> svn mv myfile.txt subfolder/myfile.txt
> svn commit --message "file moved"
> svn cat subfolder/myfile.txt -r 2
> svn:RA layer request failed
> svn: PROPFIND of /svn/repos/!svn/bc/2/trunk/project/subfolder/myfile.txt
> 404 Not Found
>
> I guess that's a bug?
Stefan, I was wrong -- this is not issue #891. It's not even a bug.
You create subfolder/myfile.txt in revision *3*. Then you try to cat
it -- from revision 2. Of course that doesn't work :-). The path
doesn't exist in revision 2.
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn cat doesn't work on moved files
Posted by kf...@collab.net.
"SteveKing" <st...@gmx.ch> writes:
> it seems that
> svn cat
> doesn't follow moved/renamed files if given
> a revision number:
>
> working copy at revision 2
> svn mv myfile.txt subfolder/myfile.txt
> svn commit --message "file moved"
> svn cat subfolder/myfile.txt -r 2
> svn:RA layer request failed
> svn: PROPFIND of /svn/repos/!svn/bc/2/trunk/project/subfolder/myfile.txt
> 404 Not Found
>
> I guess that's a bug?
Yes, it is. Thanks for the excellent bug report (would still have
been more excellent if it included the versions of client and server,
but in this case the transcript was enough to identify a familiar
issue.)
I believe this is:
http://subversion.tigris.org/issues/show_bug.cgi?id=891
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org