You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Paul Burba <pb...@collab.net> on 2007/07/06 21:13:22 UTC

svn:mergeinfo and revert

Today in IRC the question came up of how the revert of a portion of a
merge should effect mergeinfo.

Currently on trunk, if you merge -rX:Y URL PATH, then you revert a child
of PATH, but not PATH itself, the mergeinfo set on PATH by the intial
merge stays the same.  For example, given:

A vanilla greek tree
r2: 'A' copied to 'A_COPY'
r3: text changes to  'A/D/H/psi'
r4: text change to 'A/D/G/rho'

>svn pl -vR
Properties on 'A_COPY':
  svn:mergeinfo : /A:1

>svn merge -r2:4 %URL%/A A_COPY
--- Merging r3 through r4:
U    A_COPY\D\G\rho
U    A_COPY\D\H\psi

>svn pl -vR
Properties on 'A_COPY':
  svn:mergeinfo : /A:1,3-4

# Revert one part of the merge
>svn revert A_COPY\D\H\psi
Reverted 'A_COPY\D\H\psi'

# Revert the rest of it
>svn revert A_COPY\D\G\rho
Reverted 'A_COPY\D\G\rho'

# The only local mod now
# is the mergeinfo itself!
>svn st
 M     A_COPY

>svn pl -vR
Properties on 'A_COPY':
  svn:mergeinfo : /A:1,3-4

This is a contrived example yes, but it shows the potential problem.
Now if you want to revert part of a merge you can reverse merge those
portions away, rather than reverting them.  Say you didn't want the
change to psi, reverse merge it and it get's overriding mergeinfo:

>svn merge -r2:4 %URL%/A A_COPY
--- Merging r3 through r4:
U    A_COPY\D\G\rho
U    A_COPY\D\H\psi

>svn merge -r4:2 %URL%/A/D/H/psi A_COPY/D/H/psi
--- Merging r4 through r3:
G    A_COPY\D\H\psi

>svn pl -vR
Properties on 'A_COPY':
  svn:mergeinfo : /A:1,3-4
Properties on 'A_COPY\D\H\psi':
  svn:mergeinfo : /A/D/H/psi:1

So, FWIW, there is a work-around.

Should revert update the mergeinfo on the reverted path to reflect the
fact that no changes were merged into it?

>svn merge -r2:4 %URL%/A A_COPY
--- Merging r3 through r4:
U    A_COPY\D\G\rho
U    A_COPY\D\H\psi

>svn revert A_COPY\D\H\psi
Reverted 'A_COPY\D\H\psi'

>svn pl -vR
Properties on 'A_COPY':
  svn:mergeinfo : /A:1,3-4
Properties on 'A_COPY\D\H\psi':
  svn:mergeinfo : /A/D/H/psi:1

>svn st
 M     A_COPY
M      A_COPY\D\G\rho
 M     A_COPY\D\H\psi

The thing I really don't like about this is that revert actually leaves
the reverted path with a local change (the overriding mergeinfo), bleh!
Plus, would a second revert "really" revert all local changes, including
the overriding mergeinfo.  As I write this I think this solution is
bogus.  But if we want revert to be "merge sensitive" what else could we
do?

~~~~~ 

One thing I'd really like to know is how often do people revert a
portion of a merge?  Is this a common use case?  If this is something
you do, what is your expectation re mergeinfo?  Are there cases where
you *wouldn't* want the mergeinfo on the reverted path to be overridden?

Any thoughts on this appreciated.

Thanks,

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: svn:mergeinfo and revert

Posted by Ben Collins-Sussman <su...@red-bean.com>.
Hm, I guess this awkwardness is the price we pay for tracking
mergeinfo in metadata that's normally the domain of user-editable
stuff, rather than tracking mergeinfo in (say) some private
client-side database.

My feeling is that 'svn revert' should take some sort of
--merge-sensitive switch or something, which would actually create a
prop-mod to override the inherited mergeinfo.  As long as the user
passes that swtich, then revert will do the right thing.  If the user
leaves the switch off, then *any* local mods will be destroyed,
including temporary prop-mods created by a previous revert.

We just need to doc this use-case very carefully in our
branching/merging chapter of the svnbook.  :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org