Merging In Plastic Scm: A Step-By-Step Guide

how to merge in plastic scm

Plastic SCM is a version control tool that can be used to manage file changes in a project. It is often used in game development to allow multiple team members to work on the same project without overwriting each other's changes. Plastic SCM's merge engine can handle many file conflicts automatically, including complex cases such as divergent move scenarios and parallel modifications. It also includes its own built-in merge tool that can track code that has been moved and modified. When using Plastic SCM, it is important to create branches quickly, which should take less than a second, even for large codebases. This allows for successful branching and merging patterns. Additionally, Plastic SCM can be used in conjunction with other tools such as Unity, Git, and Mercurial, providing a flexible and powerful version control solution for various development workflows.

shunpoly

Plastic SCM's built-in merge tool

Plastic SCM is a version control and source code management tool used for game and real-time 3D development. It is designed to improve team collaboration and scalability with any engine. Plastic SCM uses a new paradigm where a branch simply "inherits" from a given changeset, allowing for the fast creation of new branches. This is especially useful when dealing with large codebases, as the time taken to create a new branch is not tied to the number of files in the codebase.

The Plastic SCM merge machine includes its own built-in merge tool capable of handling many file conflicts automatically. This built-in merge tool can turn several complex cases into automatic ones, provided the same line of code is not modified in parallel. It is the only tool that includes Xmerge and Xdiff to track code that has been moved and modified.

The built-in merge tool in Plastic SCM simplifies the merging process and helps users understand the entire branching and merging workflow. It is designed to handle file conflicts that occur when the same file has been modified in parallel. In such cases, the merge tool can locate the three contributors that are always involved in a file merge: the base or common ancestor (how the file was before modifications), the source (the code being merged from), and the destination (the code being merged to).

Additionally, the built-in merge tool can handle the divergent move scenario, which is problematic for most version control systems. In cases where the same file has been modified in both contributors, the file merge would be handled after resolving the directory situation. For example, if Developer 1 moves "src" to "doc/src" and Developer 2 moves "doc" to "src/doc", the merge of these two operations would create a cycle. The merge engine must detect this and help developers decide which version to keep.

Plastic SCM also offers the option to plug in a preferred 3-way merge tool while still enjoying the core benefits of its merge engine. This flexibility allows users to work with their preferred tools while taking advantage of Plastic SCM's powerful merging capabilities.

shunpoly

Using a 3-way merge tool

Plastic SCM is a full version control stack that includes its own built-in 3-way merge tool. This tool can turn several complex cases into automatic ones, provided the same line of code is not modified in parallel. It is the only tool that includes Xmerge and Xdiff to track code that has been moved and modified.

The source (or "theirs" in some tools' jargon) refers to the code you're merging from, while the destination (or "yours") refers to the code you're merging to. The "result" is the product of combining the three contributors. A good merge engine will be able to handle many file conflicts automatically, which is why merge-tracking (being able to correctly determine the 3 contributors) is key. If only one of the contributors has been modified, the merge result is the changed contributor.

However, there will be cases where the file has been modified in parallel, and this is when a 3-way merge tool is needed. For example, one developer decides to rename a file, while another developer needs to make a modification to the same file. The version control should be able to reconcile both changes: rename the file and introduce the changes made by the second developer. Many version control tools fail to handle this simple case and will end up with two files: the renamed one without the changes, and the modified one with the changes but not the rename. Plastic SCM is able to handle this case correctly.

Additionally, Plastic SCM can handle the divergent move scenario, which is problematic for all version control systems. In this case, the file was modified in both contributors, and the file merge would be handled after resolving the directory situation. For example, if Developer 1 moves src to doc/src, and Developer 2 moves doc to src/doc, the merge of the two operations would create a cycle. The merge engine must detect this and help developers decide which one to keep.

shunpoly

Resolving file conflicts

File conflicts occur when the same file has been modified in parallel. When using Unity to develop games, many people may choose to use Plastic SCM to collaborate with their team. However, with multiple people working on the same project, a merge conflict may sometimes occur.

To resolve file conflicts, you can follow these steps:

  • Navigate to the Incoming Changes tab in the Unity Editor, which lists all the incoming changes from the Plastic SCM repository.
  • When there is a file conflict, the conflicting files will be highlighted.
  • Right-click on the conflicting file(s) and select how you would like to merge them.
  • You can choose to keep or discard specific changes.
  • If you are unable to merge the files, there may be a directory conflict. This occurs when the folders in your project folder do not match the folders in the repository.
  • To resolve a directory conflict, select each individual conflict and decide whether to replace the local files on your computer with the files from the repository or vice versa.
  • Once all conflicts have been resolved, select save and exit, and Plastic SCM will complete the merge operation.

It is important to note that merge conflicts can cause progress to be lost, so communication and frequent updates are crucial to mitigating potential issues. Additionally, Plastic SCM includes a built-in merge tool that can handle complex cases automatically, provided the same line of code is not modified in parallel.

shunpoly

Locking files

To lock files with Plastic SCM, you must first create a lock.conf file. This file should be placed in your server directory, which can be found at ../PlasticSCM/server.

The terminal/command line window will then display a list of locked files. You can test that this has worked by attempting to check out the same file with a different user. If this has been successful, an error message will appear in Unity's console, stating that the file is already checked out by another user.

It appears that Plastic SCM Lock rules only work with one file at a time. Users have reported that attempting to lock multiple file types simultaneously results in checkout stopping.

shunpoly

Branching patterns

The process involves creating task branches for every new feature or bug fix that needs to be implemented. Each task branch goes through a strict process of code development, code review, and testing before being safely deployed. This strategy has been found to be effective for 95% of the scenarios and teams.

Plastic SCM provides speed in creating branches, taking less than a second, even with large codebases. It uses a newer paradigm where a branch inherits from a given changeset, making the time linear and not dependent on the number of files in the codebase.

Additionally, Plastic SCM offers a built-in merge tool that can handle complex cases automatically. It can manage file conflicts and track code that has been moved or modified. It also integrates with systems like Jira, Bugzilla, and Rally, displaying task and bug information within the GUI.

Plastic SCM provides flexibility in implementing any pattern, and its task branches blend well with modern development practices, making it a powerful tool for managing version control.

Comb Care: Plastic and Hair Loss

You may want to see also

Frequently asked questions

Use the YAML merge tool Unity provides (look up smart merge) and hook it up to Plastic SCM.

Older systems like Subversion, CVS, and Perforce rely on some sort of "copying" to create a new branch, which is time-consuming. Plastic SCM uses a newer paradigm where a branch simply "inherits" from a given changeset, making the process faster.

One developer renames a file while another developer makes modifications to the same file. Plastic SCM can handle this case correctly, but many version control tools will end up with two files: one with the new name without the changes and one with the changes but not the new name.

Plastic SCM includes its own built-in merge tool capable of turning several complex cases into automatic ones. It is the only tool that includes Xmerge and Xdiff to track code that has been moved and modified.

Written by
Reviewed by
Share this post
Print
Did this article help you?

Leave a comment