[svk-commit] r2105 - in trunk/lib/SVK: . Command Root

clkao at bestpractical.com clkao at bestpractical.com
Fri Nov 3 16:05:18 EST 2006


Author: clkao
Date: Fri Nov  3 16:05:17 2006
New Revision: 2105

Modified:
   trunk/lib/SVK/Command.pm
   trunk/lib/SVK/Command/Checkout.pm
   trunk/lib/SVK/Command/Commit.pm
   trunk/lib/SVK/Command/Import.pm
   trunk/lib/SVK/Merge.pm
   trunk/lib/SVK/Path/Checkout.pm
   trunk/lib/SVK/Root/Checkout.pm
   trunk/lib/SVK/XD.pm

Log:
Don't clone from D::H->get when we don't need to modify the value.

Modified: trunk/lib/SVK/Command.pm
==============================================================================
--- trunk/lib/SVK/Command.pm	(original)
+++ trunk/lib/SVK/Command.pm	Fri Nov  3 16:05:17 2006
@@ -739,7 +739,7 @@
     return unless @tgt;
     my %roots;
     for (@tgt) {
-	my (undef, $coroot) = $self->{xd}{checkout}->get($_);
+	my (undef, $coroot) = $self->{xd}{checkout}->get($_, 1);
 	$roots{$coroot}++;
     }
     $self->{xd}->lock($_)

Modified: trunk/lib/SVK/Command/Checkout.pm
==============================================================================
--- trunk/lib/SVK/Command/Checkout.pm	(original)
+++ trunk/lib/SVK/Command/Checkout.pm	Fri Nov  3 16:05:17 2006
@@ -52,8 +52,7 @@
 
     if (-e $report) {
 	my $copath = abs_path($report);
-	my ($entry, @where) = $self->{xd}{checkout}->get($copath);
-
+	my ($entry, @where) = $self->{xd}{checkout}->get($copath, 1);
         return $self->SUPER::run
 	    ( SVK::Path::Checkout->real_new
 	      ({ source => $target->mclone(revision => $entry->{revision}),
@@ -77,7 +76,7 @@
 
     # abs_path doesn't work until the parent is created.
     my $copath = abs_path ($report);
-    my ($entry, @where) = $self->{xd}{checkout}->get ($copath);
+    my ($entry, @where) = $self->{xd}{checkout}->get ($copath, 1);
     die loc("Overlapping checkout path is not supported (%1); use 'svk checkout --detach' to remove it first.\n", $where[0])
 	if exists $entry->{depotpath} && $#where > 0;
 

Modified: trunk/lib/SVK/Command/Commit.pm
==============================================================================
--- trunk/lib/SVK/Command/Commit.pm	(original)
+++ trunk/lib/SVK/Command/Commit.pm	Fri Nov  3 16:05:17 2006
@@ -403,12 +403,12 @@
     my $fs = $target->repos->fs;
     sub {
 	my $rev = shift;
-	my ($entry, $dataroot) = $self->{xd}{checkout}->get($target->copath($target->{copath_target}));
+	my ($entry, $dataroot) = $self->{xd}{checkout}->get($target->copath($target->{copath_target}), 1);
 	my (undef, $coanchor) = $self->{xd}->find_repos ($entry->{depotpath});
 	my $oldroot = $fs->revision_root ($rev-1);
 	# optimize checkout map
 	for my $copath ($self->{xd}{checkout}->find ($dataroot, {revision => qr/.*/})) {
-	    my $coinfo = $self->{xd}{checkout}->get ($copath);
+	    my $coinfo = $self->{xd}{checkout}->get ($copath, 1);
 	    next if $coinfo->{'.deleted'};
 	    my $orev = eval { $oldroot->node_created_rev (abs2rel ($copath, $dataroot => $coanchor, '/')) };
 	    defined $orev or next;
@@ -422,7 +422,7 @@
 	    $self->{xd}{checkout}->store ($path,
                                           { $self->_schedule_empty },
                                           {override_sticky_descendents => $self->{recursive}});
-            if (($action eq 'D') and $self->{xd}{checkout}->get ($path)->{revision} == $rev ) {
+            if (($action eq 'D') and $self->{xd}{checkout}->get ($path, 1)->{revision} == $rev ) {
                 # Fully merged, remove the special node
                 $self->{xd}{checkout}->store (
                     $path, { revision => undef, $self->_schedule_empty }

Modified: trunk/lib/SVK/Command/Import.pm
==============================================================================
--- trunk/lib/SVK/Command/Import.pm	(original)
+++ trunk/lib/SVK/Command/Import.pm	Fri Nov  3 16:05:17 2006
@@ -35,7 +35,7 @@
 
 sub lock {
     my ($self, $target, $source) = @_;
-    unless ($self->{xd}{checkout}->get ($source)->{depotpath}) {
+    unless ($self->{xd}{checkout}->get ($source, 1)->{depotpath}) {
 	$self->{xd}->lock ($source) if $self->{to_checkout};
 	return;
     }
@@ -79,7 +79,7 @@
 	}
     }
 
-    unless (exists $self->{xd}{checkout}->get ($copath)->{depotpath}) {
+    unless (exists $self->{xd}{checkout}->get ($copath, 1)->{depotpath}) {
 	$self->{xd}{checkout}->store
 	    ($copath, {depotpath => '/'.$target->depotname.$target->path_anchor,
 		       '.newprop' => undef,

Modified: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm	(original)
+++ trunk/lib/SVK/Merge.pm	Fri Nov  3 16:05:17 2006
@@ -275,7 +275,7 @@
     my $pool = SVN::Pool->new_default;
     my $info = $self->merge_info ($target->new);
 
-    $target = $target->new->as_depotpath ($self->{xd}{checkout}->get ($target->copath)->{revision})
+    $target = $target->new->as_depotpath ($self->{xd}{checkout}->get ($target->copath. 1)->{revision})
 	if $target->isa('SVK::Path::Checkout');
     $info->add_target ($target, $self->{xd}) unless $noself;
 

Modified: trunk/lib/SVK/Path/Checkout.pm
==============================================================================
--- trunk/lib/SVK/Path/Checkout.pm	(original)
+++ trunk/lib/SVK/Path/Checkout.pm	Fri Nov  3 16:05:17 2006
@@ -53,7 +53,7 @@
     my $self = shift;
     my $copath = $self->copath($self->copath_target);
 
-    my (undef, $coroot) = $self->xd->{checkout}->get($copath);
+    my (undef, $coroot) = $self->xd->{checkout}->get($copath, 1);
     Carp::cluck $copath.YAML::Syck::Dump($self->xd->{checkout}) unless $coroot;
     my @paths = $self->xd->{checkout}->find($coroot, {revision => qr'.*'});
     my $tmp = $copath;

Modified: trunk/lib/SVK/Root/Checkout.pm
==============================================================================
--- trunk/lib/SVK/Root/Checkout.pm	(original)
+++ trunk/lib/SVK/Root/Checkout.pm	Fri Nov  3 16:05:17 2006
@@ -26,7 +26,7 @@
     return $SVN::Node::none unless -e _;
 
     return (is_symlink || -f _) ? $SVN::Node::file : $SVN::Node::dir
-	if $self->path->xd->{checkout}->get($copath)->{'.schedule'} or
+	if $self->path->xd->{checkout}->get($copath, 1)->{'.schedule'} or
 	    $root->check_path($path, $pool);
     return $SVN::Node::unknown;
 }
@@ -53,7 +53,7 @@
 sub closest_copy {
     my ($self, $path, $pool) = @_;
     my ($copath, $root) = $self->_get_copath($path, $pool);
-    my $entry = $self->path->xd->{checkout}->get($copath);
+    my $entry = $self->path->xd->{checkout}->get($copath, 1);
     my $kind = $entry->{'.schedule'} || '';
 
     return $root->closest_copy($path, $pool) unless $kind eq 'add';
@@ -64,7 +64,7 @@
 sub copied_from {
     my ($self, $path, $pool) = @_;
     my ($copath, $root) = $self->_get_copath($path, $pool);
-    my $entry = $self->path->xd->{checkout}->get($copath);
+    my $entry = $self->path->xd->{checkout}->get($copath, 1);
     my $kind = $entry->{'.schedule'};
 
     return $root->copied_from($path, $pool) unless $kind eq 'add';
@@ -75,7 +75,7 @@
 sub node_history {
     my ($self, $path, $pool) = @_;
     my ($copath, $root) = $self->_get_copath($path, $pool);
-    my $entry = $self->path->xd->{checkout}->get($copath);
+    my $entry = $self->path->xd->{checkout}->get($copath, 1);
     my $kind = $entry->{'.schedule'} || '';
 
     return $root->node_history($path, $pool) unless $kind eq 'add';
@@ -106,7 +106,7 @@
 	else {
 	    # Do we know about the node?
 	    $coentries->{$_} = SVK::Root::Checkout::Entry->new
-		({ kind => $self->path->xd->{checkout}->get($copath)->{'.schedule'} ?
+		({ kind => $self->path->xd->{checkout}->get($copath, 1)->{'.schedule'} ?
 		   $kind : $SVN::Node::unknown });
 	}
     }
@@ -133,7 +133,7 @@
     my $copath = abs2rel($path, $self->path->path_anchor => $self->path->copath);
     my $root;
     ($root, $_[1]) = $self->path->source->root->get_revision_root
-	($path, $self->path->xd->{checkout}->get($copath)->{revision}, $pool);
+	($path, $self->path->xd->{checkout}->get($copath, 1)->{revision}, $pool);
     return ($copath, $root);
 }
 

Modified: trunk/lib/SVK/XD.pm
==============================================================================
--- trunk/lib/SVK/XD.pm	(original)
+++ trunk/lib/SVK/XD.pm	Fri Nov  3 16:05:17 2006
@@ -287,7 +287,7 @@
 
 sub lock {
     my ($self, $path) = @_;
-    if ($self->{checkout}->get ($path)->{lock}) {
+    if ($self->{checkout}->get ($path, 1)->{lock}) {
 	die loc("%1 already locked, use 'svk cleanup' if lock is stalled\n", $path);
     }
     $self->{checkout}->store ($path, {lock => $$});
@@ -604,7 +604,7 @@
     # In the simple case - only one revision entry found, it can be
     # for some descendents.  If so we actually need to construct
     # txnroot.
-    my ($simple, @bases) = $self->{checkout}->get($paths[0] || $copath);
+    my ($simple, @bases) = $self->{checkout}->get($paths[0] || $copath, 1);
     # XXX this isn't really right: we aren't guaranteed that $revbase
     # actually has the revision, it might just have a lock or
     # something
@@ -615,7 +615,7 @@
 
     my $pool = SVN::Pool->new;
     for (@paths) {
-	my $cinfo = $self->{checkout}->get ($_);
+	my $cinfo = $self->{checkout}->get ($_, 1);
 	my $path = abs2rel($_, $copath => $arg{path}, '/');
 	unless ($root) {
 	    my $base_rev = $cinfo->{revision};
@@ -752,7 +752,7 @@
 	     return if m/$ignore/;
 	     my $cpath = catdir($File::Find::dir, $_);
 	     no warnings 'uninitialized';
-	     return if $self->{checkout}->get ($cpath)->{'.schedule'}
+	     return if $self->{checkout}->get($cpath, 1)->{'.schedule'}
 		 eq 'delete';
 
 	     push @deleted, $cpath; 
@@ -1538,14 +1538,14 @@
 =cut
 
 sub get_entry {
-    my ($self, $copath) = @_;
-    my $entry = $self->{checkout}->get($copath);
+    my ($self, $copath, $dont_clone) = @_;
+    my $entry = $self->{checkout}->get($copath, $dont_clone);
     return ($entry, $entry->{'.schedule'} || '');
 }
 
 sub resolved_entry {
     my ($self, $entry) = @_;
-    my $val = $self->{checkout}->get ($entry);
+    my $val = $self->{checkout}->get ($entry, 1);
     return unless $val && $val->{'.conflict'};
     $self->{checkout}->store ($entry, {%$val, '.conflict' => undef});
     print loc("%1 marked as resolved.\n", $entry);
@@ -1737,7 +1737,7 @@
     my ($self, $entry, $copath, $root) = @_;
     return unless $entry->{scheduleanchor};
     my $descendent = abs2rel($copath, $entry->{scheduleanchor}, '', '/');
-    $entry = $self->{checkout}->get ($entry->{scheduleanchor})
+    $entry = $self->{checkout}->get ($entry->{scheduleanchor}, 1)
 	if $entry->{scheduleanchor} ne $copath;
     my $from = $entry->{'.copyfrom'} or return;
     $from .= $descendent;
@@ -1748,7 +1748,7 @@
 sub get_props {
     my ($self, $root, $path, $copath, $entry) = @_;
     my $props = {};
-    $entry ||= $self->{checkout}->get ($copath) if $copath;
+    $entry ||= $self->{checkout}->get ($copath, 1) if $copath;
     my $schedule = $entry->{'.schedule'} || '';
 
     if (my ($source_path, $source_root) = $self->_copy_source ($entry, $copath, $root)) {


More information about the svk-commit mailing list