[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn marks files as modified after creating a branch

From: Urs Thuermann <urs_at_isnogud.escape.de>
Date: 2006-06-26 09:37:42 CEST

Duncan Murdoch <murdoch@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
Received on Mon Jun 26 09:41:38 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.