Ryan Schmidt wrote:
> On Nov 3, 2009, at 02:19, IPv7 Develop Group wrote:
>
>> Christian Unger wrote:
[Cut..]
> That is correct. "svn propedit" works on remote URLs, but "svn
> propset" does not. Please see:
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=2238#desc10
Thank you for the info about it. You know if this change will be included in the SVN::Client?
>> So need i to checkout, change the working copy and then commit the
>> change, a svn:external?
>
> Yes.
At the end of the email i paste some lines code in perl to make this,
if someone need it and don't want to spend time, is a base to understand how make it.
>> The only way i see is to wrap the svn shell command in perl and
>> remove all the SVN::Client reference,
>> because this implementation isn't oriented for the scripting...
>
> I'm not sure what you mean.
Sorry, i wrote this because i lost some times to understand why the function to change a prop is so difficult to
implement in a script to make some operation without the human presence... ;)
use SVN::Client;
use File::Remove 'remove';
sub svnupdateexternals {
my ($svn_ext_ctx,$svn_ext_url,$svn_ext_link,$svn_ext_target) = @_;
my $recursive = "0";
my $svn_ext_path = "/tmp/external-update-".$$;
my $svn_ext_name="svn:externals";
my $svn_ext_rev="HEAD";
my $svn_ext_force="0";
my $svn_ext_hash = $svn_ext_ctx->propget($svn_ext_name,$svn_ext_url,$svn_ext_rev,$svn_ext_force);
my $svn_ext_newexternal="";
my $svn_ext_setprop="";
my $svn_ext_count="1";
my ($svn_ext_key, $svn_ext_value) = each(%$svn_ext_hash);
print "Key:$svn_ext_key\n\nValue:\n$svn_ext_value\n";
foreach (split(/\n/,$svn_ext_value)) {
my $svn_ext_external=$_;
#if you want some useful message uncoment print lines
#print "-----------------\n";
#print "External$svn_ext_count: $svn_ext_external\n";
$svn_ext_count++;
my @svn_ext_exter=split(/\s+/,$svn_ext_external);
#if you want some useful message uncoment print lines
#print "+++++++++++++++++++++\n";
#print "\tName: $svn_ext_exter[0]\n";
#print "\tUrl: $svn_ext_exter[1]\n";
if ( $svn_ext_exter[0] eq $svn_ext_link ) {
$svn_ext_exter[1]=$svn_ext_target;
$svn_ext_setprop="1";
}
$svn_ext_newexternal=$svn_ext_newexternal."$svn_ext_exter[0] $svn_ext_exter[1]\n";
}
print "\n\n\n";
if ( $svn_ext_setprop eq "1" ) {
#if you want some useful message uncoment print lines
#print "Set svn:external\n";
#print "================\n";
#print "Key:$svn_ext_key\n\n";
#print "Value:\n";
#print "Tmpdir: $svn_ext_path\n";
#print $svn_ext_newexternal;
my $svn_ext_logmsg="Operation: Change svn:externals\nRepo path:
$svn_ext_url\n\nFrom:\n$svn_ext_value\nTo:\n$svn_ext_newexternal\n";
#print "Log message: $svn_ext_logmsg";
$svn_ext_ctx->checkout($svn_ext_url, $svn_ext_path, "HEAD", $recursive);
$svn_ext_ctx->propset($svn_ext_name,$svn_ext_newexternal,$svn_ext_path,$svn_ext_force);
svnsetlogmsg($svn_ext_ctx,$svn_ext_logmsg);
$svn_ext_ctx->commit($svn_ext_path, $recursive);
remove( \1, $svn_ext_path );
} else {
#if you want some useful message uncoment print lines
#print "Value:\n";
#print $svn_ext_value;
}
}
#This is equivalent of the example in the doc to set the message in a svn operation...
sub svnsetlogmsg {
my ($svn_log_ctx, $svn_set_log_mesg) = @_;
my $svn_set_log_msg_handler = sub {
my $stringptr = shift;
$$stringptr = $svn_set_log_mesg;
return 1;
};
$svn_log_ctx->log_msg($svn_set_log_msg_handler);
};
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2415788
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-11-09 15:38:07 CET