[Bps-public-commit] r12263 -

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon May 12 12:07:13 EDT 2008


Author: sunnavy
Date: Mon May 12 12:07:13 2008
New Revision: 12263

Modified:
   /   (props changed)
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVN.pm

Log:
 r12278 at sunnavys-mb:  sunnavy | 2008-05-12 23:51:15 +0800
 refacotr flags method, the api is now the same as version, source, map and order


Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Mon May 12 12:07:13 2008
@@ -516,11 +516,9 @@
 
 sub flags {
     my $self = shift;
-    my %args = @_;
-
-    croak "need name arg" unless $args{name};
+    my $flags = shift;
 
-    if ( $args{flags} ) {
+    if ( $flags ) {
         my $dir = tempdir( CLEANUP => 1 );
         my $file = File::Spec->catfile( $dir, 'flags.yml' );
 
@@ -529,18 +527,14 @@
             target => $file,
         );
 
-        my $flags = Shipwright::Util::LoadFile($file);
-        $flags->{ $args{name} } = $args{flags};
-
         Shipwright::Util::DumpFile( $file, $flags );
-        $self->commit( path => $file, comment => "set flags for $args{name}" );
+        $self->commit( path => $file, comment => 'set flags' );
         $self->checkout( detach => 1, target => $file );
     }
     else {
         my ($out) = Shipwright::Util->run(
             [ 'svk', 'cat', $self->repository . '/shipwright/flags.yml' ] );
-        $out = Shipwright::Util::Load($out) || {};
-        return $out->{ $args{name} } || [];
+        return Shipwright::Util::Load($out) || {};
     }
 }
 

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Mon May 12 12:07:13 2008
@@ -529,11 +529,9 @@
 
 sub flags {
     my $self = shift;
-    my %args = @_;
-
-    croak "need name arg" unless $args{name};
+    my $flags = shift;
 
-    if ( $args{flags} ) {
+    if ( $flags ) {
         my $dir = tempdir( CLEANUP => 1 );
         my $file = File::Spec->catfile( $dir, 'flags.yml' );
 
@@ -542,17 +540,13 @@
             target => $dir,
         );
 
-        my $flags = Shipwright::Util::LoadFile($file);
-        $flags->{ $args{name} } = $args{flags};
-
         Shipwright::Util::DumpFile( $file, $flags );
-        $self->commit( path => $file, comment => "set flags for $args{name}" );
+        $self->commit( path => $file, comment => 'set flags' );
     }
     else {
         my ($out) = Shipwright::Util->run(
             [ 'svn', 'cat', $self->repository . '/shipwright/flags.yml' ] );
-        $out = Shipwright::Util::Load($out) || {};
-        return $out->{ $args{name} } || [];
+        return $out = Shipwright::Util::Load($out) || {};
     }
 }
 



More information about the Bps-public-commit mailing list