# # patch "contrib/monotone-import.pl" # from [572e9ae41a19d94af8597280549cdec95a989c8c] # to [b97f921ed2a341454d7fccd5d1f72ddec7b36244] # ======================================================================== --- contrib/monotone-import.pl 572e9ae41a19d94af8597280549cdec95a989c8c +++ contrib/monotone-import.pl b97f921ed2a341454d7fccd5d1f72ddec7b36244 @@ -32,7 +32,7 @@ use Pod::Usage; use File::Spec::Functions qw(:ALL); -my $VERSION = '0.5'; +my $VERSION = '0.6'; ###################################################################### # User options @@ -163,12 +163,25 @@ # Because monotone will complain and refuse to do anything if # a file is missing before it's dropped, we need to make sure # it's there long enough to be able to drop it. So, we "touch" - # the file. + # the file. Let's not forget to create intermediary directories + # if needed... + my @current_dir = ( File::Spec->curdir() ); + my @created_dirs = (); + map { + push @current_dir, $_; + my $d = File::Spec->catdir(@current_dir); + if (! -d $d) { + mkdir $d; + unshift @created_dirs, $d; + } + } File::Spec->splitdir(dirname($_)); open FILE, ">$_"; close FILE; # touch - my_system("monotone drop $_"); - my_system("monotone attr drop $_ execute"); + my_system("monotone drop \"$_\""); + my_system("monotone attr drop \"$_\" execute"); + unlink $_; + map { rmdir $_ } @created_dirs; } } my_backtick("monotone list missing\n"); @@ -176,7 +189,7 @@ # Figure out what files are new since the last import, and have them # explicitely added. # -my @new_files = map { chomp; my_system("monotone add $_"); $_ } +my @new_files = map { chomp; my_system("monotone add \"$_\""); $_ } my_backtick("monotone list unknown\n"); ###################################################################### @@ -193,7 +206,11 @@ # Commit and tag. # my_system("monotone commit --message=\"$user_message\""); -my_system("monotone tag \`cat MT/revision\` \"$user_tag\""); +open REV,"MT/revision"; +my $newrev = ; +chomp $newrev; +close REV; +my_system("monotone tag $newrev \"$user_tag\""); ###################################################################### # Tell the user what he can do with the import.