You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Henrik Carlqvist <hc...@poolhem.se> on 2014/02/26 20:41:38 UTC

Merge information lost with newer versions of subversion

Since a few years (I think it was with release 1.6.17 of subversion) the
merge information shown from "svn log -g" has been changed. The new way to
show merge logs means some improvements like less redundant information
and better performance. Unfortunately, when using these newer versions of
svn to gather information about merges I have found that some merge
information is lost. For that reason I have stuck to version 1.6.16 for
these purposes.

Now I have finally been able to create a small case where merge
information is lost. In the example below I type the created revision in
the left margin to make the commands and revisions easier to discuss:

-8<-----------------------------------------
   svnadmin create /tmp/repo_test
   mkdir svn_work
 1 svn import -m "" svn_work file:///tmp/repo_test/trunk
 2 svn import -m "" svn_work file:///tmp/repo_test/branches
   rmdir svn_work
   svn checkout file:///tmp/repo_test/trunk svn_work
   echo hello > svn_work/hello.txt
   svn add svn_work/hello.txt
 3 svn commit -m "" svn_work/
 4 svn copy -m "" file:///tmp/repo_test/trunk
file:///tmp/repo_test/branches/1
   echo hello world > svn_work/hello.txt
 5 svn commit -m "" svn_work/
 6 svn copy -m "" file:///tmp/repo_test/trunk
file:///tmp/repo_test/branches/2
   svn switch file:///tmp/repo_test/branches/2 svn_work
   echo hello > svn_work/hello2.txt
   svn add svn_work/hello2.txt
 7 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/branches/1 svn_work
   svn merge file:///tmp/repo_test/trunk svn_work
 8 svn commit -m "" svn_work/
   echo hello > svn_work/hello3.txt
   svn add svn_work/hello3.txt
 9 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/trunk svn_work/
   svn merge --reintegrate file:///tmp/repo_test/branches/1 svn_work
10 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/branches/2 svn_work
   svn merge file:///tmp/repo_test/trunk svn_work
11 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/trunk svn_work/
   svn merge --reintegrate file:///tmp/repo_test/branches/2 svn_work
12 svn commit -m "" svn_work/
svn log -q -g file:///tmp/repo_test/trunk
-8<-----------------------------------------

Svn version 1.6.16 might give a little redundant information and is
slower, but it gives one important log entry:

...
------------------------------------------------------------------------
r9 | henca | 2014-02-25 11:21:05 +0100 (Tue, 25 Feb 2014)
Merged via: r10
------------------------------------------------------------------------
...

The above log entry from svn 1.6.16 shows that branches/1 with latest
revision 9 was merged back into trunk on revision 10.

When using any newer version, up to and including the current 1.8.8 the
information about the merge of branches/1 into trunk on revision 10 is
lost:

------------------------------------------------------------------------
r12 | henca | 2014-02-25 13:06:18 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r11 | henca | 2014-02-25 13:06:17 +0100 (Tue, 25 Feb 2014)
Merged via: r12
------------------------------------------------------------------------
r9 | henca | 2014-02-25 13:06:15 +0100 (Tue, 25 Feb 2014)
Merged via: r12, r11
------------------------------------------------------------------------
r8 | henca | 2014-02-25 13:06:14 +0100 (Tue, 25 Feb 2014)
Merged via: r12, r11
------------------------------------------------------------------------
r4 | henca | 2014-02-25 13:06:12 +0100 (Tue, 25 Feb 2014)
Merged via: r12, r11
------------------------------------------------------------------------
r7 | henca | 2014-02-25 13:06:13 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r6 | henca | 2014-02-25 13:06:13 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r10 | henca | 2014-02-25 13:06:16 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r5 | henca | 2014-02-25 13:06:12 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r3 | henca | 2014-02-25 13:06:12 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------
r1 | henca | 2014-02-25 13:06:11 +0100 (Tue, 25 Feb 2014)
------------------------------------------------------------------------

This log is only affected by the version of svn used for the command "svn
log", an older version of svn will still show the correct log of a
repository created by a newer version of svn.

If anyone want to play with my example I also have the commands without
any revision number in the left margin:

-8<-----------------------------------------
svnadmin create /tmp/repo_test
mkdir svn_work
svn import -m "" svn_work file:///tmp/repo_test/trunk
svn import -m "" svn_work file:///tmp/repo_test/branches
rmdir svn_work
svn checkout file:///tmp/repo_test/trunk svn_work
echo hello > svn_work/hello.txt
svn add svn_work/hello.txt
svn commit -m "" svn_work/
svn copy -m "" file:///tmp/repo_test/trunk
file:///tmp/repo_test/branches/1
echo hello world > svn_work/hello.txt
svn commit -m "" svn_work/
svn copy -m "" file:///tmp/repo_test/trunk
file:///tmp/repo_test/branches/2
svn switch file:///tmp/repo_test/branches/2 svn_work
echo hello > svn_work/hello2.txt
svn add svn_work/hello2.txt
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/branches/1 svn_work
svn merge file:///tmp/repo_test/trunk svn_work
svn commit -m "" svn_work/
echo hello > svn_work/hello3.txt
svn add svn_work/hello3.txt
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/trunk svn_work/
svn merge --reintegrate file:///tmp/repo_test/branches/1 svn_work
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/branches/2 svn_work
svn merge file:///tmp/repo_test/trunk svn_work
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/trunk svn_work/
svn merge --reintegrate file:///tmp/repo_test/branches/2 svn_work
svn commit -m "" svn_work/
-8<-----------------------------------------

regards Henrik

Re: Merge information lost with newer versions of subversion

Posted by Henrik Carlqvist <hc...@poolhem.se>.
Sorry about the line wraps, I try to fix them with some backslash:
-8<-----------------------------------------
   svnadmin create /tmp/repo_test
   mkdir svn_work
 1 svn import -m "" svn_work file:///tmp/repo_test/trunk
 2 svn import -m "" svn_work file:///tmp/repo_test/branches
   rmdir svn_work
   svn checkout file:///tmp/repo_test/trunk svn_work
   echo hello > svn_work/hello.txt
   svn add svn_work/hello.txt
 3 svn commit -m "" svn_work/
 4 svn copy -m "" file:///tmp/repo_test/trunk \
file:///tmp/repo_test/branches/1
   echo hello world > svn_work/hello.txt
 5 svn commit -m "" svn_work/
 6 svn copy -m "" file:///tmp/repo_test/trunk \
file:///tmp/repo_test/branches/2
   svn switch file:///tmp/repo_test/branches/2 svn_work
   echo hello > svn_work/hello2.txt
   svn add svn_work/hello2.txt
 7 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/branches/1 svn_work
   svn merge file:///tmp/repo_test/trunk svn_work
 8 svn commit -m "" svn_work/
   echo hello > svn_work/hello3.txt
   svn add svn_work/hello3.txt
 9 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/trunk svn_work/
   svn merge --reintegrate file:///tmp/repo_test/branches/1 svn_work
10 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/branches/2 svn_work
   svn merge file:///tmp/repo_test/trunk svn_work
11 svn commit -m "" svn_work/
   svn switch file:///tmp/repo_test/trunk svn_work/
   svn merge --reintegrate file:///tmp/repo_test/branches/2 svn_work
12 svn commit -m "" svn_work/
   svn log -q -g file:///tmp/repo_test/trunk
-8<-----------------------------------------

-8<-----------------------------------------
svnadmin create /tmp/repo_test
mkdir svn_work
svn import -m "" svn_work file:///tmp/repo_test/trunk
svn import -m "" svn_work file:///tmp/repo_test/branches
rmdir svn_work
svn checkout file:///tmp/repo_test/trunk svn_work
echo hello > svn_work/hello.txt
svn add svn_work/hello.txt
svn commit -m "" svn_work/
svn copy -m "" file:///tmp/repo_test/trunk \
file:///tmp/repo_test/branches/1
echo hello world > svn_work/hello.txt
svn commit -m "" svn_work/
svn copy -m "" file:///tmp/repo_test/trunk \
file:///tmp/repo_test/branches/2
svn switch file:///tmp/repo_test/branches/2 svn_work
echo hello > svn_work/hello2.txt
svn add svn_work/hello2.txt
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/branches/1 svn_work
svn merge file:///tmp/repo_test/trunk svn_work
svn commit -m "" svn_work/
echo hello > svn_work/hello3.txt
svn add svn_work/hello3.txt
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/trunk svn_work/
svn merge --reintegrate file:///tmp/repo_test/branches/1 svn_work
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/branches/2 svn_work
svn merge file:///tmp/repo_test/trunk svn_work
svn commit -m "" svn_work/
svn switch file:///tmp/repo_test/trunk svn_work/
svn merge --reintegrate file:///tmp/repo_test/branches/2 svn_work
svn commit -m "" svn_work/
svn log -q -g file:///tmp/repo_test/trunk
-8<-----------------------------------------

regards Henrik

Re: Merge information lost with newer versions of subversion

Posted by Henrik Carlqvist <hc...@poolhem.se>.
Thanks for the reply!

On Mon, 03 Mar 2014 21:58:09 +0000
Philip Martin <ph...@wandisco.com> wrote:
> I think the code attempts to classify which parts of the merge are
> direct and indirect but it ends up adding extra changes.  If you run the
> log in different directions then different results are obtained:
> 
>   $ svn log -qg -r0:head file:///tmp/repo_test/trunk
>   ...
>   ---------------------------------------------------------------------
>   --- r9 | pm | 2014-03-03 21:00:15 +0000 (Mon, 03 Mar 2014)
>   Merged via: r10
>   ---------------------------------------------------------------------
>   ---

Yes, I have also noted that it is possible to get that information by
doing:

svn log -qg file:///tmp/repo_test/trunk@10

or simply

svn log -qg -r 10 file:///tmp/repo_test/trunk

My guess however, is that going in the opposite direction helps in this
case where there are only two merges into trunk, but maybe other merges
would be hidden both ways if there were more merges into trunk? I still
don't get it when exactly merge information is lost.

> The change made on branches/1 in r9 is merged to trunk in r10:
...

Yes, in my example there are 4 merges total. One merge from trunk to each
branch and one merge back to trunk for each branch. I think that at least
one of the merges from trunk to branch and the order in which the merges
are done matter whether the "log -g" will miss a merge. I have also seen
other examples where merges to branches are lost from "log -g".

> There is also this:
> 
>   $ svn log -qg -c12 file:///tmp/repo_test/trunk
>   ...
>   ---------------------------------------------------------------------
>   --- r9 | pm | 2014-03-03 21:00:15 +0000 (Mon, 03 Mar 2014)
>   Merged via: r12, r11, r10
>   ---------------------------------------------------------------------
>   ---
> 
> which shows 3 revisions in the via list, i.e. both paths.

Yes, that one seems to behave the same between older versions of svn and
newer versions of svn. However, I would prefer to read entries like 

------------------------------------------------------------------------
r10 | henca | 2014-03-04 07:48:48 +0100 (Tue, 04 Mar 2014)
------------------------------------------------------------------------
r9 | henca | 2014-03-04 07:48:45 +0100 (Tue, 04 Mar 2014)
Merged via: r10
------------------------------------------------------------------------

...as they are rather easy to understand. 

I have written a tool svn2cvsgraph http://svn2cvsgraph.sourceforge.net/ 
which helps to visualize the revision graph of a svn repository.

With older versions of svn, it was possible to get all the merge
information I needed from a single (slow) call to 
"svn log -qg file:///tmp/repo_test", with newer versions I instead make
one such (quicker) call for every branch. That is also backwards
compatible with older versions of svn which is somewhat slower, but on the
other hand those logs do not miss any merge entries.

I could rewrite my tool to do one call for each revision, but that would
be slow, and it seems to me as if there is something broken with "svn log
-g" when some merge information is missing.

regards Henrik

Re: Merge information lost with newer versions of subversion

Posted by Philip Martin <ph...@wandisco.com>.
Henrik Carlqvist <hc...@poolhem.se> writes:

> On Wed, 26 Feb 2014 20:41:38 +0100
> Henrik Carlqvist <hc...@poolhem.se> wrote:
>> Now I have finally been able to create a small case where merge
>> information is lost.
>
> I didn't get much response here, do you think that I should file a bug
> report into the subversion issue tracker?

I don't really understand the "log -g" code, but the result looks odd to
me.  I think the code attempts to classify which parts of the merge are
direct and indirect but it ends up adding extra changes.  If you run the
log in different directions then different results are obtained:

  $ svn log -qg -r0:head file:///tmp/repo_test/trunk
  ...
  ------------------------------------------------------------------------
  r9 | pm | 2014-03-03 21:00:15 +0000 (Mon, 03 Mar 2014)
  Merged via: r10
  ------------------------------------------------------------------------

and

  $ svn log -qg -rhead:0 file:///tmp/repo_test/trunk
  ...
  ------------------------------------------------------------------------
  r9 | pm | 2014-03-03 21:00:15 +0000 (Mon, 03 Mar 2014)
  Merged via: r12, r11
  ------------------------------------------------------------------------


The change made on branches/1 in r9 is merged to trunk in r10:

  $ svn diff --properties-only -c10 file:///tmp/repo_test
  ...
  Property changes on: trunk
  ___________________________________________________________________
  Added: svn:mergeinfo
     Merged /branches/1:r4-9

The change is then merged from trunk to branches/2 in r11:

  $ svn diff --properties-only -c11 file:///tmp/repo_test
  ...
  Property changes on: branches/2
  ___________________________________________________________________
  Added: svn:mergeinfo
     Merged /trunk:r6-10
     Merged /branches/1:r4-9

There is a merge back from branches/2 to trunk in r12:

  $ svn diff --properties-only -c12 file:///tmp/repo_test
  ...
  Property changes on: trunk
  ___________________________________________________________________
  Modified: svn:mergeinfo
     Merged /branches/2:r6-11

The trunk mergeinfo change in r12, /branches/2:r6-11, refers to the
mergeinfo change in r11 and that includes /branches/1:r4-9.

There is also this:

  $ svn log -qg -c12 file:///tmp/repo_test/trunk
  ...
  ------------------------------------------------------------------------
  r9 | pm | 2014-03-03 21:00:15 +0000 (Mon, 03 Mar 2014)
  Merged via: r12, r11, r10
  ------------------------------------------------------------------------

which shows 3 revisions in the via list, i.e. both paths.

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*

Re: Merge information lost with newer versions of subversion

Posted by Henrik Carlqvist <hc...@poolhem.se>.
On Wed, 26 Feb 2014 20:41:38 +0100
Henrik Carlqvist <hc...@poolhem.se> wrote:
> Now I have finally been able to create a small case where merge
> information is lost.

I didn't get much response here, do you think that I should file a bug
report into the subversion issue tracker?

regards Henrik