[svk-commit] r2739 - branches/path-resolver/lib/SVK/Editor

nobody at bestpractical.com nobody at bestpractical.com
Sat Apr 19 06:45:13 EDT 2008


Author: ruz
Date: Sat Apr 19 06:45:10 2008
New Revision: 2739

Modified:
   branches/path-resolver/lib/SVK/Editor/Merge.pm

Log:
* add pseudo-code for 'add file back' action

Modified: branches/path-resolver/lib/SVK/Editor/Merge.pm
==============================================================================
--- branches/path-resolver/lib/SVK/Editor/Merge.pm	(original)
+++ branches/path-resolver/lib/SVK/Editor/Merge.pm	Sat Apr 19 06:45:10 2008
@@ -255,9 +255,36 @@
 sub add_file {
     my ($self, $path, $pdir, @arg) = @_;
     unless ( defined $pdir ) {
-        ++$self->{skipped};
-        $self->{notify}->flush ($path);
-        return undef;
+#        my $action = get_prompt(
+#            "Parent dir of file $path doesn't exist, what do you want to do?\n"
+#            "a)dd, s)kip", qr/^[as]/i
+#        );
+        my $action = 'a';
+        if ( $action eq 's' ) {
+            ++$self->{skipped};
+            $self->{notify}->flush ($path);
+            return undef;
+        }
+        elsif ( $action eq 'a' ) {
+            my $bite_me;
+            $logger->error("here we are with $path");
+
+            #dirty hacks and most probably stupid thing
+            my @dirs = split m{/}, $path; pop @dirs;
+            my @to_add;
+            while ( @dirs && !defined $self->{'storage_baton'}{ join '/', @dirs } ) {
+                unshift @to_add, pop @dirs;
+            }
+            while ( @to_add ) {
+                my $cur = shift @to_add;
+                $self->add_directory( join('/', @dirs, $cur), join('/', @dirs), undef, $arg[-1] );
+                push @dirs, $cur;
+            }
+            return $self->add_file( $path, join('/', @dirs), @arg);
+        }
+        else {
+            die "no such action";
+        }
     }
     return unless defined $pdir;
     my $pool = pop @arg;


More information about the svk-commit mailing list