Update to allow specifying a single version to merge Use patchId to figure out if we need to record the merge or not
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4bd9a1dd Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4bd9a1dd Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4bd9a1dd Branch: refs/heads/2.6.x-fixes Commit: 4bd9a1dd9b332288b00de6c648d3f3433397b9fa Parents: 142d423 Author: Daniel Kulp <[email protected]> Authored: Thu Mar 20 13:05:42 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Thu Mar 20 16:45:47 2014 -0400 ---------------------------------------------------------------------- bin/DoMerges.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/4bd9a1dd/bin/DoMerges.java ---------------------------------------------------------------------- diff --git a/bin/DoMerges.java b/bin/DoMerges.java index 737cd3b..9109be4 100644 --- a/bin/DoMerges.java +++ b/bin/DoMerges.java @@ -304,6 +304,7 @@ public class DoMerges { p.waitFor(); return lines.toArray(new String[lines.size()]); } + private static void doMerge(String ver) throws Exception { Process p = Runtime.getRuntime().exec(getCommandLine(new String[] {"git", "cherry-pick", ver})); if (runProcess(p, false) != 0) { @@ -313,6 +314,12 @@ public class DoMerges { if (doCommit()) { records.add("M " + ver); } + } else { + String oldPatchId = getPatchId(ver); + String newPatchId = getPatchId("HEAD"); + if (!oldPatchId.equals(newPatchId)) { + records.add("M " + ver); + } } } private static void doMappedMerge(String ver) throws Exception { @@ -399,7 +406,7 @@ public class DoMerges { return line; } - public static void main (String a[]) throws Exception { + public static void main(String a[]) throws Exception { File file = new File(".git-commit-message.txt"); if (file.exists()) { //make sure we delete this to not cause confusion @@ -411,6 +418,7 @@ public class DoMerges { doUpdate(); List<String> args = new LinkedList<String>(Arrays.asList(a)); + List<String> check = new LinkedList<String>(); while (!args.isEmpty()) { String get = args.remove(0); @@ -420,11 +428,22 @@ public class DoMerges { username = getUserName(); } else if ("-user".equals(get)) { username = args.get(0); + } else { + check.add(get); } } List<String> verList = getAvailableUpdates(); + if (!check.isEmpty()) { + List<String> newList = new LinkedList<String>(); + for (String s : check) { + if (verList.contains(s)) { + newList.add(s); + } + } + verList = newList; + } if (verList.isEmpty()) { System.out.println("Nothing needs to be merged"); System.exit(0);
