You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Yakov Lerner <il...@gmail.com> on 2008/05/11 12:10:41 UTC

'reverse diff': diff between working copy and latest head on server ?

How can I quickly generate diffs between working copy and latest state on
server (which is modified by checkins of  other users) ?
Any quickly working script for that ?

One apparent solution is to export to temp dir then run
'diff -r --exclude .svn'. Is there faster solution ? Export+diff
solution is proportional to size of whole tree rather than size of diffs.

Thanks
Yakov

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

Re: 'reverse diff': diff between working copy and latest head on server ?

Posted by Hari Kodungallur <hk...@gmail.com>.
On Mon, May 12, 2008 at 5:52 AM, Yakov Lerner <il...@gmail.com> wrote:

> On Mon, May 12, 2008 at 6:54 AM, Hari Kodungallur
> <hk...@gmail.com> wrote:
> >
> >
> > On Sun, May 11, 2008 at 5:10 AM, Yakov Lerner <il...@gmail.com> wrote:
> > > How can I quickly generate diffs between working copy and latest state
> on
> > > server (which is modified by checkins of  other users) ?
> > > Any quickly working script for that ?
> > >
> > > One apparent solution is to export to temp dir then run
> > > 'diff -r --exclude .svn'. Is there faster solution ? Export+diff
> > > solution is proportional to size of whole tree rather than size of
> diffs.
> > >
> >
> >
> > svn diff --old=<URL-to-repository>  --new=<working-copy-dir>
>
> When I do 'svn diff --old... --new...' it in the form that you
> show, it shows local changes, but does not show repo checkins missing
> in the local working dir. (If I do 'svn up', those checkins are updated.)
>
> Do you know why 'svn diff --old=<URL-to-repository>  --new=.' does not
> show new repo checkins ?
>
> The test script is below.
> Yakov
> ------------- script svn-test-diff-to-repo --------------------
> #!/bin/bash
>
> # demo for the "diff to repository"
>
>
> die() { echo 1>&2 "$*"; exit 10; }
>
> set -x
> REPO=/tmp/repo1
> WRK1=/tmp/w1
> WRK2=/tmp/w2
> set +x
>
> echo "Press Enter when ready to erase and re-create $REPO, $WRK1, $WRK2?"
> read ANS
>
> set -x
> rm -rf $REPO $WRK1 $WRK2
> svnadmin create $REPO || die Error
> svn co file:///$REPO $WRK1 >/dev/null || die Error
> svn co file:///$REPO $WRK2 >/dev/null || die Error
>
> echo remote >$WRK2/remote || exit 1
> svn add $WRK2/remote || exit 1
> svn ci -m Changes --force-log --non-interactive $* || exit 1



Please try replacing "$*"  with "$WRK2" and let us know if that works.

[In short, this script fails if you run it from a directory that is NOT a
working copy of any svn repository. In your case, I think you are running it
from a directory that is the working copy of a repository that is different
from the test repository created by your script - and this working copy is
upto date and has nothing to check-in. So, the add command goes through
without adding anything. The added file in /tmp/w2 remains not checked in.
See below...]



>
>
> echo local >$WRK1/local || die Error
>
> ls -l $WRK1
> ls -l $WRK2
>
> set +x
> echo "We want to see diff between $WRK1 ('our local workdir') and
> repository"
> echo "NB repo contains new checkin 'remote' not present in $WRK1"
> set -x
>
> sleep 2 # operator is in suspense
>
> svn diff --old=file:///$REPO --new=$WRK1
> ------------------------------- output of test script
> -----------------------------
> + REPO=/tmp/repo1
> + WRK1=/tmp/w1
> + WRK2=/tmp/w2
> + set +x
> Press Enter when ready to erase and re-create /tmp/repo1, /tmp/w1,
> /tmp/w2?
>
> + rm -rf /tmp/repo1 /tmp/w1 /tmp/w2
> + svnadmin create /tmp/repo1
> + svn co file:////tmp/repo1 /tmp/w1
> + svn co file:////tmp/repo1 /tmp/w2
> + echo remote
> + svn add /tmp/w2/remote
> A         /tmp/w2/remote
> + svn ci -m Changes --force-log --non-interactive



If it really added anything, you should see some output here "Adding <file>;
Transmitting file data..." etc.



>
> + echo local
> + ls -l /tmp/w1
> total 4
> -rw-r--r-- 1 lerner lerner 6 May 12 15:33 local
> + ls -l /tmp/w2
> total 4
> -rw-r--r-- 1 lerner lerner 7 May 12 15:33 remote
> + set +x
> We want to see diff between /tmp/w1 ('our local workdir') and repository
> NB repo contains new checkin 'remote' not present in /tmp/w1
> + sleep 2
> + svn diff --old=file:////tmp/repo1 --new=/tmp/w1
>
> ^^^^^^^^^^ nb we expect file 'remote' to be reported but it is not
> reported
>
> --------------------------------------------------------------------------------------
>



Regards,
-Hari

Re: 'reverse diff': diff between working copy and latest head on server ?

Posted by Yakov Lerner <il...@gmail.com>.
On Mon, May 12, 2008 at 6:54 AM, Hari Kodungallur
<hk...@gmail.com> wrote:
>
>
> On Sun, May 11, 2008 at 5:10 AM, Yakov Lerner <il...@gmail.com> wrote:
> > How can I quickly generate diffs between working copy and latest state on
> > server (which is modified by checkins of  other users) ?
> > Any quickly working script for that ?
> >
> > One apparent solution is to export to temp dir then run
> > 'diff -r --exclude .svn'. Is there faster solution ? Export+diff
> > solution is proportional to size of whole tree rather than size of diffs.
> >
>
>
> svn diff --old=<URL-to-repository>  --new=<working-copy-dir>

When I do 'svn diff --old... --new...' it in the form that you
show, it shows local changes, but does not show repo checkins missing
in the local working dir. (If I do 'svn up', those checkins are updated.)

Do you know why 'svn diff --old=<URL-to-repository>  --new=.' does not
show new repo checkins ?

The test script is below.
Yakov
------------- script svn-test-diff-to-repo --------------------
#!/bin/bash

# demo for the "diff to repository"


die() { echo 1>&2 "$*"; exit 10; }

set -x
REPO=/tmp/repo1
WRK1=/tmp/w1
WRK2=/tmp/w2
set +x

echo "Press Enter when ready to erase and re-create $REPO, $WRK1, $WRK2?"
read ANS

set -x
rm -rf $REPO $WRK1 $WRK2
svnadmin create $REPO || die Error
svn co file:///$REPO $WRK1 >/dev/null || die Error
svn co file:///$REPO $WRK2 >/dev/null || die Error

echo remote >$WRK2/remote || exit 1
svn add $WRK2/remote || exit 1
svn ci -m Changes --force-log --non-interactive $* || exit 1

echo local >$WRK1/local || die Error

ls -l $WRK1
ls -l $WRK2

set +x
echo "We want to see diff between $WRK1 ('our local workdir') and repository"
echo "NB repo contains new checkin 'remote' not present in $WRK1"
set -x

sleep 2 # operator is in suspense

svn diff --old=file:///$REPO --new=$WRK1
------------------------------- output of test script
-----------------------------
+ REPO=/tmp/repo1
+ WRK1=/tmp/w1
+ WRK2=/tmp/w2
+ set +x
Press Enter when ready to erase and re-create /tmp/repo1, /tmp/w1, /tmp/w2?

+ rm -rf /tmp/repo1 /tmp/w1 /tmp/w2
+ svnadmin create /tmp/repo1
+ svn co file:////tmp/repo1 /tmp/w1
+ svn co file:////tmp/repo1 /tmp/w2
+ echo remote
+ svn add /tmp/w2/remote
A         /tmp/w2/remote
+ svn ci -m Changes --force-log --non-interactive
+ echo local
+ ls -l /tmp/w1
total 4
-rw-r--r-- 1 lerner lerner 6 May 12 15:33 local
+ ls -l /tmp/w2
total 4
-rw-r--r-- 1 lerner lerner 7 May 12 15:33 remote
+ set +x
We want to see diff between /tmp/w1 ('our local workdir') and repository
NB repo contains new checkin 'remote' not present in /tmp/w1
+ sleep 2
+ svn diff --old=file:////tmp/repo1 --new=/tmp/w1

^^^^^^^^^^ nb we expect file 'remote' to be reported but it is not reported
--------------------------------------------------------------------------------------

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

Re: 'reverse diff': diff between working copy and latest head on server ?

Posted by Hari Kodungallur <hk...@gmail.com>.
On Sun, May 11, 2008 at 5:10 AM, Yakov Lerner <il...@gmail.com> wrote:

> How can I quickly generate diffs between working copy and latest state on
> server (which is modified by checkins of  other users) ?
> Any quickly working script for that ?
>
> One apparent solution is to export to temp dir then run
> 'diff -r --exclude .svn'. Is there faster solution ? Export+diff
> solution is proportional to size of whole tree rather than size of diffs.
>


svn diff --old=<URL-to-repository>  --new=<working-copy-dir>

rgds,
-Hari