/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php { } $from = $argv[1]; $to = $argv[2]; $local = $argv[3]; echo("Creating $to\n"); echo("Checking out $to\n"); echo("Exporting non-external content of $from to $local\n"); mysystem("svn export --force --ignore-externals " . escapeshellarg($from) . " " . escapeshellarg($local)); echo("Checking out $from to $local.tmp without externals so that we can do efficient recursive propgets\n"); mysystem("svn co --ignore-externals " . escapeshellarg($from) . " " . escapeshellarg("$local.tmp")); echo("Querying svn:externals properties of $from\n"); $externals = simplexml_load_string(stream_get_contents(popen("svn propget --xml --recursive svn:externals " . escapeshellarg("$local.tmp"), "r"))); echo("Querying svn:ignore properties of $from\n"); $ignores = simplexml_load_string(stream_get_contents(popen("svn propget --xml --recursive svn:ignore " . escapeshellarg("$local.tmp"), "r"))); echo("Adding $local contents (necessary before externals can be set)\n"); echo("Applying externals\n"); applyProperties($externals); echo("Applying ignores\n"); applyProperties($ignores); echo("Removing $local.tmp"); echo("Committing $local\n"); echo("Updating $local\n"); echo("Done!\n"); function applyProperties($properties) { global $local; foreach ($properties->target as $target) { $path = $target['path']; foreach ($target->property as $property) { $name = $property['name']; $value = (string) $property; mysystem("svn propset " . escapeshellarg($name) . " " . escapeshellarg($value) . " " . escapeshellarg("$local/$path")); } } } function mysystem($cmd) { if ($val != 0) { } }