Merge-To: Merging on the fly

Wednesday, July 25, 2012 0 Comments

Merging is a common operation that everybody does several times per day. Still, merging could be one of the most complex operations on a good version control system.

Plastic SCM is the good guy (our favorite hero in this adventure), it automatically solves as many conflicts as possible.

The past

Until now, all cases of merging two of an item's revisions has been a directional operation:

  • Source: This is the revision that comes from the branch or changeset that is being merged.
  • Destination: This is the last revision on the workspace’s active branch.

The present

Oftentimes, developers and release managers face the following situation: They need to "publish" changes to an integration branch and they're sure there are no merges involved; they're just "moving" their changes to the designated branch.

When that happens it seems inconvenient to switch to the destination branch and merge from source (which is the regular pattern in every SCM out there, including Plastic SCM). So, we've created the merge-to command, which is able to move changes from a source branch to a destination branch! There is one caveat: this ONLY works if there are no conflicts.

We are able to use the Branch Explorer and click through a menu to say "Merge this branch with this other branch". The result: the merge is done in the server. Piece of cake.

You can accomplish "merge-to" using these three new options that have been added for "merge-to" on the GUI:

  • "Merge from this branch to..." in the advanced merge branch options.
  • "Merge from this label to..." in the label options.
  • "Merge from this changeset to..." in the advanced merge changeset options.

From command line you can use:

cm merge \"{0}\" --to=\"{1}\"
cm merge \"{0}\" --destination=\"{1}\"

Benefits

What are we improving with this new feature? The "merge-to" feature allows you to perform the merge without having the workspace updated to the branch of the merge. The main branch can be promoted to child branches using the merge-to. In other words? It makes merging faster and it makes your life easier.

Don't forget you can only use "merge-to" when there are no manual conflicts that need resolved. Remember "merge to" is just making an automatic merge.

In Plastic SCM version 4.1 merge-to is disabled. If you want to try it on your deployment you need to edit guiclient.conf and change to true the option EnableMergeTo: <EnableMergeTo>true</EnableMergeTo>

After this you will see the MergeTo context menu option in the Branches View and Branch Explorer View. Otherwise Merge-To will be available only in CLI.

We wrote about this in this post. We talked about dynamic inheritance, a cool feature in Plastic SCM version 3.

0 comentarios: