Jump to content

Resolving an evil twin


Recommended Posts

I have a question regarding resolving an evil twin directory and the content that may be inside it.

If you have 2 branches where an identical directory name gets created independently in both, and those directories have different files in them, when you go to merge you get an evil twin conflict. You get options of keeping the destination or source directory. As well you can create a new directory and copy one set of files into that directory. Assuming someone accidentally chose source or destination and wanted to keep the files from both version, is there someway 'correct' to recover the files from the other version?

In this case let's say a user merges branch 1 into branch 2 and chooses to keep the evil twin directory from branch 1. This replaces the directory in branch 2 with the content of branch 1 and any files in that directory from branch 2 are removed. Is the only way to bring those back to manually get them out of a previous change set and then replace them, or is there another way to pull those files out? Trying to cherry pick or anything else from that earlier change set doesn't really seem to recognize them since they're technically already in the branch.

Is the correct way to do that to choose the first option and create a duplicate directory to hold the other set of files then move them after that?

Link to comment
Share on other sites

  • 2 weeks later...

It seems to be. We asked if they could add a merge option because it can happen frequently with External actors in Unreal 5, but I don't know if they are evaluating this or not.

You can use the interactive resolve in cm merge and do that process automatically (copy the destination folder into the source folder and then commit the merge)

Link to comment
Share on other sites

  • 7 months later...

I could not find a proper way to solve the evil twin directory conflict merge automatically by PlasticSCM while keeping files from both directories, so I wrote a simple Python script that helps me do it.

import os
import shutil

src_dir = "C:\scm\ProjectName\Content\_ExternalActors__\Maps\MyMap"

# Iterate over all subdirectories in given src_path
for root, dirs, files in os.walk(src_dir):
    for dirname in dirs:
        # Search for folders with a "_dst" suffix, such as "C:\scm\ProjectName\Content\_ExternalActors__\Maps\MyMap\0\RQ_dst"
        if dirname.endswith("_dst"):
            dst_dir = os.path.join(root, dirname[:-4])
            src_dst_dir = os.path.join(root, dirname)
            # If a folder with the "_dst" suffix is found, moves all files within it to the parent directory without the suffix, such as "C:\scm\ProjectName\Content\_ExternalActors__\Maps\MyMap\0\RQ"
            for file in os.listdir(src_dst_dir):
                src_file = os.path.join(src_dst_dir, file)
                dst_file = os.path.join(dst_dir, file)
                print(f"Moving: [{src_file}] >> [{dst_file}]")
                shutil.move(src_file, dst_file)
            # Finally, delete the now-empty directory with the "_dst" suffix
            print(f"Removing [{src_dst_dir}]")

So to make the merge, first I need to select to keep both changes - it will introduce new directory with `_dst` suffix:



Running the script merges all directories with `_dst` back to the directory without the suffix:


I wish PlasticSCM solves this problem by itself, maybe one day...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...