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

RFC: Improvements to 'svn mergeinfo' subcommand for 1.7

From: Paul Burba <ptburba_at_gmail.com>
Date: Fri, 14 Aug 2009 10:54:24 -0400

Currently the svn mergeinfo command works well if you do
--depth=infinity merges only to the root of a branch and don't merge
into shallow WCs. It becomes less useful when one starts doing
subtree merges, shallow merges, or merges to shallow targets. This is
because svn mergeinfo only considers the mergeinfo of the target,
ignoring any subtrees with mergeinfo under the target. It also
ignores non-inheritable mergeinfo on the target (it considers these
ranges the same as inheritable). This is in contrast to the merge
subcommand, which obviously takes all of these factors into
consideration.

All of this means that 'svn merge' and 'svn mergeinfo' can easily
"disagree". For example, svn mergeinfo --show-revs eligible
%trunk_url% branch_wc can easily show no output, but a merge of
%trunk_url% to branch_wc might be operative.

I'd like to make two changes to the svn mergeinfo command for 1.7 to
address these drawbacks:

1) Account for Non-Inheritable Revision Ranges
----------------------------------------------

Currently svn mergeinfo treats inheritable and non-inheritable
revisions identically.

For example, say we merge r6 (at depth=infinity) from 'A' to a branch of 'A_at_1':

  trunk.dev>svn merge ^^/A A_COPY -c6
  --- Merging r6 into 'A_COPY':
  U A_COPY\D\H\omega

Inheritable mergeinfo for r6 is set as expected:

  trunk.dev>svn pl -vR
  Properties on 'A_COPY':
    svn:mergeinfo
      /A:6

And r6 no longer shows as eligible for merging:

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY
  r3
  r4
  r5

That's good, but what happens if we do a shallow merge?

  trunk.dev>svn revert -R .
  Reverted 'A_COPY'
  Reverted 'A_COPY\D\H\omega'

  trunk.dev>svn merge ^^/A A_COPY -c6 --depth empty

  trunk.dev>svn pl -vR
  Properties on 'A_COPY':
    svn:mergeinfo
      /A:6*

Clearly r6's changes to A_COPY/D/H/psi are *not* merged, but svn
mergeinfo thinks so:

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY
  r3
  r4
  r5

  trunk.dev>

To fix this I propose we alter the default output of svn mergeinfo to
append the non-inheritable marker '*' to any revisions which are only
merged as far as the target, but not into the target's subtrees
(thanks to Nico Schellingerhout for this suggestion). So the previous
example would now show that r6 is only partially merged to A_COPY:

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY
  r3
  r4
  r5
  r6*

  trunk.dev>

Likewise, when asking svn mergeinfo what has been merged,
non-inheritable ranges would be flagged in a similar manner,
indicating that the range has not been merged at depth infinity.

  trunk.dev>svn mergeinfo --show-revs merged ^^/A A_COPY
  r6*

  trunk.dev>

2) Optionally Consider Subtrees with Explicit Mergeinfo
-------------------------------------------------------

Currently svn mergeinfo doesn't consider subtrees with explicit
mergeinfo at all when determining what has been merged or what is
available to merge.

Again, starting with a fresh branch of 'A', we merge a couple
revisions to the root of the branch, then reverse merge one of those
revisions from a subtree:

  trunk.dev>svn merge ^^/A A_COPY -r4:6
  --- Merging r5 through r6 into 'A_COPY':
  U A_COPY\B\E\beta
  U A_COPY\D\H\omega

  trunk.dev>svn merge ^^/A/D/H A_COPY\D\H -c-6
  --- Reverse-merging r6 into 'A_COPY\D\H':
  G A_COPY\D\H\omega

  trunk.dev>svn pl -vR
  Properties on 'A_COPY':
    svn:mergeinfo
      /A:5-6
  Properties on 'A_COPY\D\H':
    svn:mergeinfo
      /A/D/H:5

So while r6 has clearly not been merged fully into the tree rooted at
A_COPY, svn mergeinfo again thinks it has:

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY
  r3
  r4

  trunk.dev>

  trunk.dev>svn mergeinfo --show-revs merged ^^/A A_COPY
  r5
  r6

I'd like to add the --depth option to svn mergeinfo so these differing
subtrees are considered. As above, revisions that are only partially
merged to the target would be marked with a '*':

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY --depth infinity
  r3
  r4
  r6*

  trunk.dev>

If a revision is not merged to some subtree per the set of mergeinfo
on/under the target, but that revision is ultimately inoperative on
that subtree, then that revision would be considered merged. For
example, say r6 in the previous example was a text change *only* to
'A/mu' and again we have this mergeinfo on the target:

  trunk.dev>svn pl -vR
  Properties on 'A_COPY':
    svn:mergeinfo
      /A:5-6
  Properties on 'A_COPY\D\H':
    svn:mergeinfo
      /A/D/H:5

In this case svn mergeinfo would ignore the fact that r6 "appears" to
be eligible for the subtree rooted at 'A_COPY/D/H':

  trunk.dev>svn mergeinfo --show-revs eligible ^^/A A_COPY --depth infinity
  r3
  r4

Any thoughts, questions, or objections?

Paul

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2383639
Received on 2009-08-14 16:54:42 CEST

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

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