continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r593106 - /maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
Date Thu, 08 Nov 2007 09:56:19 GMT
Author: evenisse
Date: Thu Nov  8 01:56:18 2007
New Revision: 593106

URL: http://svn.apache.org/viewvc?rev=593106&view=rev
Log:
Add overrite parameter

Modified:
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java?rev=593106&r1=593105&r2=593106&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
Thu Nov  8 01:56:18 2007
@@ -128,6 +128,15 @@
         {
             out = new File( "backup/builds.xml" );
         }
+        out.getParentFile().mkdirs();
+
+        if ( !command.overwrite && out.exists() )
+        {
+            System.err.println( out.getAbsolutePath() +
+                " already exists and will not be overwritten unless the -overwrite flag is
used." );
+            Args.usage( command );
+            return;
+        }
 
         writer = new PrintWriter( new FileWriter( out ) );
 
@@ -174,6 +183,11 @@
         private File outputFile;
 
         @Argument(
+            description = "Whether to overwrite the designated backup file if it already
exists in export mode. Default is false.",
+            value = "overwrite")
+        private boolean overwrite;
+
+        @Argument(
             description = "Turn on debugging information. Default is off.",
             value = "debug")
         private boolean debug;
@@ -435,10 +449,6 @@
                     endTag( f.getName(), false );
                 }
             }
-            /*else if ( BuildDefinition.class.getName().equals( f.getType().getName() ) )
-            {
-                backupBuildDefinition( (BuildDefinition) f.get( obj ) );
-            }*/
             else if ( ScmResult.class.getName().equals( f.getType().getName() ) )
             {
                 writeScmResult( (ScmResult) f.get( obj ) );
@@ -447,17 +457,14 @@
             {
                 writeObject( f.get( obj ), "changeFile", true );
             }
-            /*else if ( Schedule.class.getName().equals( f.getType().getName() ) )
-            {
-                writeObject( f.get( obj ), "schedule", true );
-            }*/
             else if ( Profile.class.getName().equals( f.getType().getName() ) )
             {
                 writeProfile( (Profile) f.get( obj ) );
             }
             else
             {
-                writer.println( "Rejected: (" + f.getName() + ") " + f.getType() );
+                LOGGER.debug(
+                    "Rejected: (" + f.getName() + ") " + f.getType() + " in object " + obj.getClass().getName()
);
             }
         }
     }



Mime
View raw message