Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Resolve All SVN Conflicts With The Right Version Of The File

DZone's Guide to

Resolve All SVN Conflicts With The Right Version Of The File

·
Free Resource
This small PHP shell script recourses through the subdirectories and looks for files that match the "conflict" files that SVN creates when merging from another branch. It chooses the "right" version of the files and resolves the conflict.



$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."));
foreach($dir as $file)
{
  $path = $file->getPathname();
  if (preg_match('/\.merge-right\.r\d+$/', $path, $matches)) {
    $orig = str_replace($matches[0], '' , $path);
    copy($path, $orig);
    $cmd = "svn resolved $orig";
    `$cmd`;
  }
}
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}