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

[merge-tracking]: Problems when merge target is out of date

From: Paul Burba <pburba_at_collab.net>
Date: 2007-05-25 00:11:07 CEST

Hi All,

Came across this problem today: It's easy to end up with incorrect
mergeinfo when merging into a target that is not up to date with the
repository.

Consider this example:

# Starting with the standard greek tree do the following:
# r2 copy 'A' to 'A_COPY'
# r3 text mod to 'A_COPY/D/H/psi'
# r4 text mod to 'A_COPY/D/H/omega'

# Checkout two working copies 'WC' and 'WC2'
>svn co %URL% WC
A WC\A
A WC\A\B
A WC\A\B\lambda
A WC\A\B\E
A WC\A\B\E\alpha
A WC\A\B\E\beta
A WC\A\B\F
A WC\A\mu
A WC\A\C
A WC\A\D
A WC\A\D\gamma
A WC\A\D\G
A WC\A\D\G\pi
A WC\A\D\G\rho
A WC\A\D\G\tau
A WC\A\D\H
A WC\A\D\H\chi
A WC\A\D\H\omega
A WC\A\D\H\psi
A WC\A_COPY
A WC\A_COPY\B
A WC\A_COPY\B\lambda
A WC\A_COPY\B\E
A WC\A_COPY\B\E\alpha
A WC\A_COPY\B\E\beta
A WC\A_COPY\B\F
A WC\A_COPY\mu
A WC\A_COPY\C
A WC\A_COPY\D
A WC\A_COPY\D\gamma
A WC\A_COPY\D\G
A WC\A_COPY\D\G\pi
A WC\A_COPY\D\G\rho
A WC\A_COPY\D\G\tau
A WC\A_COPY\D\H
A WC\A_COPY\D\H\chi
A WC\A_COPY\D\H\omega
A WC\A_COPY\D\H\psi
A WC\iota
Checked out revision 4.

>svn co %URL% WC2
A WC2\A
A WC2\A\B
A WC2\A\B\lambda
A WC2\A\B\E
A WC2\A\B\E\alpha
A WC2\A\B\E\beta
A WC2\A\B\F
A WC2\A\mu
A WC2\A\C
A WC2\A\D
A WC2\A\D\gamma
A WC2\A\D\G
A WC2\A\D\G\pi
A WC2\A\D\G\rho
A WC2\A\D\G\tau
A WC2\A\D\H
A WC2\A\D\H\chi
A WC2\A\D\H\omega
A WC2\A\D\H\psi
A WC2\A_COPY
A WC2\A_COPY\B
A WC2\A_COPY\B\lambda
A WC2\A_COPY\B\E
A WC2\A_COPY\B\E\alpha
A WC2\A_COPY\B\E\beta
A WC2\A_COPY\B\F
A WC2\A_COPY\mu
A WC2\A_COPY\C
A WC2\A_COPY\D
A WC2\A_COPY\D\gamma
A WC2\A_COPY\D\G
A WC2\A_COPY\D\G\pi
A WC2\A_COPY\D\G\rho
A WC2\A_COPY\D\G\tau
A WC2\A_COPY\D\H
A WC2\A_COPY\D\H\chi
A WC2\A_COPY\D\H\omega
A WC2\A_COPY\D\H\psi
A WC2\iota
Checked out revision 4.

# Merge r3 into 'A/D' in the first working copy
# and commit it as r5
>svn merge %URL%/A_COPY/D WC/A/D -c3
U WC\A\D\H\psi

>svn ci -m "" WC
Sending WC\A\D
Sending WC\A\D\H\psi
Transmitting file data .
Committed revision 5.

>svn pl -vR WC
Properties on 'WC\A\D':
  svn:mergeinfo : /A_COPY/D:3
Properties on 'WC\A_COPY':
  svn:mergeinfo : /A:1

# Merge r4 into the now out of date target 'A/D/H'
# in the second working copy.
>svn merge %URL%/A_COPY/D/H WC2/A/D/H -c4
U WC2\A\D\H\omega

>svn pl -vR wc2
Properties on 'WC2\A\D\H':
  svn:mergeinfo : /A_COPY/D/H:4
Properties on 'WC2\A_COPY':
  svn:mergeinfo : /A:1

# Try to commit WC2 and we get the
# expected out of date failure...
>svn ci -m "" wc2
Sending WC2\A\D\H
svn: Commit failed (details follow):
svn: Out of date: '/A/D/H' in transaction '5-1'

# ...so we update...
>svn up wc2
U WC2\A\D\H\psi
 U WC2\A\D
Updated to revision 5.

# ...and commit...
>svn ci -m "" wc2
Sending WC2\A\D\H
Sending WC2\A\D\H\omega
Transmitting file data .
Committed revision 6.

# ...but our mergeinfo gets broken.
# 'A/D/H' is missing r3, which was applied
# to 'A/D/H/psi' in the update.
>svn pl -vR WC2
Properties on 'WC2\A\D':
  svn:mergeinfo : /A_COPY/D:3
Properties on 'WC2\A\D\H':
  svn:mergeinfo : /A_COPY/D/H:4
Properties on 'WC2\A_COPY':
  svn:mergeinfo : /A:1

Similar problems occur regardless of where we merge r3 -- 'WC2/A' and
'WC2/A/D' also have problems (i.e. this is not an elision issue).

As much as I'd like to tell people not to merge into an out of date
target :-P it looks like we need to teach update to do something like
the following:

1) Keep track of all paths with local mergeinfo modifications/additions
prior to the update - Store the complete local mergeinfo for each such
path in set X.

2) Keep track of all paths with mergeinfo modifications/additions
resulting from the update - store only the mergeinfo difference in set
Y.

3) For every path P in X: Find P's closest ancestor path Q in Y (if
any), merge Q's mergeinfo with P's, and make this the new mergeinfo on
P.

4) For every path P in X: Find P's closest descendant path R in Y (if
any), merge P's mergeinfo with R's, and make this the new mergeinfo on
R.

5) Finally elide mergeinfo as normal.

Or something like that anyway...I haven't quite worked it all out yet.

In the meantime I'll file an issue, but was wondering if anyone had
already thought about this or had any other words of wisdom.

Paul B.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 25 00:11:32 2007

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