Hello,
I'm trying to write a script to detect when the following situation
has occurred.
1) /trunk/foo.c added to repository
2) /branches/my-branch copied from /trunk
3) /branches/my-branch/foo.c renamed to /branches/my-branch/bar.c
4) /trunk/foo.c modified
I want to detect this to help keep us aware of when we will run into
issues during merges due to rename actually being add (copy from) and
delete. The script needs to do the following:
1) Detect renamed files
2) Get renamed file's history back to revision when branch was created
3) Extract the source of the branch (i.e. the branch it was branched from)
4) Walk forward through the history of file on the source branch to
see if it was modified after the branch with the rename was created
This script would need to be smart enough to deal with cases where a
branch was created from a tag, and follow that tag back to its source
branch. It would also have to follow the history back even if
multiple renames took place.
My main question at this point is how to deal with #4 above. If I run
a log on the latest revision it returns log entries for all of its
ancestors. I would like to start with an earlier revision (the
revision before the branch was created) and see all changes that
happened on the source branch (the one the second branch was copied
from; trunk in the above example) going forward.
I'll walk through an example here.
C:\work\wc2>svn log -v
------------------------------------------------------------------------
r7 | user | 2007-05-03 09:18:47 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /branches/my-branch/bah.c (from /branches/my-branch/bar.c:6)
D /branches/my-branch/bar.c
rename bar.c to bah.c
------------------------------------------------------------------------
r6 | user | 2007-05-03 08:52:55 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /branches/my-branch/bar.c (from /branches/my-branch/foo.c:3)
D /branches/my-branch/foo.c
Rename foo.c to bar.c
------------------------------------------------------------------------
r3 | user | 2007-05-03 08:52:23 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /branches/my-branch (from /trunk:2)
Creating branches
------------------------------------------------------------------------
r2 | user | 2007-05-03 08:52:20 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /trunk/foo.c
Add foo.c
------------------------------------------------------------------------
r1 | user | 2007-05-03 08:52:13 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /branches
A /tags
A /trunk
Create initial directories
------------------------------------------------------------------------
C:\work\wc2>
So if I detect that bah.c was renamed, I can run a log on bah.c and
get its history all the way back to when my-branch was created from
trunk in revision 3 and see that it was copied from trunk revision 2.
Now in a working copy of trunk I can see foo.c's history.
C:\work\wc1>svn log -v foo.c
------------------------------------------------------------------------
r5 | user | 2007-05-03 08:52:50 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
M /trunk/foo.c
Add Spanish line to foo.c
------------------------------------------------------------------------
r2 | user | 2007-05-03 08:52:20 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
A /trunk/foo.c
Add foo.c
------------------------------------------------------------------------
C:\work\wc1>
However, I want to start with /trunk/foo.c@2 (the path to the file
with the name it had in trunk when /branches/my-branch was created)
and trace it forward in time, following any renames that might have
occurred there as well.
I want to tell Subversion to show me the log for the path
/trunk/foo.c@2 but show me this log in the latest revision using
whatever path it has in that revision, so that I get the latest
revision and all ancestors.
Since I happen to already know that revision 5 is the latest revision
for foo.c on trunk, I can run:
C:\work\wc2>svn log -r 5 -v file:///C:/work/testrepo/trunk/foo.c_at_2
------------------------------------------------------------------------
r5 | jjohn53 | 2007-05-03 08:52:50 -0500 (Thu, 03 May 2007) | 1 line
Changed paths:
M /trunk/foo.c
Add Spanish line to foo.c
------------------------------------------------------------------------
But this doesn't give me its history all the way back to its
beginning. And in the real world I don't know that 5 happens to be
the latest revision touching it.
How do I accomplish this?
Thanks,
Justin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu May 3 19:15:14 2007