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

David Golden xdaveg at gmail.com
Mon Feb 12 11:43:30 EST 2007


Andy,

You're in Texas?  Are you going to be at YAPC in Houston?  I looks
like I just might owe you a beer there.

Thanks for working up this patch.

David


On 2/12/07, Andrew Ruder <andy at aeruder.net> wrote:
> 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
>
> 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
>
>
> _______________________________________________
> svk-devel mailing list
> svk-devel at bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/svk-devel
>
>


More information about the svk-devel mailing list