1

If you've done a merge you may find, before committing the changes, that actually you don't want to accept any of the changes merged into one of the affected files. So you do e.g.:

$ svn revert foo.c

However this also seems to revert the mergeinfo related to this file. So when you do a subsequent merge it will merge in exactly the same changes again.

Rather than revert one could do:

$ svn cat foo.c > foo.c

But this doesn't seem like the right way to do things? Is there something that more clearly indicates what I'm trying to achieve, i.e. to say "consider the merge done for this file but don't change its contents"?

George Hawkins
  • 37,044
  • 7
  • 30
  • 43
  • I may be wrong about this but I think the only case where reverting a file also reverts its *mergeinfo* is when the *mergeinfo* property is set on the file itself. If you consistently do merges on the root directory of the branch the files themselves will have no *mergeinfo* property. – Alex Jasmin Apr 16 '10 at 15:53
  • I take care to only merge directories rather than files (it is not always possible to merge the root), and I have this problem, too. Subversion 1.5 and/or 1.6 (I don't know exactly when the server was updated to 1.6) added lots of `mergeinfo` attributes automatically, both for files and directories (including things like `var` and `log`, where everything is `svn:ignore`d and no significant change is committed ever ...). Pity is, you have to check every single file in order to know how `svn revert` would work. Thus, `svn cat` might be the best solution ... – Tobias Aug 06 '12 at 10:31

1 Answers1

1

To block a revision from getting merged, run the merge command with the --record-only param.

Stefan
  • 43,293
  • 10
  • 75
  • 117
  • In my situation I'm usually merging a large tree of files. I want to do a _real_ merge and to accept most of the merged changes. I'm just talking about the situation where on reviewing the merge I decide that, out of many files with changes merged into them, there are one or two files where I don't want to accept the changes, but still want the merge to be considered done for these files as well as all the others once I've completed the commit. I could revert the changes for these one or two files and then do merge with --record-only for these specific files but this seems long winded? – George Hawkins Apr 16 '10 at 13:26
  • Then don't use the revert command but undo the changes in a visual diff tool. – Stefan Apr 17 '10 at 08:05
  • For those having a virtual Linux box, where the commandline client is used, and the visual tool being TortoiseSVN via a samba drive, this sounds quite unconvenient; the `svn cat` solution is better because it can be scripted. – Tobias Aug 06 '12 at 10:37