cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/4] git commit: Print all the possible matching commits at once and ask once instead of being asked a dozen times for things like "Fix Compile Failure" and other generic messages
Date Sun, 06 Apr 2014 01:39:11 GMT
Print all the possible matching commits at once and ask once instead of being asked a dozen
times for things like "Fix Compile Failure" and other generic messages


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0f212a36
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0f212a36
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0f212a36

Branch: refs/heads/2.7.x-fixes
Commit: 0f212a362a78e906dbeff18ca91c9182da0403ec
Parents: d010a12
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Apr 4 12:12:02 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Sat Apr 5 21:38:03 2014 -0400

----------------------------------------------------------------------
 bin/DoMerges.java | 57 ++++++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0f212a36/bin/DoMerges.java
----------------------------------------------------------------------
diff --git a/bin/DoMerges.java b/bin/DoMerges.java
index 17e5f97..f6fd9d0 100644
--- a/bin/DoMerges.java
+++ b/bin/DoMerges.java
@@ -546,14 +546,41 @@ public class DoMerges {
         if (gitLogs == null) {
             return false;
         }
+        List<List<String>> matchingLogs = new LinkedList<List<String>>();
         for (String[] f : gitLogs) {
-            if (compareLogs(f, logLines)) {
+            List<String> ll = compareLogs(f, logLines);
+            if (!ll.isEmpty()) {
+                matchingLogs.add(ll);
+            }
+        }
+        
+        if (!matchingLogs.isEmpty()) {
+            //everything in the source log is in a log on this branch, let's prompt to record
the merge
+            System.out.println("Found possible commit(s) already on branch:");
+            for (List<String> f : matchingLogs) {
+                for (String s : f) {
+                    System.out.println("    " + s);
+                }
+                System.out.println("------------------------");
+            }
+            
+            while (System.in.available() > 0) {
+                System.in.read();
+            }
+            char c = 0;
+            while (c != 'Y'
+                   && c != 'N') {
+                System.out.print("Record as merged [Y/N]? ");
+                int i = System.in.read();
+                c = Character.toUpperCase((char)i);
+            }
+            if (c == 'Y') {
                 return true;
             }
         }
         return false;
-    }
-    private static boolean compareLogs(String[] f, String[] logLines) throws IOException
{
+    }        
+    private static List<String> compareLogs(String[] f, String[] logLines) throws IOException
{
         ArrayList<String> onBranch = new ArrayList<String>(f.length);
         for (String s : f) {
             if (s.trim().startsWith("Conflicts:")) {
@@ -575,29 +602,9 @@ public class DoMerges {
                 ll.add(s);
             } 
         }
-        if (ll.isEmpty()) {
-            //everything in the source log is in a log on this branch, let's prompt to record
the merge
-            System.out.println("Found possible commit already on branch:");
-            for (String s : f) {
-                System.out.println(s);
-            }
-            
-            while (System.in.available() > 0) {
-                System.in.read();
-            }
-            char c = 0;
-            while (c != 'Y'
-                   && c != 'N') {
-                System.out.print("Record as merged [Y/N]? ");
-                int i = System.in.read();
-                c = Character.toUpperCase((char)i);
-            }
-            if (c == 'Y') {
-                return true;
-            }
-        }
-        return false;
+        return ll;
     }
+        
 
     private static String[] getCommandLine(String[] args) {
         List<String> argLine = new ArrayList<String>();


Mime
View raw message