cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1143492 - /cxf/trunk/bin/DoMerges.java
Date Wed, 06 Jul 2011 16:37:43 GMT
Author: dkulp
Date: Wed Jul  6 16:37:43 2011
New Revision: 1143492

URL: http://svn.apache.org/viewvc?rev=1143492&view=rev
Log:
Add a "Flush" option to my script to make  it so I can flush out the
blocks/records periodically if I have to.

Modified:
    cxf/trunk/bin/DoMerges.java

Modified: cxf/trunk/bin/DoMerges.java
URL: http://svn.apache.org/viewvc/cxf/trunk/bin/DoMerges.java?rev=1143492&r1=1143491&r2=1143492&view=diff
==============================================================================
--- cxf/trunk/bin/DoMerges.java (original)
+++ cxf/trunk/bin/DoMerges.java Wed Jul  6 16:37:43 2011
@@ -111,6 +111,72 @@ public class DoMerges {
         }
     }   
 
+    public static void flush(List<String> blocks, List<String> records) throws
Exception {
+        Process p;
+        BufferedReader reader;
+        String line;
+
+        if (!records.isEmpty()) {
+            StringBuilder ver = new StringBuilder();
+            for (String s : records) {
+                if (ver.length() > 0) {
+                    ver.append(',');
+                }
+                ver.append(s);
+            }
+            System.out.println("Recording " + ver);
+            p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svnmerge.py", "merge",
"--record-only", "-r", ver.toString()}));
+            reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+            line = reader.readLine();
+            while (line != null) {
+                System.out.println(line);
+                line = reader.readLine();
+            }
+            if (p.waitFor() != 0) {
+                System.out.println("ERROR!");
+                reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+                line = reader.readLine();
+                while (line != null) {
+                    System.out.println(line);
+                    line = reader.readLine();
+                }
+                System.exit(1);
+            }
+            doCommit();
+        }
+
+        if (!blocks.isEmpty()) {
+            StringBuilder ver = new StringBuilder();
+            for (String s : blocks) {
+                if (ver.length() > 0) {
+                    ver.append(',');
+                }
+                ver.append(s);
+            }
+            System.out.println("Blocking " + ver);
+            p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svnmerge.py", "block",
"-r", ver.toString()}));
+            reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+            line = reader.readLine();
+            while (line != null) {
+                System.out.println(line);
+                line = reader.readLine();
+            }
+            if (p.waitFor() != 0) {
+                System.out.println("ERROR!");
+                reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+                line = reader.readLine();
+                while (line != null) {
+                    System.out.println(line);
+                    line = reader.readLine();
+                }
+                System.exit(1);
+            }
+            doCommit();
+        }
+        blocks.clear();
+        records.clear();
+    }
+
     public static void main (String args[]) throws Exception {
         if (args.length > 0 && "-auto".equals(args[0])) { 
             auto = true;
@@ -155,7 +221,6 @@ public class DoMerges {
 
 
 
-
         String root = null;
 
         p = Runtime.getRuntime().exec(new String[] {"svn", "info"});
@@ -192,8 +257,9 @@ public class DoMerges {
             while (c != 'M'
                    && c != 'B'
                    && c != 'I'
-                   && c != 'R') {
-                System.out.print("[M]erge, [B]lock, or [I]gnore, [R]ecord only? ");
+                   && c != 'R'
+                   && c != 'F') {
+                System.out.print("[M]erge, [B]lock, or [I]gnore, [R]ecord only, [F]lush?
");
                 int i = System.in.read();
                 c = Character.toUpperCase((char)i);
             }
@@ -226,68 +292,15 @@ public class DoMerges {
             case 'R':
                 records.add(ver);
                 break;
+            case 'F':
+                flush(blocks, records);
+                break;
             case 'I':
                 System.out.println("Ignoring");
                 break;
             }
         }
-        if (!records.isEmpty()) {
-            StringBuilder ver = new StringBuilder();
-            for (String s : records) {
-                if (ver.length() > 0) {
-                    ver.append(',');
-                }
-                ver.append(s);
-            }
-            System.out.println("Recording " + ver);
-            p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svnmerge.py", "merge",
"--record-only", "-r", ver.toString()}));
-            reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
-            line = reader.readLine();
-            while (line != null) {
-                System.out.println(line);
-                line = reader.readLine();
-            }
-            if (p.waitFor() != 0) {
-                System.out.println("ERROR!");
-                reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-                line = reader.readLine();
-                while (line != null) {
-                    System.out.println(line);
-                    line = reader.readLine();
-                }
-                System.exit(1);
-            }
-            doCommit();
-        }
-
-        if (!blocks.isEmpty()) {
-            StringBuilder ver = new StringBuilder();
-            for (String s : blocks) {
-                if (ver.length() > 0) {
-                    ver.append(',');
-                }
-                ver.append(s);
-            }
-            System.out.println("Blocking " + ver);
-            p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svnmerge.py", "block",
"-r", ver.toString()}));
-            reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
-            line = reader.readLine();
-            while (line != null) {
-                System.out.println(line);
-                line = reader.readLine();
-            }
-            if (p.waitFor() != 0) {
-                System.out.println("ERROR!");
-                reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-                line = reader.readLine();
-                while (line != null) {
-                    System.out.println(line);
-                    line = reader.readLine();
-                }
-                System.exit(1);
-            }
-            doCommit();
-        }
+        flush(blocks, records);
     }
 
     private static String[] getCommandLine(String[] args) {



Mime
View raw message