[svk-devel] [PATCH] propset from a file

Andrew Ruder andy at aeruder.net
Mon Feb 12 11:07:19 EST 2007


This is against latest svn.

Adds --source FILENAME to propset to allow setting a property from the
contents of a file.  Its a pretty small patch (and I tested with various
configurations of propset command line).  Let me know if you see any
problems.

Cheers,
Andy

-- 
Andrew Ruder <andy at aeruder.net>
http://www.aeruder.net
-------------- next part --------------
Index: lib/SVK/Command/Propset.pm
===================================================================
--- lib/SVK/Command/Propset.pm	(revision 2298)
+++ lib/SVK/Command/Propset.pm	(working copy)
@@ -53,7 +53,7 @@
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use base qw( SVK::Command::Commit SVK::Command::Proplist );
 use constant opt_recursive => 0;
-use SVK::Util qw ( abs2rel );
+use SVK::Util qw ( abs2rel read_file );
 use SVK::XD;
 use SVK::I18N;
 use SVK::Logger;
@@ -63,11 +63,16 @@
      'r|revision=i' => 'rev',
      'revprop' => 'revprop',
      'q|quiet' => 'quiet',
+     'source=s' => 'source'
     );
 }
 
 sub parse_arg {
     my ($self, @arg) = @_;
+    if ($self->{source}) {
+	return if @arg < 1;
+	@arg = ($arg[0], read_file($self->{source}), @arg[1..$#arg]);
+    }
     return if @arg < 2;
     push @arg, ('') if @arg == 2;
     return (@arg[0,1], map {$self->_arg_revprop ($_)} @arg[2..$#arg]);
@@ -187,7 +192,7 @@
 
 =head1 SYNOPSIS
 
- propset PROPNAME PROPVAL [DEPOTPATH | PATH...]
+ propset PROPNAME [PROPVAL | --source FILENAME] [DEPOTPATH | PATH...]
 
 =head1 OPTIONS
 
@@ -202,5 +207,6 @@
  -S [--sign]            : sign this change
  -C [--check-only]      : try operation but make no changes
  -q [--quiet]           : print as little as possible
+ --source FILENAME      : read property value from FILENAME
  --direct               : commit directly even if the path is mirrored
 


More information about the svk-devel mailing list