protected void makeCombination(Map<IndexEntry, Revision> settings) { // Assume we are checked out String name = "combine-" + tid + "-" + (idx++); git.branch(name); git.checkout(name); String commit = "Hudson generated combination of:\n"; for (IndexEntry submodule : settings.keySet()) { Revision branch = settings.get(submodule); commit += " " + submodule.getFile() + " " + branch.toString() + "\n"; } listener.getLogger().print(commit); for (IndexEntry submodule : settings.keySet()) { Revision branch = settings.get(submodule); File subdir = new File(workspace, submodule.getFile()); IGitAPI subGit = new GitAPI(git.getGitExe(), new FilePath(subdir), listener, git.getEnvironment()); subGit.checkout(branch.sha1.name()); git.add(submodule.file); } git.commit(commit); }
protected void makeCombination(Map<IndexEntry, Revision> settings) { // Assume we are checked out String name = "combine-" + tid + "-" + (idx++); git.branch(name); git.checkout(name); StringBuilder commit = new StringBuilder("Jenkins generated combination of:\n"); for (Entry<IndexEntry, Revision> setting : settings.entrySet()) { commit.append(' ').append(' '); commit.append(setting.getKey().getFile()); commit.append(' '); commit.append(setting.getValue()); commit.append('\n'); } listener.getLogger().print(commit); for (Entry<IndexEntry, Revision> setting : settings.entrySet()) { IndexEntry submodule = setting.getKey(); Revision branch = setting.getValue(); File subdir = new File(workspace, submodule.getFile()); IGitAPI subGit = new GitAPI( git.getGitExe(), new FilePath(subdir), listener, git.getEnvironment(), git.getReference()); subGit.checkout(branch.sha1.name()); git.add(submodule.file); } try { File f = File.createTempFile("gitcommit", ".txt"); FileOutputStream fos = null; try { fos = new FileOutputStream(f); fos.write(commit.toString().getBytes()); } finally { if (fos != null) fos.close(); } git.commit(f); f.delete(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
protected void makeCombination(Map<IndexEntry, Revision> settings) { // Assume we are checked out String name = "combine-" + tid + "-" + (idx++); git.branch(name); git.checkout(name); String commit = "Hudson generated combination of:\n"; for (IndexEntry submodule : settings.keySet()) { Revision branch = settings.get(submodule); commit += " " + submodule.getFile() + " " + branch.toString() + "\n"; } listener.getLogger().print(commit); for (IndexEntry submodule : settings.keySet()) { Revision branch = settings.get(submodule); File subdir = new File(workspace, submodule.getFile()); IGitAPI subGit = new GitAPI(git.getGitExe(), new FilePath(subdir), listener, git.getEnvironment()); subGit.checkout(branch.sha1.name()); git.add(submodule.file); } try { File f = File.createTempFile("gitcommit", ".txt"); FileOutputStream fos = null; try { fos = new FileOutputStream(f); fos.write(commit.getBytes()); } finally { fos.close(); } git.commit(f); f.delete(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }