Is it possible to emulate SVN (1.5) "merge --record-only" behavior?

Asked by Rolly

Hello!

SVN 1.5 has the ability to block changesets from automatic merging. This is useful, for example, when you need to maintain server-specific settings in different branches, or when you want to backport only the most stable changes from 'trunk' to 'stable'. Apparently, there are two ways to accomplish blocking in SVN 1.5:

Manual setting of the svn:mergeinfo property:
http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchmerge.advanced.blockchanges

... or use of "svn merge --record-only":
http://merge-tracking.open.collab.net/servlets/ProjectProcess?documentContainer=c2__Sample%20repository (operation #b in the diagram)
http://merge-tracking.open.collab.net/servlets/ProjectProcess?documentContainer=c2__Sample%20repository__Explanation%20of%20Repository%20Contents (Scroll down to "Revision 8")

This is a very attractive feature for me. Can merge blocking be accomplished in bzr? If not, would it be easy/difficult to accomplish via a hypothetical new plugin?

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
John A Meinel
Solved:
Last query:
Last reply:
Revision history for this message
Elliot Murphy (statik) said :
#1

This is something that I need also, for a customer I am working with. I *think* that it would be pretty simple to accomplish something similiar to --record-only by plugging in a simple merge algorithm, but I have not yet tried it. I've heard people describe this idea as "null merge", but I think that name is confusing and --record-only is a little bit clearer.

Revision history for this message
John A Meinel (jameinel) said :
#2

You can do:

  bzr merge ../other
  bzr revert .
  bzr commit -m "Fake merge of other to reject the changes"

The important part is the "." which tells "bzr revert" that you want to revert the changes to the files, but leave the "I merged this other branch" flag.

We currently don't support cherrypicking that sort of information, though.

Revision history for this message
Rolly (hachirota) said :
#3

Thanks for the idea. I had tried that, but without the crucial "bzr revert ." step. Unfortunately your method results in a diverged branches error. Am I doing something wrong, below?

- - - - - snip - - - - -
/bzr/foo$ bzr merge ../bar
/bzr/foo$ bzr revert .
/bzr/foo$ bzr status -V
pending merges:
  user 2008-02-01 server-specific changes
/bzr/foo$ bzr commit -m "FAKE MERGE: server-specific changes"
/bzr/foo$ cd ../bar
/bzr/bar$ bzr push /bzr/foo
No new revisions to push.
 [hack, hack, hack]
/bzr/bar$ bzr commit -m "normal changes"
/bzr/bar$ bzr push /bzr/foo
bzr: ERROR: These branches have diverged. Try using "merge" and then "push".

Revision history for this message
Best John A Meinel (jameinel) said :
#4

Well, you can't push because the tips *have* diverged. Specifically you have:

  A # Some base level commit
  |\
  B C # foo, bar respectively
  |/|
  D | # Fake merge
    |
    E # New work that you did in your [hack, hack, hack] section

A 'bzr push' is saying take what I have, and make it the new tip of that
branch. However, you would be ignoring the changes in D. What you want to be
doing is:

cd ../foo
bzr merge ../bar
# Review to make sure it all makes sense
bzr commit -m "merge changes from bar"

Revision history for this message
Rolly (hachirota) said :
#5

OK, thanks, that makes sense. I opened this problem in the hopes that I could block revisions and still use push/pull. Alas, looks like I'm stuck with merge for now.

Revision history for this message
Rolly (hachirota) said :
#6

Thanks John A Meinel, that solved my question.