[svk-commit] r2972 - trunk/lib/SVK

nobody at bestpractical.com nobody at bestpractical.com
Sun Jul 6 04:20:58 EDT 2008


Author: ruz
Date: Sun Jul  6 04:20:58 2008
New Revision: 2972

Modified:
   trunk/lib/SVK/Merge.pm

Log:
* no functional changes, just make it more readable

Modified: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm	(original)
+++ trunk/lib/SVK/Merge.pm	Sun Jul  6 04:20:58 2008
@@ -593,6 +593,38 @@
 
     my $dstinfo = $self->merge_info($self->{dst});
 
+    my %ticket_options;
+    if ( $self->{ticket} ) {
+        $ticket_options{prop_resolver} = {
+            'svk:merge' => sub {
+                my ($path, $prop) = @_;
+		return (undef, undef, 1)
+		    if $path eq $target;
+		return ('G', SVK::Merge::Info->new($prop->{new})
+                    ->union(SVK::Merge::Info->new ($prop->{local}))
+                    ->as_string
+                );
+	    },
+	};
+	$ticket_options{ticket} = $self->_get_new_ticket(
+            $self->merge_info_with_copy($src)->add_target($src)
+        );
+        $ticket_options{cb_merged} = sub {
+            my ($changes, $type, $ticket) = @_;
+            if (!$changes) { # rollback all ticket
+                my $func = "change_${type}_prop";
+                my $baton = $storage->open_root ($cb{cb_rev}->($cb{target}||''));
+                $storage->$func( $baton, 'svk:merge', undef );
+                return;
+            }
+            $self->print_new_ticket( $dstinfo, $ticket ) if !$self->{quiet} && !$self->{ticket_quiet};
+	};
+    } else {
+        $ticket_options{prop_resolver} = {
+            'svk:merge' => sub { return ('G', undef, 1) },
+        };
+    }
+
     my $meditor = SVK::Editor::Merge->new
 	( anchor => $src->path_anchor,
 	  repospath => $src->repospath, # for stupid copyfrom url
@@ -610,31 +642,7 @@
 	  resolve => $self->resolver,
 	  open_nonexist => $self->{track_rename},
 	  # XXX: make the prop resolver more pluggable
-	  $self->{ticket} ?
-	  ( prop_resolver => { 'svk:merge' =>
-			  sub { my ($path, $prop) = @_;
-				return (undef, undef, 1)
-				    if $path eq $target;
-				return ('G', SVK::Merge::Info->new
-					($prop->{new})->union
-					(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 ($changes, $type, $ticket) = @_;
-		if (!$changes) { # rollback all ticket
-		    my $func = "change_${type}_prop";
-		    my $baton = $storage->open_root ($cb{cb_rev}->($cb{target}||''));
-		    $storage->$func( $baton, 'svk:merge', undef );
-		    return;
-		}
-		$self->print_new_ticket( $dstinfo, $ticket ) unless $self->{quiet};
-	    }
-	  ) :
-	  ( prop_resolver => { 'svk:merge' => sub { ('G', undef, 1)} # skip
-			     }),
+          %ticket_options,
 	  %cb,
 	);
 


More information about the svk-commit mailing list