[svk-commit] r2794 - in trunk/lib/SVK: .

nobody at bestpractical.com nobody at bestpractical.com
Tue May 6 01:29:53 EDT 2008


Author: clsung
Date: Tue May  6 01:29:52 2008
New Revision: 2794

Modified:
   trunk/lib/SVK/Command/Branch.pm
   trunk/lib/SVK/Project.pm

Log:
- support --project <pname> now
  - pname must match the project properties e.g.
    svk:project:myProject:path-trunk <=> myProject
- sort options
- shorthand --co for --checkout
- demo usage ==>
  checkout trunk of project 'projA' to /tmp/foo
  % svk br --co trunk --project projA /tmp/foo # 
  checkout branch 'foobar' of project 'projA' to /tmp/bar
  % svk br --co foobar --project projA ~/temp/bar
  

Modified: trunk/lib/SVK/Command/Branch.pm
==============================================================================
--- trunk/lib/SVK/Command/Branch.pm	(original)
+++ trunk/lib/SVK/Command/Branch.pm	Tue May  6 01:29:52 2008
@@ -65,16 +65,17 @@
     ('l|list'           => 'list',
      'C|check-only'     => 'check_only',
      'P|patch=s'        => 'patch',
-     'create'           => 'create',
      'all'              => 'all',
-     'local'            => 'local',
+     'co|checkout'      => 'checkout',
+     'create'           => 'create',
+     'del|delete'       => 'remove',
      'from=s'           => 'from',
+     'local'            => 'local',
      'merge'            => 'merge',
-     'push'             => 'push',
-     'checkout'         => 'checkout',
      'move'             => 'move',
+     'push'             => 'push',
+     'project=s'          => 'project',
      'rm|remove'        => 'remove',
-     'del|delete'       => 'remove',
      'setup'            => 'setup',
      'switch-to'        => 'switch',
      'verbose'          => 'verbose', # TODO
@@ -120,7 +121,7 @@
 
     Carp::cluck unless $target->isa('SVK::Path') or $target->isa('SVK::Path::Checkout');
     $target = $target->source if $target->isa('SVK::Path::Checkout');
-    my $proj = SVK::Project->create_from_prop($target);
+    my $proj = SVK::Project->create_from_prop($target, $self->{project});
     $fromProp = 1 if $proj;
     $proj ||= SVK::Project->create_from_path(
 	    $target->depot, $target->path );

Modified: trunk/lib/SVK/Project.pm
==============================================================================
--- trunk/lib/SVK/Project.pm	(original)
+++ trunk/lib/SVK/Project.pm	Tue May  6 01:29:52 2008
@@ -123,7 +123,7 @@
 }
 
 sub create_from_prop {
-    my ($self, $pathobj) = @_;
+    my ($self, $pathobj, $pname) = @_;
 
     my $fs              = $pathobj->depot->repos->fs;
     my $root            = $fs->revision_root( $fs->youngest_rev );
@@ -139,6 +139,7 @@
     my ($depotroot)     = '/';
     my %projnames = 
         map  { $_ => 1 }
+	grep { (1 and !$pname) or ($_ eq $pname)  } # if specified pname, the grep it only
 	grep { $_ =~ s/^svk:project:([^:]+):.*$/$1/ }
 	grep { $allprops->{$_} =~ /$depotroot/ } sort keys %{$allprops};
     


More information about the svk-commit mailing list