You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matthias Gerstner <Ma...@ncp-e.com> on 2012/10/30 17:21:39 UTC

svn log output in directory-trees that contain moved sub-trees

Hello,

I have some trouble wit the logic of the 'svn log' command.

When reorganizing the directory structure in a repository by using 'svn
move' I don't get the desired output from 'svn log' in all
circumstances.

I think this is best demonstrated by this sample script:

---------------------------------------------------
svnadmin create /tmp/repo
svn co file:///tmp/repo /tmp/wc
cd /tmp/wc

svn mkdir --parents ./old/place
echo "some content" >old/place/foobar
svn add ./old/place/foobar
svn ci . -m "initial commit"

svn mkdir --parents ./new/place
svn ci . -m "new structure"

svn move old/place new/place/old
svn ci . -m "migration"

# update directory revisions
svn up

echo -e "\n here I see revision r1, containing 'foobar'\n"
svn log -v 

echo -e "\n here again I see revision r1\n"
svn log -v new/place/old

echo -e "\n here no revision r1 is present\n"
svn log -v new 
---------------------------------------------------

What I expected was to see all the history about what happened in the
"old/place" directory anywhere in the "new" sub-tree. But this is not
the case.

Can somebody explain to me why this is the case?

I produced this using subversion 1.6.17.

Best regards,

Matthias

--

Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
Entwicklung

NCP engineering GmbH
Dombühler Straße 2, D-90449, Nürnberg
Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg

E-Mail: Matthias.Gerstner@ncp-e.com
Internet: http://www.ncp-e.com

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Oct 31, 2012, at 04:27, Matthias Gerstner wrote:

> My use case is that I'm doing a big reorganization if small repositories
> into a large repository. To do this I use 'svnadmin dump/load' and move
> the resulting directories around in the new repository to achieve a new
> structure.

Another option which might yield better results would be to use svndumptool to perform the reorganization.

http://svn.borg.ch/svndumptool/



Re: svn log output in directory-trees that contain moved sub-trees

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Matthias Gerstner wrote on Mon, Nov 05, 2012 at 10:11:47 +0100:
> On Wed, Oct 31, 2012 at 06:35:23PM +0100, Daniel Shahaf wrote:
> > 
> > That's correct but besides the point.  The point was that 'svn log' in
> > the trunk/ directory should show ^/A ^/B ^/C if you did the move/copy as
> > I suggested, but won't if you do it as 'mkdir trunk; cp A trunk;
> > cp B trunk; cp C trunk'.
> 
> Okay now I understand. This approach would work if my situation was as
> simple as this example. However, I need to create a number of top-level
> directories that weren't there before. Thus I think I can't restrict
> myself to use 'svn cp' alone.

Just run it once per new top-level dir.  (you could do this in one or
several revisions)

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Matthias Gerstner <Ma...@ncp-e.com>.
On Wed, Oct 31, 2012 at 06:35:23PM +0100, Daniel Shahaf wrote:
> 
> That's correct but besides the point.  The point was that 'svn log' in
> the trunk/ directory should show ^/A ^/B ^/C if you did the move/copy as
> I suggested, but won't if you do it as 'mkdir trunk; cp A trunk;
> cp B trunk; cp C trunk'.

Okay now I understand. This approach would work if my situation was as
simple as this example. However, I need to create a number of top-level
directories that weren't there before. Thus I think I can't restrict
myself to use 'svn cp' alone.

-- 
Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
Entwicklung

NCP engineering GmbH
Dombühler Straße 2, D-90449, Nürnberg
Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg

E-Mail: Matthias.Gerstner@ncp-e.com
Internet: http://www.ncp-e.com

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Matthias Gerstner wrote on Wed, Oct 31, 2012 at 18:25:44 +0100:
> > Did you accomplish that as three individual moves?  Try accomplishing
> > it as 'svn cp ^/ ^/trunk' instead.
> 
> That didn't change anything. As I see it 'svn move' uses 'svn copy'
> anyway to achieve its results.
> 

That's correct but besides the point.  The point was that 'svn log' in
the trunk/ directory should show ^/A ^/B ^/C if you did the move/copy as
I suggested, but won't if you do it as 'mkdir trunk; cp A trunk;
cp B trunk; cp C trunk'.

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Matthias Gerstner <Ma...@ncp-e.com>.
> Did you accomplish that as three individual moves?  Try accomplishing
> it as 'svn cp ^/ ^/trunk' instead.

That didn't change anything. As I see it 'svn move' uses 'svn copy'
anyway to achieve its results.

Maybe I chose a too simple example. Actually I have say 50 repositories
each having their conventional trunk/tags/branches structure. I want to
merge those repositories into a new, central one. I do this by loading
the individual repository dumps in the target repository at some
temporary location. Then I do a series of moves to organize the
individual trunk/tags/branches into a new structure.

So initially I have some repos like this:

repoA/trunk/...
repoA/branches/<branches>
repoA/tags/<tags>

repoB/trunk/...
repoB/branches/<branches>
repoB/tags/<tags>

In a first step I load them into a pristine repository:

newRepo/tmp/repoA/{trunk,tags,branches}
newRepo/tmp/repoB/{trunk,tags,branches}

In a later step I reorganize the paths to become:

newRepo/trunk/some/place/repoAtrunk
newRepo/trunk/some/place/repoBtrunk
newRepo/branches/<some_branch>/some/place/repoAbranch
newRepo/branches/<some_branch>/some/place/repoBbranch
newRepo/tags/<some_tag>/some/place/repoAtag
newRepo/tags/<some_tag>/some/place/repoBtag

I'm doing this using a script as the operations are many and rather
complex. The individual repositories share some tags and branches that
are equally named. I'm merging those branches and tags in the new target
repository.

All of this works pretty well for me with the exception of the history
behaviour. The history is all there but as I said before when in
'newRepo/trunk' I don't see any of the old history of repoA or repoB.
I can see the history only at the root of newRepo, because this is where
repoA and repoB have been initially loaded to (under newRepo/tmp). And,
of course, within newRepot/trunk/somple/place/repoAtrunk and so on the
history is also visible.

Due to the complexity of the restructuring I don't want to start
fiddling with the content of the dump files to fixup paths. Also, this
approach has the beauty that all the copy-on-write semantics stay valid
and no unnecessary duplication of data occurs during the migration
process.

Even when I'm finished with the migration to the new repository
structure there will come up a number of 'svn move' operations in
the future, because the current structure is pretty unsatisfactory for
me.  And then, again, I'd have trouble getting a complete history log in
all repository locations.

Greetings,

Matthias

-- 
Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
Entwicklung

NCP engineering GmbH
Dombühler Straße 2, D-90449, Nürnberg
Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg

Telefon: +49 911 9968-153, Fax: +49 911 9968-229
E-Mail: Matthias.Gerstner@ncp-e.com
Internet: http://www.ncp-e.com

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Matthias Gerstner wrote on Wed, Oct 31, 2012 at 10:27:17 +0100:
> > "new" was created in r2 so running 'log' on it will not show earlier
> > revisions.  (Well, unless you pass -g)  'log' just walks the history of
> > a node; it won't show revisions in which that node did not exist. 
> > 
> > But the reference to r1 is not lost; is it present in line 4 of the
> > output:
> 
> Thanks for the reply.
> 
> Yes I have the reference to the move operation. But getting the actual
> history of "/old/place" requires me to move into "/new/place/old" and
> run 'svn log' there.
> 
> My use case is that I'm doing a big reorganization if small repositories
> into a large repository. To do this I use 'svnadmin dump/load' and move
> the resulting directories around in the new repository to achieve a new
> structure. Basically I have something like this:
> 
> /A
> /B
> /C
> 
> becomes
> 
> /trunk/A
> /trunk/B
> /trunk/C
> 

Did you accomplish that as three individual moves?  Try accomplishing it
as 'svn cp ^/ ^/trunk' instead.

> Directory structures A, B and C each have their individual history. Now
> when I am located at /trunk I want to be able to easily inspect the
> history of all three A, B and C. This is not possible given the
> behaviour of 'svn log' in this respect.



Re: svn log output in directory-trees that contain moved sub-trees

Posted by Matthias Gerstner <Ma...@ncp-e.com>.
> "new" was created in r2 so running 'log' on it will not show earlier
> revisions.  (Well, unless you pass -g)  'log' just walks the history of
> a node; it won't show revisions in which that node did not exist. 
> 
> But the reference to r1 is not lost; is it present in line 4 of the
> output:

Thanks for the reply.

Yes I have the reference to the move operation. But getting the actual
history of "/old/place" requires me to move into "/new/place/old" and
run 'svn log' there.

My use case is that I'm doing a big reorganization if small repositories
into a large repository. To do this I use 'svnadmin dump/load' and move
the resulting directories around in the new repository to achieve a new
structure. Basically I have something like this:

/A
/B
/C

becomes

/trunk/A
/trunk/B
/trunk/C

Directory structures A, B and C each have their individual history. Now
when I am located at /trunk I want to be able to easily inspect the
history of all three A, B and C. This is not possible given the
behaviour of 'svn log' in this respect.

Matthias

-- 
Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
Entwicklung

NCP engineering GmbH
Dombühler Straße 2, D-90449, Nürnberg
Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg

E-Mail: Matthias.Gerstner@ncp-e.com
Internet: http://www.ncp-e.com

Re: svn log output in directory-trees that contain moved sub-trees

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Matthias Gerstner wrote on Tue, Oct 30, 2012 at 17:21:39 +0100:
> echo -e "\n here no revision r1 is present\n"
> svn log -v new 

"new" was created in r2 so running 'log' on it will not show earlier
revisions.  (Well, unless you pass -g)  'log' just walks the history of
a node; it won't show revisions in which that node did not exist. 

But the reference to r1 is not lost; is it present in line 4 of the
output:

[[[
------------------------------------------------------------------------
r3 | danielsh | 2012-10-31 04:41:25 +0000 (Wed, 31 Oct 2012) | 1 line
Changed paths:
   A /new/place/old (from /old/place:1)
   D /old/place
...
]]]

HTH

Daniel


> ---------------------------------------------------
> 
> What I expected was to see all the history about what happened in the
> "old/place" directory anywhere in the "new" sub-tree. But this is not
> the case.
> 
> Can somebody explain to me why this is the case?
> 
> I produced this using subversion 1.6.17.
> 
> Best regards,
> 
> Matthias
> 
> --
> 
> Matthias Gerstner, Dipl.-Wirtsch.-Inf. (FH)
> Entwicklung
> 
> NCP engineering GmbH
> Dombühler Straße 2, D-90449, Nürnberg
> Geschäftsführer Peter Söll, HRB-Nr: 77 86 Nürnberg
> 
> E-Mail: Matthias.Gerstner@ncp-e.com
> Internet: http://www.ncp-e.com