[svk-commit] r2544 - in branches/2.0-releng/lib/SVK: Editor

nobody at bestpractical.com nobody at bestpractical.com
Tue Oct 16 10:30:23 EDT 2007


Author: clkao
Date: Tue Oct 16 10:30:18 2007
New Revision: 2544

Modified:
   branches/2.0-releng/lib/SVK/Editor/Merge.pm
   branches/2.0-releng/lib/SVK/Merge.pm

Log:
Didn't mean to commit this on the releng branch yet.

Modified: branches/2.0-releng/lib/SVK/Editor/Merge.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Merge.pm	(original)
+++ branches/2.0-releng/lib/SVK/Editor/Merge.pm	Tue Oct 16 10:30:18 2007
@@ -58,7 +58,7 @@
 use autouse 'SVK::Util'
     => qw( slurp_fh md5_fh tmpfile devnull abs2rel );
 
-__PACKAGE__->mk_accessors(qw(inspector notify storage ticket cb_merged));
+__PACKAGE__->mk_accessors(qw(inspector notify storage));
 
 use Class::Autouse qw(SVK::Inspector::Root SVK::Notify
 		      Data::Hierarchy IO::Digest);
@@ -227,27 +227,21 @@
     $self->{storage}->set_target_revision ($revision);
 }
 
-sub set_ticket {
-    my ($self, $baton, $type, $pool) = @_;
-
-    my $func = "change_${type}_prop";
-
-    $self->{storage}->$func( $baton, 'svk:merge', $self->ticket->as_string, $pool );
-
-}
-
 sub open_root {
-    my ($self, $baserev, $pool) = @_;
+    my ($self, $baserev) = @_;
     $self->{baserev} = $baserev;
     $self->{notify} ||= SVK::Notify->new_with_report ($self->{report}, $self->{target});
     $self->{storage_baton}{''} =
 	$self->{storage}->open_root ($self->{cb_rev}->($self->{target}||''));
     $self->{notify}->node_status ('', '');
 
+    my $ticket = $self->{ticket};
     $self->{dh} = Data::Hierarchy->new;
-
-    $self->set_ticket($self->{storage_baton}{''}, 'dir', $pool)
-	if !length $self->{target} && $self->ticket;
+    $self->{cb_merged} =
+	sub { my ($editor, $baton, $type, $pool) = @_;
+	      my $func = "change_${type}_prop";
+	      $editor->$func ($baton, 'svk:merge', $ticket->(), $pool);
+	  } if $ticket;
 
     return '';
 }
@@ -332,10 +326,7 @@
 	$self->{storage}->open_file ($path, $self->{storage_baton}{$pdir},
 				     $self->{cb_rev}->($path), $pool);
     ++$self->{changes};
-    delete $self->{info}{$path}{open}; # 
-
-    $self->set_ticket( $self->{storage_baton}{$path}, 'file', $pool )
-	if $path eq $self->{target} && $self->ticket;
+    delete $self->{info}{$path}{open};
 }
 
 sub ensure_close {
@@ -346,9 +337,9 @@
     $self->{cb_closed}->($path, $checksum, $pool)
         if $self->{cb_closed};
 
-    if ($path eq $self->{target} && $self->{changes} && $self->cb_merged) {
+    if ($path eq $self->{target} && $self->{changes} && $self->{cb_merged}) {
 	$self->ensure_open ($path);
-	$self->cb_merged->($self->{ticket});
+	$self->{cb_merged}->($self->{storage}, $self->{storage_baton}{$path}, 'file', $pool);
     }
 
     if (my $baton = $self->{storage_baton}{$path}) {
@@ -675,12 +666,9 @@
 	}
     }
     $self->{notify}->node_status ($path, '');
-    my $baton = $self->{storage_baton}{$path} =
+    $self->{storage_baton}{$path} =
 	$self->{storage}->open_directory ($path, $self->{storage_baton}{$pdir},
 					  $self->{cb_rev}->($path), @arg);
-    $self->set_ticket->($baton, 'dir', $pool)
-	if $path eq $self->{target} && $self->ticket;
-
     return $path;
 }
 
@@ -693,9 +681,8 @@
     $self->{notify}->flush_dir ($path);
 
     my $baton = $self->{storage_baton}{$path};
-    $self->cb_merged->( $self->{ticket} )
-	if $path eq $self->{target} && $self->{changes} && $self->cb_merged;
-
+    $self->{cb_merged}->($self->{storage}, $baton, 'dir', $pool)
+	if $path eq $self->{target} && $self->{changes} && $self->{cb_merged};
 
     $self->{storage}->close_directory ($baton, $pool);
     delete $self->{storage_baton}{$path}

Modified: branches/2.0-releng/lib/SVK/Merge.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Merge.pm	(original)
+++ branches/2.0-releng/lib/SVK/Merge.pm	Tue Oct 16 10:30:18 2007
@@ -345,27 +345,18 @@
     return $minfo;
 }
 
-sub _get_new_ticket {
-    my ($self, $srcinfo) = @_;
-    my $dstinfo = $self->merge_info($self->{dst});
-    # We want the ticket representing src, but not dst.
-    return $dstinfo->union ($srcinfo)->del_target($self->{dst});
-}
-
-# deprecated
 sub get_new_ticket {
     my ($self, $srcinfo) = @_;
-    my $newinfo = $self->_get_new_ticket($srcinfo);
-    $self->print_new_ticket($newinfo);
-    return $newinfo->as_string;
-}
-
-sub print_new_ticket {
-    my ($self, $dstinfo, $newinfo) = @_;
-    for (sort keys %$newinfo) {
-	$logger->info(loc("New merge ticket: %1:%2", $_, $newinfo->{$_}{rev}))
-	    if !$dstinfo->{$_} || $newinfo->{$_}{rev} > $dstinfo->{$_}{rev};
+    my $dstinfo = $self->merge_info ($self->{dst});
+    # We want the ticket representing src, but not dst.
+    my $newinfo = $dstinfo->union ($srcinfo)->del_target ($self->{dst});
+    unless ($self->{quiet}) {
+	for (sort keys %$newinfo) {
+	    $logger->info(loc("New merge ticket: %1:%2", $_, $newinfo->{$_}{rev}))
+		if !$dstinfo->{$_} || $newinfo->{$_}{rev} > $dstinfo->{$_}{rev};
+	}
     }
+    return $newinfo->as_string;
 }
 
 sub log {
@@ -537,8 +528,6 @@
     # $cb{inspector} = $self->{dst}->inspector
     # unless ref($cb{inspector}) eq 'SVK::Inspector::Compat' ;
 
-    my $dstinfo = $self->merge_info($self->{dst});
-
     my $meditor = SVK::Editor::Merge->new
 	( anchor => $src->path_anchor,
 	  repospath => $src->repospath, # for stupid copyfrom url
@@ -565,12 +554,8 @@
 					(SVK::Merge::Info->new ($prop->{local}))->as_string);
 			    }
 			},
-	    ticket =>
-	    $self->_get_new_ticket($self->merge_info_with_copy($src)->add_target($src)),
-	    cb_merged => sub {
-		my ($ticket) = @_;
-		$self->print_new_ticket( $dstinfo, $ticket ) unless $self->{quiet};
-	    }
+	    ticket => 
+	    sub { $self->get_new_ticket ($self->merge_info_with_copy ($src)->add_target ($src)) }
 	  ) :
 	  ( prop_resolver => { 'svk:merge' => sub { ('G', undef, 1)} # skip
 			     }),


More information about the svk-commit mailing list