DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Resolve All SVN Conflicts With The Right Version Of The File
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`;
}
}






Comments
Snippets Manager replied on Wed, 2008/03/12 - 1:21am