[svk-commit] r2971 - trunk/lib/SVK/Command

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


Author: ruz
Date: Sun Jul  6 04:19:19 2008
New Revision: 2971

Modified:
   trunk/lib/SVK/Command/Update.pm

Log:
* add custom svk:merge property resolver for update command and commands
  based on it, like switch.

Modified: trunk/lib/SVK/Command/Update.pm
==============================================================================
--- trunk/lib/SVK/Command/Update.pm	(original)
+++ trunk/lib/SVK/Command/Update.pm	Sun Jul  6 04:19:19 2008
@@ -198,7 +198,8 @@
 	 no_recurse => !$self->{recursive}, notify => $notify, nodelay => 1,
 	 src => $update_target, dst => $cotarget, check_only => $self->{check_only},
 	 auto => 1, # not to print track-rename hint
-	 xd => $self->{xd});
+	 xd => $self->{xd},
+    );
     my ($editor, $inspector, %cb) = $cotarget->get_editor
 	( ignore_checksum => 1,
 	  check_only => $self->{check_only},
@@ -207,6 +208,14 @@
 	  newroot => $newroot,
 	  revision => $content_revision,
 	);
+    $cb{'prop_resolver'}{'svk:merge'} = sub {
+        my ($path, $prop) = @_;
+        my %info;
+        $info{$_} = SVK::Merge::Info->new($prop->{$_}) foreach (qw(base local new));
+        return ('G', undef, 1) if $info{local}->is_equal($info{base});
+        return ('g', $info{new}->as_string) if $info{local}->is_equal($info{new});
+        return ('G', $info{new}->union($info{local})->as_string);
+    };
     $merge->run($editor, %cb, inspector => $inspector);
 
     if ($update_target->isa('SVK::Path::View')) {


More information about the svk-commit mailing list