cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1178489 - in /cxf/branches/2.4.x-fixes: ./ bin/DoMerges.java
Date Mon, 03 Oct 2011 18:14:45 GMT
Author: dkulp
Date: Mon Oct  3 18:14:44 2011
New Revision: 1178489

URL: http://svn.apache.org/viewvc?rev=1178489&view=rev
Log:
Merged revisions 1178484 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1178484 | dkulp | 2011-10-03 14:11:12 -0400 (Mon, 03 Oct 2011) | 1 line
  
  Don't repeat jira numbers.
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/bin/DoMerges.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/bin/DoMerges.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/bin/DoMerges.java?rev=1178489&r1=1178488&r2=1178489&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/bin/DoMerges.java (original)
+++ cxf/branches/2.4.x-fixes/bin/DoMerges.java Mon Oct  3 18:14:44 2011
@@ -16,9 +16,10 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
+import java.io.*;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 
 /* dkulp - Stupid little program I use to help merge changes from 
@@ -59,6 +60,9 @@ import java.util.*;
    won't go through the blocked/recorded items again.  (Flushes occur
    automatically when DoMerges is finished running.)
 
+   [C]hanges will display the changes in the commit to help you decide the 
+   appropriate action to take.
+
 */
 
 public class DoMerges {
@@ -130,6 +134,95 @@ public class DoMerges {
             System.exit(1);
         }
     }   
+    public static void changes(String ver, String root) throws Exception {
+        Process p;
+        BufferedReader reader;
+        String line;
+
+        p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svn", "diff", "-c", ver,
root}));
+        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);
+        }
+    }
+
+    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])) { 
@@ -174,8 +267,6 @@ public class DoMerges {
         System.out.println("Merging versions (" + verList.size() + "): " + verList);
 
 
-
-
         String root = null;
 
         p = Runtime.getRuntime().exec(new String[] {"svn", "info"});
@@ -192,18 +283,35 @@ public class DoMerges {
 
         List<String> blocks = new ArrayList<String>();
         List<String> records = new ArrayList<String>();
+        Set<String> jiras = new TreeSet<String>();
+        Pattern jiraPattern = Pattern.compile("([A-Z]{2,10}+-\\d+)");
+
+        for (int cur = 0; cur < verList.size(); cur++) {
+            jiras.clear();
+            String ver = verList.get(cur);
+            System.out.println("Merging: " + ver + " (" + (cur + 1) + "/" + verList.size()
+ ")");
+            System.out.println("http://svn.apache.org/viewvc?view=revision&revision="
+ ver);
 
-        int count = 1;
-        for (String ver : verList) {
-            System.out.println("Merging: " + ver + " (" + (count++) + "/" + verList.size()
+ ")");
             p = Runtime.getRuntime().exec(new String[] {"svn", "log", "-r" , ver, root});
             reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
             line = reader.readLine();
+            StringWriter swriter = new StringWriter();
+            BufferedWriter writer = new BufferedWriter(swriter);
             while (line != null) {
-                System.out.println(line);
+                writer.write(line);
+                writer.newLine();
+                Matcher m = jiraPattern.matcher(line);
+                while (m.find()) {
+                    jiras.add(m.group());
+                }
                 line = reader.readLine();
             }
             p.waitFor();
+            writer.flush();
+            for (String s : jiras) {
+                System.out.println("https://issues.apache.org/jira/browse/" + s);
+            }
+            System.out.println(swriter.toString());
 
             while (System.in.available() > 0) {
                 System.in.read();
@@ -212,8 +320,10 @@ 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'
+                   && c != 'C') {
+                System.out.print("[M]erge, [B]lock, or [I]gnore, [R]ecord only, [F]lush,
[C]hanges? ");
                 int i = System.in.read();
                 c = Character.toUpperCase((char)i);
             }
@@ -246,68 +356,20 @@ public class DoMerges {
             case 'R':
                 records.add(ver);
                 break;
+            case 'F':
+                flush(blocks, records);
+                cur--;
+                break;
+            case 'C':
+                changes(ver, root);
+                cur--;
+                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