You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Urs Thuermann <ur...@isnogud.escape.de> on 2006/06/23 15:01:50 UTC

svn marks files as modified after creating a branch

Another surprising behavior of SVN.  After I have created a branch in
my working copy, svn stat shows files as modified even though they are
not:

    $ svn co http://svn.berlios.de/svnroot/repos/socketcan 
    A    socketcan/trunk
    A    socketcan/trunk/can-utils
    A    socketcan/trunk/can-utils/terminal.h
    ...
    A    socketcan/trunk/etc/llcf
    A    socketcan/branches
    A    socketcan/tags
    Checked out revision 40.
    $ cd socketcan/
    $ svn mkdir branches/ut
    A         branches/ut
    $ svn cp trunk branches/ut/hlist
    A         branches/ut/hlist
    $ svn stat
    A      branches/ut
    A  +   branches/ut/hlist
    M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.c
    M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.h
    M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mpc52xx_can.c

What is happening here?  What do the three M lines mean?  I haven't
modified these files.  BTW, the repository is public, so you could try
to reproduce this.


urs

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

Re: svn marks files as modified after creating a branch

Posted by Urs Thuermann <ur...@isnogud.escape.de>.
Duncan Murdoch <mu...@stats.uwo.ca> writes:

> Just a guess, but the mscan.c file has svn:keywords assigned, and
> contains a $Id:$ keyword; that was probably modified when you made the
> copy.

I have made some further experiments, and, yes, it has indeed to do
with the svn:keywords property and the $Id:$ strings in the files.
However, there are some more details to it, since only 3 files showed
this behavior while almost all files contain the porperty and Id
keyword.

The difference is, that almost all the files were first checked in
containing "$Id$", while the 3 files contained "$Id:$" on their first
checkin.  The following commands show the difference:

  # First, create the repository, initial directory structure, and
  # create to files with Id keyword, one with the ":" and one without.

      urs$ cd ~/tmp
      tmp$ svnadmin create ~/SVN/TEST
      tmp$ svn co file://$HOME/SVN/TEST
      Checked out revision 0.
      tmp$ cd TEST 
      TEST$ svn mkdir trunk branches tags
      A         trunk
      A         branches
      A         tags
      TEST$ svn ci -m"dir structure"; svn up
      Adding         branches
      Adding         tags
      Adding         trunk
      
      Committed revision 1.
      At revision 1.
      TEST$ echo '$Id$' >trunk/a
      TEST$ echo '$Id:$' >trunk/b
      TEST$ svn add trunk/a trunk/b
      A         trunk/a
      A         trunk/b
      TEST$ svn propset svn:keywords Id trunk/a trunk/b
      property 'svn:keywords' set on 'trunk/a'
      property 'svn:keywords' set on 'trunk/b'
      TEST$ svn ci -m"add files a and b"; svn up
      Adding         trunk/a
      Adding         trunk/b
      Transmitting file data ..
      Committed revision 2.
      At revision 2.

  # Now create a new branch from the trunk.  The file b will be shown
  # as modified.

      TEST$ svn mkdir branches/ut
      A         branches/ut
      TEST$ svn cp trunk branches/ut/foo
      A         branches/ut/foo
      TEST$ svn stat
      A      branches/ut
      A  +   branches/ut/foo
      M  +   branches/ut/foo/b
      TEST$ svn diff
      Index: branches/ut/foo/b
      ===================================================================
      --- branches/ut/foo/b   (revision 2)
      +++ branches/ut/foo/b   (working copy)
      @@ -1 +1 @@
      -$Id:$
      +$Id$
      TEST$ 

  # Now we see the modifiaction also in the log message.

      TEST$ svn ci -m"create branch"; svn up
      Adding         branches/ut
      Adding         branches/ut/foo
      Sending        branches/ut/foo/b
      Transmitting file data .
      Committed revision 3.
      At revision 3.
      TEST$ svn log -r3 -v
      ------------------------------------------------------------------------
      r3 | urs | 2006-06-26 09:07:12 +0200 (Mon, 26 Jun 2006) | 1 line
      Changed paths:
         A /branches/ut
         A /branches/ut/foo (from /trunk:2)
         M /branches/ut/foo/b
      
      create branch
      ------------------------------------------------------------------------
      TEST$ 

My interpretation is, that while the svn copy command copies all files
to the new directory, it scans them for keyword strings to be replaced
by their canonical form at checkin.  I.e. it scans for strings like
"$Id: b 2 2006-06-26 07:05:37Z urs $ which should be checked in as "$Id$".
However, since the original files was checked in, containing "$Id:$",
there is now a difference between the files in trunk and in the
branch, when checked out and compared without keyword substitution, as
shown by the svn diff command above.

So, I have two questions:

1. Shouldn't the svn ci command also reduce keyword strings to their
   canonical form?  In the example above, the first checkin of b on
   the trunk should replace the "$Id:$ by "$Id$.  That way, later
   copies of the file don't show the difference.

2. Can I fix this in our repository?  If not, it would mean that every
   future branch or tag which we will create from the trunk will show
   a modification of the files checked in with "$Id:$".

   The only way I found to do it, is to change the "Id: b 3 ..."
   string in the working copy to "$Id$" and checkin again.  If there
   was a way without creating a new revision in the repository, I
   would prefer that.


urs

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

Re: svn marks files as modified after creating a branch

Posted by Urs Thuermann <ur...@isnogud.escape.de>.
Duncan Murdoch <mu...@stats.uwo.ca> writes:

> >     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.c
> >     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.h
> >     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mpc52xx_can.c

> Just a guess, but the mscan.c file has svn:keywords assigned, and
> contains a $Id:$ keyword; that was probably modified when you made the
> copy.

These fiels have indeed the svn:keywords assigned and contain a $Id$.
But this Id isn't changed when I do the svn copy, and almost all other
files in the trunk have that property assigend, too, and contain $Id$,
too.  But the 3 files in the directory kernel/2.6/drivers/net/can/mscan
are the only one which subversion considers modified.  What is the
difference between these and other files?  I have done a svn proplist -v 
one these files and the containing directory but could find any hint.

    $ ls trunk/kernel/2.6/drivers/net/can/mscan
    Makefile  mpc52xx_can.c  mscan.c  mscan.h
    $ svn proplist -v trunk/kernel/2.6/drivers/net/can/mscan/*
    Properties on 'trunk/kernel/2.6/drivers/net/can/mscan/mpc52xx_can.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/mscan/mscan.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/mscan/mscan.h':
      svn:keywords : Id
    $ svn proplist -v trunk/kernel/2.6/drivers/net/can/mscan
    $ svn proplist -v trunk/kernel/2.6/drivers/net/can 
    $

The difference bewtween Makefile and the other 3 files is indeed the
svn:keywords property.  But I also have 

    $ ls trunk/kernel/2.6/drivers/net/can/sja1000
    Makefile  isa.c  proc.c  sja1000.c  sja1000.h  trajet-gw2.c  version.h
    $ svn proplist -v trunk/kernel/2.6/drivers/net/can/sja1000/*
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/Makefile':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/isa.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/proc.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/sja1000.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/sja1000.h':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/trajet-gw2.c':
      svn:keywords : Id
    Properties on 'trunk/kernel/2.6/drivers/net/can/sja1000/version.h':
      svn:keywords : Id
    $ svn proplist -v trunk/kernel/2.6/drivers/net/can/sja1000  
    $

and these files are not considered modified.   I still don't see what
could be the reason for this. 


urs

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

Re: svn marks files as modified after creating a branch

Posted by Duncan Murdoch <mu...@stats.uwo.ca>.
On 6/23/2006 11:01 AM, Urs Thuermann wrote:
> Another surprising behavior of SVN.  After I have created a branch in
> my working copy, svn stat shows files as modified even though they are
> not:
> 
>     $ svn co http://svn.berlios.de/svnroot/repos/socketcan 
>     A    socketcan/trunk
>     A    socketcan/trunk/can-utils
>     A    socketcan/trunk/can-utils/terminal.h
>     ...
>     A    socketcan/trunk/etc/llcf
>     A    socketcan/branches
>     A    socketcan/tags
>     Checked out revision 40.
>     $ cd socketcan/
>     $ svn mkdir branches/ut
>     A         branches/ut
>     $ svn cp trunk branches/ut/hlist
>     A         branches/ut/hlist
>     $ svn stat
>     A      branches/ut
>     A  +   branches/ut/hlist
>     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.c
>     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mscan.h
>     M  +   branches/ut/hlist/kernel/2.6/drivers/net/can/mscan/mpc52xx_can.c
> 
> What is happening here?  What do the three M lines mean?  I haven't
> modified these files.  BTW, the repository is public, so you could try
> to reproduce this.

Just a guess, but the mscan.c file has svn:keywords assigned, and 
contains a $Id:$ keyword; that was probably modified when you made the copy.

Duncan Murdoch

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