public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for (String path : item.e.getAffectedPaths()) buf.append(path).append('\n'); return buf.toString(); }
for (Entry e : cs) { stdout.printf("%s\t%s%n", e.getAuthor(), e.getMsg()); for (String p : e.getAffectedPaths()) { stdout.println(" " + p);
public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for(String path : item.e.getAffectedPaths()) buf.append(path).append('\n'); return buf.toString(); }
ChangeLogSet<Entry> cls = build.getChangeSet(); for (Entry e : cls) { Collection<String> paths = e.getAffectedPaths(); if (paths.contains("/z/q")) ignored = false;
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public ChangeLog convertTo(ChangeLogSet source, ChangeLog destination) { ChangeLog changeLog = new ChangeLog(); for (hudson.scm.ChangeLogSet.Entry entry : (ChangeLogSet<? extends hudson.scm.ChangeLogSet.Entry>) source) { final Entry newEntry = new Entry(entry.getAuthor().getFullName(), entry.getMsg()); try { // Lets try to convert the affected files for (hudson.scm.ChangeLogSet.AffectedFile file : entry.getAffectedFiles()) { newEntry.getAffectedFiles().add(new AffectedFile(file.getPath(), convertChangeType(file.getEditType()))); } } catch (Exception e) { // Oke this ChangeLogSet entry doesn't implement the affected files method. Default to the affected // paths implementation for (String path : entry.getAffectedPaths()) { newEntry.getAffectedFiles().add(new AffectedFile(path, ChangeType.UNKNOWN)); } } changeLog.add(newEntry); } return changeLog; }
@Bug(6517) @Test public void fileListOmittedForMerges() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), null, null, null, null, false)); m.hg(repo, "init"); m.touchAndCommit(repo, "f1"); p.scheduleBuild2(0).get(); m.hg(repo, "up", "null"); m.touchAndCommit(repo, "f2"); m.hg(repo, "merge"); m.hg(repo, "commit", "--message", "merge"); Iterator<? extends ChangeLogSet.Entry> it = p.scheduleBuild2(0).get() .getChangeSet().iterator(); assertTrue(it.hasNext()); ChangeLogSet.Entry entry = it.next(); assertTrue(((MercurialChangeSet) entry).isMerge()); assertEquals(Collections.emptySet(), new HashSet<String>(entry.getAffectedPaths())); assertTrue(it.hasNext()); entry = it.next(); assertFalse(((MercurialChangeSet) entry).isMerge()); assertEquals(Collections.singleton("f2"), new HashSet<String>(entry.getAffectedPaths())); assertFalse(it.hasNext()); }
public ChangeEntryDTO convert(final ChangeLogSet.Entry source) { assert source != null; log.trace("Converting: {}", source); ChangeEntryDTO target = new ChangeEntryDTO(); // TODO: See if we need to pass both raw and annotated messages back? // target.setMessage(source.getMsg()); // FIXME: need to html-decode? target.setMessage(source.getMsgAnnotated()); target.setAuthor(userx.convert(source.getAuthor())); for (String path : source.getAffectedPaths()) { target.getPaths().add(path); } try { for (ChangeLogSet.AffectedFile file : source.getAffectedFiles()) { target.getFiles().add(convert(file)); } } catch (UnsupportedOperationException e) { // scm does not support getAffectedFiles() } return target; }
@Bug(3602) @Test public void subdirectoryCheckout() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), null, null, "repo", null, false)); m.hg(repo, "init"); m.touchAndCommit(repo, "f1"); m.buildAndCheck(p, "repo/f1"); m.touchAndCommit(repo, "f2"); m.buildAndCheck(p, "repo/f2"); m.touchAndCommit(repo, "f3"); Iterator<? extends ChangeLogSet.Entry> it = p.scheduleBuild2(0).get() .getChangeSet().iterator(); assertTrue(it.hasNext()); ChangeLogSet.Entry entry = it.next(); assertEquals(Collections.singleton("f3"), new HashSet<String>(entry.getAffectedPaths())); assertFalse(it.hasNext()); }
protected void appendAffectedFilesToDescription(Entry change, StringBuilder description) { // see http://issues.jenkins-ci.org/browse/JENKINS-2508 // added additional try .. catch; getAffectedFiles is not supported // by all SCM implementations try { for (AffectedFile affectedFile : change.getAffectedFiles()) { description.append("* "); if(affectedFile.getEditType() != null) description.append("(").append(affectedFile.getEditType().getName()).append(") "); if(affectedFile.getPath() != null) description.append(affectedFile.getPath()); description.append("\n"); } } catch (UnsupportedOperationException e) { LOGGER.warning("Unsupported SCM operation 'getAffectedFiles'. Fall back to getAffectedPaths."); for (String affectedPath : change.getAffectedPaths()) { description.append("* ").append(affectedPath).append("\n"); } } }
public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for(String path : item.e.getAffectedPaths()) buf.append(path).append('\n'); return buf.toString(); }
/** * Does this change happen somewhere in the given module or its * descendants? */ private boolean isDescendantOf(ChangeLogSet.Entry e, IvyModule mod) { for (String path : e.getAffectedPaths()) if (path.startsWith(mod.getRelativePathToModuleRoot())) return true; return false; } };
/** * Does this change happen somewhere in the given module or its * descendants? */ private boolean isDescendantOf(ChangeLogSet.Entry e, IvyModule mod) { for (String path : e.getAffectedPaths()) if (path != null && path.startsWith(mod.getRelativePathToModuleRoot())) return true; return false; } };
/** * Does this change happen somewhere in the given module or its * descendants? */ private boolean isDescendantOf(ChangeLogSet.Entry e, IvyModule mod) { for (String path : e.getAffectedPaths()) if (path.startsWith(mod.getRelativePathToModuleRoot())) return true; return false; } };
public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for (String path : item.e.getAffectedPaths()) { buf.append(path).append('\n'); } return buf.toString(); }
public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for (String path : item.e.getAffectedPaths()) buf.append(path).append('\n'); return buf.toString(); }
public String getEntryDescription(FeedItem item) { StringBuilder buf = new StringBuilder(); for (String path : item.e.getAffectedPaths()) { buf.append(path).append('\n'); } return buf.toString(); }
private List<String> getChangeSet() { final ArrayList<String> changeSet = new ArrayList<>(); for (final ChangeLogSet.Entry change : this.build.getChangeSet()) { changeSet.addAll(change.getAffectedPaths()); } return changeSet; } }
private boolean notInSubsidiary(List<MavenModule> subsidiaries, ChangeLogSet.Entry e) { for (String path : e.getAffectedPaths()) if(!belongsToSubsidiary(subsidiaries, path)) return true; return false; }
/** * Does this change happen somewhere in the given module or its descendants? */ private boolean isDescendantOf(ChangeLogSet.Entry e, MavenModule mod) { for (String path : e.getAffectedPaths()) { if (FilenameUtils.separatorsToUnix(path).startsWith(FilenameUtils.normalize(mod.getRelativePath()))) return true; } return false; } };
private void assertChangeSetPaths(List<? extends Set<String>> expectedChangeSetPaths, AbstractBuild<?, ?> build) throws IOException { ChangeLogSet<? extends Entry> actualChangeLogSet = build.getChangeSet(); List<Set<String>> actualChangeSetPaths = new LinkedList<Set<String>>(); for (Entry entry : actualChangeLogSet) { actualChangeSetPaths.add(new LinkedHashSet<String>(entry .getAffectedPaths())); } assertEquals(build.getLog(99).toString(), expectedChangeSetPaths, actualChangeSetPaths); }