Author: dkulp
Date: Thu Feb 16 16:52:13 2012
New Revision: 1245075
URL: http://svn.apache.org/viewvc?rev=1245075&view=rev
Log:
Update to use int for versions and also not do the svn checkout to
record properties if nothing needs to change.
Modified:
cxf/trunk/bin/DoMerges.java
Modified: cxf/trunk/bin/DoMerges.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/bin/DoMerges.java?rev=1245075&r1=1245074&r2=1245075&view=diff
==============================================================================
--- cxf/trunk/bin/DoMerges.java (original)
+++ cxf/trunk/bin/DoMerges.java Thu Feb 16 16:52:13 2012
@@ -141,6 +141,10 @@ public class DoMerges {
static class Range implements Comparable<Range> {
int min, max;
+ public Range(int s) {
+ min = s;
+ max = s;
+ }
public Range(String s) {
int idx = s.indexOf('-');
if (idx == -1) {
@@ -302,10 +306,8 @@ public class DoMerges {
p.waitFor();
}
}
- static void doCommit() throws Exception {
- doCommit(null, null);
- }
- static boolean doCommit(String ver, String log) throws Exception {
+
+ static boolean doCommit(int ver, String log) throws Exception {
while (System.in.available() > 0) {
System.in.read();
}
@@ -371,7 +373,7 @@ public class DoMerges {
return file;
}
- private static File createLog(String ver, String log) throws Exception {
+ private static File createLog(int ver, String log) throws Exception {
File file = File.createTempFile("domerge", ".log");
file.deleteOnExit();
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
@@ -401,18 +403,18 @@ public class DoMerges {
return file;
}
- public static void changes(String ver) throws Exception {
+ public static void changes(int ver) throws Exception {
Process p;
if (isGit) {
String id = getGitVersion(ver);
p = Runtime.getRuntime().exec(getCommandLine(new String[] {"git",
"diff", id + "^", id, gitSource}));
} else {
- p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svn",
"diff", "-c", ver, svnRoot}));
+ p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svn",
"diff", "-c", Integer.toString(ver), svnRoot}));
}
runProcess(p);
}
- private static String getGitVersion(String ver) throws Exception {
+ private static String getGitVersion(int ver) throws Exception {
Process p;
BufferedReader reader;
String line;
@@ -451,19 +453,21 @@ public class DoMerges {
}
waitFor(p);
- checkout = File.createTempFile("gitsvn", ".co");
- checkout.delete();
- final File deleteDir = checkout;
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- deleteDirectory(deleteDir);
- }
+ if (!records.isEmpty() || !blocks.isEmpty()) {
+ checkout = File.createTempFile("gitsvn", ".co");
+ checkout.delete();
+ final File deleteDir = checkout;
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
+ deleteDirectory(deleteDir);
+ }
+
+ });
- });
-
- p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svn",
"co", "--depth", "empty",
-
svnDest, checkout.toString()}));
- runProcess(p);
+ p = Runtime.getRuntime().exec(getCommandLine(new String[]
{"svn", "co", "--depth", "empty",
+
svnDest, checkout.toString()}));
+ runProcess(p);
+ }
}
if (!records.isEmpty()) {
@@ -528,8 +532,8 @@ public class DoMerges {
}
}
- public static Set<String> getAvailableUpdates() throws Exception {
- Set<String> verList = new LinkedHashSet<String>();
+ public static Set<Integer> getAvailableUpdates() throws Exception {
+ Set<Integer> verList = new TreeSet<Integer>();
Process p;
BufferedReader reader;
String line;
@@ -554,7 +558,7 @@ public class DoMerges {
line = line.substring(0, line.indexOf('
')).substring(1).trim();
int ver = Integer.parseInt(line);
if (!merged.isInRange(ver) && !blocked.isInRange(ver)) {
- verList.add(line);
+ verList.add(ver);
}
}
line = reader.readLine();
@@ -565,14 +569,14 @@ public class DoMerges {
- public static String getLog(String ver, Set<String> jiras) throws
Exception {
+ public static String getLog(Integer ver, Set<String> jiras) throws
Exception {
Process p;
BufferedReader reader;
String line;
if (isGit) {
- p = Runtime.getRuntime().exec(new String[] {"git", "svn", "log",
"-r" , ver, gitSource});
+ p = Runtime.getRuntime().exec(new String[] {"git", "svn", "log",
"-r" , ver.toString(), gitSource});
} else {
- p = Runtime.getRuntime().exec(new String[] {"svn", "log", "-r" ,
ver, svnRoot});
+ p = Runtime.getRuntime().exec(new String[] {"svn", "log", "-r" ,
ver.toString(), svnRoot});
}
reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
line = reader.readLine();
@@ -592,7 +596,7 @@ public class DoMerges {
return swriter.toString();
}
- private static void doMerge(String ver, String log, List<VerLog> records)
throws Exception {
+ private static void doMerge(int ver, String log, List<VerLog> records)
throws Exception {
Process p;
if (isGit) {
@@ -602,7 +606,7 @@ public class DoMerges {
id}));
} else {
p = Runtime.getRuntime().exec(getCommandLine(new String[] {"svn",
"merge", "--non-interactive",
- "-c",
ver, svnSource}));
+ "-c",
Integer.toString(ver), svnSource}));
}
runProcess(p);
@@ -630,10 +634,10 @@ public class DoMerges {
}
static class VerLog {
- String ver;
+ int ver;
String log;
- public VerLog(String v, String l) {
+ public VerLog(int v, String l) {
ver = v;
log = l;
}
@@ -653,7 +657,7 @@ public class DoMerges {
doUpdate();
initSvnInfo();
- Set<String> verList = getAvailableUpdates();
+ Set<Integer> verList = getAvailableUpdates();
System.out.println("Merging versions (" + verList.size() + "): " +
verList);
@@ -663,7 +667,7 @@ public class DoMerges {
Set<String> jiras = new TreeSet<String>();
int cur = 0;
- for (String ver : verList) {
+ for (Integer ver : verList) {
cur++;
jiras.clear();
System.out.println("Merging: " + ver + " (" + cur + "/" +
verList.size() + ")");