--- svn_load_dirs.pl.in-trunk-r27105	2007-10-12 10:45:32.000000000 +0200
+++ svn_load_dirs.pl.in-MessageLog	2007-10-12 10:53:22.000000000 +0200
@@ -68,6 +68,9 @@
 # "global-ignores" option).
 my $opt_glob_ignores;
 
+# Message for commit.
+my $opt_ci_msg;
+
 # This is the character used to separate regular expressions occuring
 # in the tag directory path from the path itself.
 my $REGEX_SEP_CHAR = '@';
@@ -85,7 +88,8 @@
            'tag_location=s'          => \$opt_import_tag_location,
            'verbose+'                => \$opt_verbose,
            'wc=s'                    => \$opt_existing_wc_dir,
-           'glob_ignores=s'          => \$opt_glob_ignores)
+           'glob_ignores=s'          => \$opt_glob_ignores,
+           'msg=s'                   => \$opt_ci_msg)
   or &usage;
 &usage("$0: too few arguments") if @ARGV < 2;
 
@@ -458,9 +462,18 @@
       exit 0 unless &get_answer("You must add them now to load the " .
                                 "directories.  Continue (Y/n)? ", 'ny', 1);
 
-      my $message = "Create directories to load project into.\n\n";
+      my $message = "";
 
-      foreach my $dir (@dirs_to_create)
+      if (defined $opt_ci_msg)
+      {
+        # Use the commit message given by the user, if any.
+        $message = $opt_ci_msg . "\n\n";
+      }
+      else
+      {
+        $message = "Create directories to load project into.\n\n";
+
+        foreach my $dir (@dirs_to_create)
         {
           if (length $repos_base_path_segment)
             {
@@ -471,8 +484,8 @@
               $message .= "* $dir: New directory.\n";
             }
         }
-      $message = wrap('', '  ', $message);
-
+        $message = wrap('', '  ', $message);
+      }
       read_from_process($svn, 'mkdir', @svn_use_repos_cmd_opts,
                         '-m', $message, @urls_to_create);
     }
@@ -1254,7 +1267,16 @@
           }
       }
 
-    my $message = wrap('', '', "Load $load_dir into $repos_load_abs_path.\n");
+    my $message = "";
+    if (defined $opt_ci_msg)
+    {
+      # Use the commit message given by the user, if any.
+      $message = $opt_ci_msg . "\n\n";
+    }
+    else
+    {
+      $message = wrap('', '', "Load $load_dir into $repos_load_abs_path.\n");
+    }
     read_from_process($svn, 'commit',
                       @svn_use_repos_cmd_opts,
                       '-m', $message);
@@ -1284,10 +1306,20 @@
                        "$repos_base_url/$repos_load_rel_path";
         my $to_url   = "$repos_base_url/$load_tag";
 
-        $message     = wrap("",
-                            "",
-                            "Tag $repos_load_abs_path as " .
-                            "$repos_tag_abs_path.\n");
+        my $message = "";
+
+        if (defined $opt_ci_msg)
+        {
+          # Use the commit message given by the user, if any.
+          $message = $opt_ci_msg . "\n\n";
+        }
+        else
+        {
+          $message     = wrap("",
+                              "",
+                              "Tag $repos_load_abs_path as " .
+                              "$repos_tag_abs_path.\n");
+        }
         read_from_process($svn, 'cp', @svn_use_repos_cmd_opts,
                           '-m', $message, $from_url, $to_url);
 
@@ -1335,7 +1367,8 @@
       "  -wc path       use the already checked-out working copy at path\n",
       "                 instead of checkout out a fresh working copy\n",
       "  -glob_ignores  List of filename patterns to ignore (as in svn's\n",
-      "                 global-ignores config option)\n";
+      "                 global-ignores config option)\n",
+      "  -m \"msg\"       use this message at check-in time\n";
 }
 
 # Get the next directory to load, either from the command line or from
@@ -1679,20 +1712,28 @@
 
   my $number_renames    = @$renamed_filenames/2;
 
-  my $message = "To prepare to load $load_dir into $repos_load_abs_path, " .
-                "perform $number_renames rename" .
-                ($number_renames > 1 ? "s" : "") . ".\n";
-
-  # Text::Wrap::wrap appears to replace multiple consecutive \n's with
-  # one \n, so wrap the text and then append the second \n.
-  $message  = wrap("", "", $message) . "\n";
-  while (@$renamed_filenames)
-    {
-      my $from  = "$repos_load_abs_path/" . shift @$renamed_filenames;
-      my $to    = "$repos_load_abs_path/" . shift @$renamed_filenames;
-      $message .= wrap("", "  ", "* $to: Renamed from $from.\n");
-    }
-
+  my $message = "";
+  if (defined $opt_ci_msg)
+  {
+    # Use the commit message given by the user, if any.
+    $message = $opt_ci_msg . "\n\n";
+  }
+  else
+  {
+    $message = "To prepare to load $load_dir into $repos_load_abs_path, " .
+                 "perform $number_renames rename" .
+                 ($number_renames > 1 ? "s" : "") . ".\n";
+
+    # Text::Wrap::wrap appears to replace multiple consecutive \n's with
+    # one \n, so wrap the text and then append the second \n.
+    $message  = wrap("", "", $message) . "\n";
+    while (@$renamed_filenames)
+      {
+        my $from  = "$repos_load_abs_path/" . shift @$renamed_filenames;
+        my $to    = "$repos_load_abs_path/" . shift @$renamed_filenames;
+        $message .= wrap("", "  ", "* $to: Renamed from $from.\n");
+      }
+  }
   # Change to the top of the working copy so that any
   # directories will also be updated.
   my $cwd = cwd;
