You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by David Sitsky <si...@users.sourceforge.net> on 2003/08/18 01:02:29 UTC
svn diff doesn't include repository path of changed files
Hi,
I am the writer of Codestriker (http://codestriker.sourceforge.net), a
web-based Code reviewing system, which supports Subversion (and CVS,
patch) diffs.
A user informed me of a problem I wasn't aware of. Code review topics are
typically created by issuing a command like:
"cvs diff -uN > /tmp/review.txt"
This file is then loaded in Codestriker, parsed, and then available for
reviewing. I have always run this command at the top-level of a checkout,
so all file paths in the review.txt file were relative to the repository
root.
I had a user, who had something like:
project/dira/file1.java
project/dira/file2.java
project/dirb/file3.java
He did a:
cd project/dirb
svn diff -uN > /tmp/review.txt
This caused a problem, rather than seeing something like:
Index: project/dirb/file3.java
===================================================================
--- project/dirb/file3.java (revision 5497)
+++ project/dirb/file3.java (working copy)
the repository path information is not present, as this is what happened:
Index: file3.java
===================================================================
--- file3.java (revision 5497)
+++ file3.java (working copy)
This information is often really important, as it adds extra information to
the diff. When using "cvs diff", this information is present, as there is
an extra line "RCS file: " which contains the full path of the repository
file being modified. I wonder if the Index: file can contain this
information?
Codestriker needs this information, to be able to link the file being
modified with the corresponding file in the repository, so that it can
retrieve the entire contents of this file, when displaying how the file
appears before any changes, and after.
Is there another flag or another way of retrieving this information? I'm
guessing a script could be written to work around this somehow, but I
wanted to first check if there is an easy way around this.
I should also say, I am not a real subversion user yet (and I'm not
subscribed to this list), so I apologise in advance if this is a really
silly question.
Cheers,
David
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by mark benedetto king <mb...@lowlatency.com>.
On Mon, Aug 18, 2003 at 10:08:33AM -0500, Ben Collins-Sussman wrote:
> [sussman@kepler:~/projects/svn]$ svn diff subversion/clients/cmdline/diff-cmd.c
> Index: subversion/clients/cmdline/diff-cmd.c
For some reason, this doesn't work for svn commit.
--This line, and those below, will be ignored--
M diff-cmd.c
--ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by David Sitsky <si...@users.sourceforge.net>.
> But if your *code* needs to figure it out, you may have to use the SVN
> API's.
Yep, you're 100% right on all your comments. All I need to do at the end
of the day is to issue a command like the following to retrieve the file
contents.
% svn cat --revision 6 http://host/svn/jrepenning/trunk/home/.bashrc
My thinking was clouded by what is required with CVS. So the only issue is
really, can we put the full URL for this file in the Index field in the
diff?
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Jack Repenning <jr...@collab.net>.
At 10:34 AM +1000 8/19/03, David Sitsky wrote:
>When a Codestriker topic is created, the repository that the code review
>has been made against needs to be nominated, in this case, it would be
>http://host/svn/jrepenning.
That is not necessarily true; does this matter for your purposes?
SVN does not enforce any rules about where in the path "the
repository root" appears. You have correctly spotted the spot where
I happen to have my repo root, but there's at least one other common
convention that this identical URL could represent:
repo: http://host/svn/
project: jrepenning/
stuff in project: trunk/home/.bashrc
Indeed, as far as SVN is concerned, "trunk" might be the repo root,
or even lower; it is only a human convention that this be the name of
the directory containing the latest versions.
>If the diff file contained in this instance,
>http://host/svn/jrepenning/trunk/home/.bashrc in the Index: line, we could
>determine what the file's relative path in the repository is. Then in the
>main Codestriker GUI, the file's full contents could be retrieved directly
>using svn commands, as all the information required to do this is
>available (the revision number is also extracted).
You don't need to monkey with that URL in any way (and you don't need
to solve the impossible problem of where the repo root starts) in
order to do this. just use the URL. This is different (and, I
think, just a teeny bit easier) than CVS, where the first term or two
of path, and the trailing ",v", need to be shaved.
So if your program only wants to do the things you've mentioned, then
just use the URL (we still have open your wish that the URL should be
in the diff output, of course).
And if humans need to look at the string and know where the repo root
is, that's OK, too--they'll know these things.
But if your *code* needs to figure it out, you may have to use the SVN API's.
--
-==-
Jack Repenning
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
o: 650.228.2562
c: 408.835-8090
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by David Sitsky <si...@users.sourceforge.net>.
> At 11:02 AM +1000 8/18/03, David Sitsky wrote:
> >Codestriker needs this information, to be able to link the file being
> >modified with the corresponding file in the repository, so that it can
> >retrieve the entire contents of this file, when displaying how the file
> >appears before any changes, and after.
>
> ... and that *is* available in .svn/*, e.g.
>
> > > svn info .bashrc
> >
> >Path: .bashrc
> >Name: .bashrc
> >Url: http://host/svn/jrepenning/trunk/home/.bashrc
>
> Indeed, it seems like his goal is "some incantation that lets him
> address the repository file in blissful disregard for all those messy
> working copy details," and that is just exactly what this URL is!
Yep, in my case, the URL is exactly what is required. In CVS diffs, the
RCS line provides similar information, it combines the path of the
repository plus the path of the file within the repository (ie, the
absolute path of the RCS file in the filesystem).
When a Codestriker topic is created, the repository that the code review
has been made against needs to be nominated, in this case, it would be
http://host/svn/jrepenning.
If the diff file contained in this instance,
http://host/svn/jrepenning/trunk/home/.bashrc in the Index: line, we could
determine what the file's relative path in the repository is. Then in the
main Codestriker GUI, the file's full contents could be retrieved directly
using svn commands, as all the information required to do this is
available (the revision number is also extracted).
This is how things work essentially when CVS diffs are parsed, the RCS line
is broken up into the CVSROOT, and the file's path within the repository.
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Jack Repenning <jr...@collab.net>.
At 6:47 PM -0500 8/18/03, Ben Collins-Sussman wrote:
>But otherwise, as garrett said, each
>directory is an independent working copy. A directory has no idea
>where the "root" of the working copy is
I don't think he's asking for the root of the working copy, nor the
synthetic place where a root might be if it were there but it ain't.
I think he's looking for repository-relative info:
At 11:02 AM +1000 8/18/03, David Sitsky wrote:
>Codestriker needs this information, to be able to link the file being
>modified with the corresponding file in the repository, so that it can
>retrieve the entire contents of this file, when displaying how the file
>appears before any changes, and after.
... and that *is* available in .svn/*, e.g.
> > svn info .bashrc
>Path: .bashrc
>Name: .bashrc
>Url: http://host/svn/jrepenning/trunk/home/.bashrc
Indeed, it seems like his goal is "some incantation that lets him
address the repository file in blissful disregard for all those messy
working copy details," and that is just exactly what this URL is!
> > svn cat http://host/svn/jrepenning/trunk/home/.bashrc
># .bashrc -*- sh -*-
>...
--
-==-
Jack Repenning
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
o: 650.228.2562
c: 408.835-8090
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Francois Beausoleil <fb...@users.sourceforge.net>.
svn commit has the same kind of, shall we say, "problem". If I commit
from the root of the WC and do not specify a message, I get full paths to
the files in the prepared commit message. If I specify a single file,
the prepared message will contain only the filename and no path
information. Committing on two paths, svn will find the common parent to
both folders and use this as the root of the commit.
Some examples will help:
E:\java\leadmanagement>svn info
Path:
Url: http://svn.hopto.org:8193/repos/rac/leadmanagement/trunk
E:\java\leadmanagement>svn st
M src\java\core\jobnudge\servlets\Login.java
A src\java\tests\abc.txt
E:\java\leadmanagement>svn commit
--This line, and those below, will be ignored--
M src/java/core/jobnudge/servlets/Login.java
M src/java/tests/abc.txt
E:\java\leadmanagement>svn commit src\java\core
--This line, and those below, will be ignored--
M core/jobnudge/servlets/Login.java
E:\java\leadmanagement>svn commit
src\java\core\jobnudge\servlets\Login.java
--This line, and those below, will be ignored--
M Login.java
E:\java\leadmanagement>svn commit src\java\core src\java\tests
--This line, and those below, will be ignored--
M core/jobnudge/servlets/Login.java
A tests/abc.txt
E:\java\leadmanagement>svn --version
svn, version 0.25.0 (r6433)
compiled Jul 10 2003, 22:05:10
System is Win2K SP3. Server is Apache 2.0.47 (although in this case,
this does not matter. Client-issue only).
What I know is that when I specify a path, the svn-commit.tmp file will
be created in the folder where the commit path is. So, when nothing is
specified, '.' is implied, and svn-commit.tmp is created as
.\svn-commit.tmp. When I pass src\java\core, the svn-commit.tmp file is
created as .\src\java\core\svn-commit.tmp.
I believe there was a request, oh so long ago, where someone asked if the
prepared svn-commit.tmp message could contain the path to the root of the
WC. I understand that this is not possible, but at least, if I start the
commit from the root of my WC, at least give me the full path from the
root of the WC, and not from the path to the svn-commit.tmp.
Thanks for listening !
Bye,
François
On 18 Aug 2003 18:47:21 -0500, "Ben Collins-Sussman" <su...@collab.net>
said:
> David Sitsky <si...@users.sourceforge.net> writes:
>
> > It was a while since I tried out subversion, but didn't it have some
> > control files in each directory which told it what part of the repository
> > the directory was a part of?
>
> Sure, just like CVS, each directory has an administrative area. The
> admin area contains a repository UUID and the full URL to the
> directory in the repository. But otherwise, as garrett said, each
> directory is an independent working copy. A directory has no idea
> where the "root" of the working copy is (i.e. how many parents it
> has), nor does it know its absolute path in the repository. (The URL
> isn't enough; the wc doesn't know where the host-repository part ends
> and the inner repository path begins.)
>
Developer of Java Gui Builder
http://jgb.sourceforge.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Ben Collins-Sussman <su...@collab.net>.
David Sitsky <si...@users.sourceforge.net> writes:
> It was a while since I tried out subversion, but didn't it have some
> control files in each directory which told it what part of the repository
> the directory was a part of?
Sure, just like CVS, each directory has an administrative area. The
admin area contains a repository UUID and the full URL to the
directory in the repository. But otherwise, as garrett said, each
directory is an independent working copy. A directory has no idea
where the "root" of the working copy is (i.e. how many parents it
has), nor does it know its absolute path in the repository. (The URL
isn't enough; the wc doesn't know where the host-repository part ends
and the inner repository path begins.)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by David Sitsky <si...@users.sourceforge.net>.
On Tue, 19 Aug 2003 09:12, Garrett Rooney wrote:
> David Sitsky wrote:
> >>I think you missed a step in the question, didn't you, Ben? The
> >>problem statement included cd'ing down somewhere into the project;
> >>the diffs are reported relative to "."; the request is that they
> >>(also) be identified relative to the repository root:
> >
> > [...]
> >
> >>Index: index.html # no repository root here
> >>===================================================================
> >>--- index.html (revision 2) # not here, too
> >>+++ index.html (working copy)
> >>@@ -6,3 +6,4 @@
> >> This is new project content.
> >> </body>
> >> </html>
> >>+Mon Aug 18 09:44:26 PDT 2003
> >
> > Yep - this is the problem I am referring to. Is there any reason why
> > the Index field could contain the repository path?
>
> Yes, because when you cd into the subdirectory, your svn process now has
> no idea that there are more working copy directories above it in the
> hierarchy. If you want the whole path, run it from the base directory
> in the working copy.
I understand I can do that, but not all users do, and sometimes, it might
only be desirable to obtain a diff from one segment of my project tree.
It was a while since I tried out subversion, but didn't it have some
control files in each directory which told it what part of the repository
the directory was a part of?
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
David Sitsky wrote:
>>I think you missed a step in the question, didn't you, Ben? The
>>problem statement included cd'ing down somewhere into the project;
>>the diffs are reported relative to "."; the request is that they
>>(also) be identified relative to the repository root:
>
> [...]
>
>>Index: index.html # no repository root here
>>===================================================================
>>--- index.html (revision 2) # not here, too
>>+++ index.html (working copy)
>>@@ -6,3 +6,4 @@
>> This is new project content.
>> </body>
>> </html>
>>+Mon Aug 18 09:44:26 PDT 2003
>
>
> Yep - this is the problem I am referring to. Is there any reason why the
> Index field could contain the repository path?
Yes, because when you cd into the subdirectory, your svn process now has
no idea that there are more working copy directories above it in the
hierarchy. If you want the whole path, run it from the base directory
in the working copy.
-garrett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by David Sitsky <si...@users.sourceforge.net>.
> I think you missed a step in the question, didn't you, Ben? The
> problem statement included cd'ing down somewhere into the project;
> the diffs are reported relative to "."; the request is that they
> (also) be identified relative to the repository root:
[...]
> Index: index.html # no repository root here
> ===================================================================
> --- index.html (revision 2) # not here, too
> +++ index.html (working copy)
> @@ -6,3 +6,4 @@
> This is new project content.
> </body>
> </html>
> +Mon Aug 18 09:44:26 PDT 2003
Yep - this is the problem I am referring to. Is there any reason why the
Index field could contain the repository path?
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Jack Repenning <jr...@collab.net>.
At 10:08 AM -0500 8/18/03, Ben Collins-Sussman wrote:
>The reason I say this is that 'svn diff's internal diff mechanism
>*does* give the paths you want. Witness:
>
>
>[sussman@kepler:~/projects/svn]$ echo "foo" >>
>subversion/clients/cmdline/diff-cmd.c
>
>[sussman@kepler:~/projects/svn]$ svn status
>M subversion/clients/cmdline/diff-cmd.c
>
>[sussman@kepler:~/projects/svn]$ svn diff
>Index: subversion/clients/cmdline/diff-cmd.c
I think you missed a step in the question, didn't you, Ben? The
problem statement included cd'ing down somewhere into the project;
the diffs are reported relative to "."; the request is that they
(also) be identified relative to the repository root:
(dhcp64:\~/svnp2/www)
> svn --version
svn, version 0.26.0 (dev build)
(dhcp64:\~/svnp2/www)
> pwd
/Users/jrepenning/svnp2/www # from svn co http://.../svnp2/trunk svnp2
(dhcp64:\~/svnp2/www)
> date >> index.html
(dhcp64:\~/svnp2/www)
> svn diff
Index: index.html # no repository root here
===================================================================
--- index.html (revision 2) # not here, too
+++ index.html (working copy)
@@ -6,3 +6,4 @@
This is new project content.
</body>
</html>
+Mon Aug 18 09:44:26 PDT 2003
--
-==-
Jack Repenning
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
o: 650.228.2562
c: 408.835-8090
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by David Sitsky <si...@users.sourceforge.net>.
> There are many things wrong here. First, this user must be either
> using a very old svn ('svn diff' doesn't take a -u option!), or isn't
Sorry, that was my mistake regarding the use of the -u option.
The main issue is cding into the project directories, doing a diff, and not
receiving any repository path information in the diff, as mentioned in the
other email.
--
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svn diff doesn't include repository path of changed files
Posted by Ben Collins-Sussman <su...@collab.net>.
David Sitsky <si...@users.sourceforge.net> writes:
> I had a user, who had something like:
>
> project/dira/file1.java
> project/dira/file2.java
> project/dirb/file3.java
>
> He did a:
>
> cd project/dirb
> svn diff -uN > /tmp/review.txt
There are many things wrong here. First, this user must be either
using a very old svn ('svn diff' doesn't take a -u option!), or isn't
using subversion's built-in diff ability. The user might have a
run-time variable set that tells svn to use a 3rd-party "diff" program
instead.
The reason I say this is that 'svn diff's internal diff mechanism
*does* give the paths you want. Witness:
[sussman@kepler:~/projects/svn]$ echo "foo" >> subversion/clients/cmdline/diff-cmd.c
[sussman@kepler:~/projects/svn]$ svn status
M subversion/clients/cmdline/diff-cmd.c
[sussman@kepler:~/projects/svn]$ svn diff
Index: subversion/clients/cmdline/diff-cmd.c
===================================================================
--- subversion/clients/cmdline/diff-cmd.c (revision 6770)
+++ subversion/clients/cmdline/diff-cmd.c (working copy)
@@ -166,3 +166,4 @@
return SVN_NO_ERROR;
}
+foo
[sussman@kepler:~/projects/svn]$ svn diff subversion/clients/cmdline/diff-cmd.c
Index: subversion/clients/cmdline/diff-cmd.c
===================================================================
--- subversion/clients/cmdline/diff-cmd.c (revision 6770)
+++ subversion/clients/cmdline/diff-cmd.c (working copy)
@@ -166,3 +166,4 @@
return SVN_NO_ERROR;
}
+foo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org