You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by tr...@clayst.com on 2004/12/03 20:45:33 UTC

svn diff basics

svn 1.1.1 stand-alone on Windows 2000.

I want to do something very simple -- compare the changes between a 
file on branch X in the repository and the same file in my working copy 
of branch Y. This is to see what changes will be made if I merge the 
latest changes from branch X back into my WC of branch Y.

I cannot puzzle out the svn diff documentation, I think because the 
terminology changes.  Specifically, the term "TARGET" is used 
repeatedly in the text but is not listed in the syntax, and so far my 
inferences about what it means seem to have proved wrong :-(.

The repository is in h:/svnrepos/project, the other branch is "live", 
my WC is of branch "dev".  I am in the html subdir of branch dev 
(d:\project\dev\html) and I try this command:

    svn diff -r HEAD h:/svnrepos/project/live/html/base.inc . 

by which I meant "compare the head revision of the file base.inc in the 
"live" branch in the repository to the local working copy which came 
from the "dev" branch (which does exist, and is different -- I checked 
with diff).  I got:

    svn: Target lists to diff may not contain both working copy paths
    and URLs 

This surprised me since the docs say:

--revision N

    The client compares TARGET@N against working copy.

If I leave out the ".":

    svn diff -r HEAD h:/svnrepos/project/live/html/base.inc

I get no output at all, whcih suggests no difference -- and they are 
different.

What am I doing wrong??

Thanks,

--
Tom




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn diff basics

Posted by tr...@clayst.com.
On 4 Dec 2004 Josh Pieper wrote:

> It means 'svn diff' doesn't know how to find the difference between a
> file and a directory.

Thanks ... it's just a bit cryptic to convey that message!

> Patches are welcome. :) 

Understood.  I wish I could do that but unfortunately I don't have the 
time right now to set up a build environment to create and test them 
...

--
Tom




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn diff basics

Posted by Josh Pieper <jj...@pobox.com>.
trlists@clayst.com wrote:
> Thanks.  That works, but I also got some odd results.  Specifically, 
> this works properly for a single file:
> 
>     svn diff --old=file:///h:/repos/project/live/html/base.inc --
> new=.\base.inc
> 
> As does this for all files:
> 
>     svn diff --old=file:///h:/repos/project/live/html/ --new=.
> 
> However this:
> 
>     svn diff --old=file:///h:/repos/project/live/html/base.inc --new=.
> 
> (by which I meant, compare the named file in the repository to the 
> current directory, implying -- to me -- the same file in the current 
> directory) yields an error:
> 
>     svn: Cannot replace a directory from within
> 
> Now, what's that supposed to mean??

It means 'svn diff' doesn't know how to find the difference between a
file and a directory.  Patches are welcome. :)

-Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn diff basics

Posted by tr...@clayst.com.
On 3 Dec 2004 Josh Pieper wrote:

> You want to use usage case #2.
> 
> "svn diff --old=OLD-TGT --new=NEW-TGT"
> 
> I just tested it here locally and works with trunk, but I am pretty
> sure it worked with 1.1.x as well.  If you don't specify --old and
> --new, 'svn diff' thinks you are giving it a list of things to diff
> from one revision to another, but located in the same place.

Thanks.  That works, but I also got some odd results.  Specifically, 
this works properly for a single file:

    svn diff --old=file:///h:/repos/project/live/html/base.inc --
new=.\base.inc

As does this for all files:

    svn diff --old=file:///h:/repos/project/live/html/ --new=.

However this:

    svn diff --old=file:///h:/repos/project/live/html/base.inc --new=.

(by which I meant, compare the named file in the repository to the 
current directory, implying -- to me -- the same file in the current 
directory) yields an error:

    svn: Cannot replace a directory from within

Now, what's that supposed to mean??

Thanks,

--
Tom




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn diff basics

Posted by Josh Pieper <jj...@pobox.com>.
trlists@clayst.com wrote:
> svn 1.1.1, stand-alone, W2K.
> 
> Looking at this issue further, it seems diff just won't compare a rev 
> in one branch of the repository to a working copy of the same file from 
> another branch.  Any attempt to do so yields:
> 
>     svn: Target lists to diff may not contain both working copy paths
>     and URLs 
> 
> Is that right?
> 
> If so it seems in conflict with the help which says things like 
> "TARGETs may be working copy paths or URLs" and "OLD-TGT and NEW-TGT 
> may be working copy paths or URL[@REV]."

You want to use usage case #2.

"svn diff --old=OLD-TGT --new=NEW-TGT"

I just tested it here locally and works with trunk, but I am pretty
sure it worked with 1.1.x as well.  If you don't specify --old and
--new, 'svn diff' thinks you are giving it a list of things to diff
from one revision to another, but located in the same place.

> I can work around this by always committing local changes in a branch 
> before trying to compare against committed changes from another branch, 
> but I was hoping there was an easier way ...

Try the above and I think you'll find that no workarounds are
necessary.

-Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: svn diff basics

Posted by tr...@clayst.com.
svn 1.1.1, stand-alone, W2K.

Looking at this issue further, it seems diff just won't compare a rev 
in one branch of the repository to a working copy of the same file from 
another branch.  Any attempt to do so yields:

    svn: Target lists to diff may not contain both working copy paths
    and URLs 

Is that right?

If so it seems in conflict with the help which says things like 
"TARGETs may be working copy paths or URLs" and "OLD-TGT and NEW-TGT 
may be working copy paths or URL[@REV]."

I can work around this by always committing local changes in a branch 
before trying to compare against committed changes from another branch, 
but I was hoping there was an easier way ...

--
Tom




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org