@Override public URL getChangeSetLink(GitChangeSet changeSet) throws IOException { return new URL(url, "diff?rev=" + changeSet.getId().toString()); }
private GitChangeSet parseCommit(List<String> lines, boolean authorOrCommitter) { return new GitChangeSet(lines, authorOrCommitter); }
@Override @SuppressFBWarnings(value="NP_BOOLEAN_RETURN_NULL", justification="null used to indicate other extensions should decide") @CheckForNull public Boolean isRevExcluded(GitSCM scm, GitClient git, GitChangeSet commit, TaskListener listener, BuildData buildData) { String author = commit.getAuthorName(); if (getExcludedUsersNormalized().contains(author)) { // If the author is an excluded user, don't count this entry as a change listener.getLogger().println("Ignored commit " + commit.getCommitId() + ": Found excluded author: " + author); return true; } return null; }
@Override @SuppressFBWarnings(value="NP_BOOLEAN_RETURN_NULL", justification="null used to indicate other extensions should decide") @CheckForNull public Boolean isRevExcluded(GitSCM scm, GitClient git, GitChangeSet commit, TaskListener listener, BuildData buildData) throws IOException, InterruptedException, GitException { if (excludedPattern == null){ excludedPattern = Pattern.compile(excludedMessage); } String msg = commit.getComment(); if (excludedPattern.matcher(msg).matches()){ listener.getLogger().println("Ignored commit " + commit.getId() + ": Found excluded message: " + msg); return true; } return null; }
@Override public URL getDiffLink(Path path) throws IOException { URL url = getUrl(); return new URL(url, String.format(url.getPath() + "blobdiff?r=%s&h=%s&hb=%s", encodeString(projectName), path.getChangeSet().getId(), path.getChangeSet().getParentCommit())); }
GitChangeSet change = new GitChangeSet(revShow, authorOrCommitter); String author = change.getAuthorName(); if (excludedUsers.contains(author)) { List<String> paths = new ArrayList<String>(change.getAffectedPaths()); if (paths.isEmpty()) {
static List<Change> getChangesFromGit(GitClient cli, FilePath workspace, String relativeTargetDirectory, String remoteDebian, PersonIdent account) throws InterruptedException { String changelogPath = remoteDebian + "/changelog"; LinkedList<Change> changesSinceLastChangelogModification = new LinkedList<Change>(); LinkedList<Change> changesSinceLastChangelogModificationByPlugin = new LinkedList<Change>(); boolean firstChangelogModificationFound = false; for (ObjectId rev : cli.revListAll()) { List<String> lines = cli.showRevision(rev); GitChangeSet changeSet = new GitChangeSet(lines, true); String email = getAuthorEmailFromGitRevision(lines); Change change = new Change(changeSet.getAuthorName(), changeSet.getMsg()); for (GitChangeSet.Path path : changeSet.getPaths()) { String filePath = workspace.child(relativeTargetDirectory).child(path.getPath()).getRemote(); if (filePath.equals(changelogPath)) { if (changeSet.getAuthorName().equals(account.getName()) & email.equals(account.getEmailAddress())) { return changesSinceLastChangelogModificationByPlugin; } else { firstChangelogModificationFound = true; } } } if (!firstChangelogModificationFound) { changesSinceLastChangelogModification.addFirst(change); } changesSinceLastChangelogModificationByPlugin.addFirst(change); } return changesSinceLastChangelogModification; }
/** * {@inheritDoc} */ @Override public URL getDiffLink(Path path) throws IOException { if (path.getEditType() != EditType.EDIT || path.getSrc() == null || path.getDst() == null || path.getChangeSet().getParentCommit() == null) { return null; } return diffLink(path); }
/** * Gets {@linkplain #getComment() the comment} fully marked up by {@link ChangeLogAnnotator}. */ public String getCommentAnnotated() { MarkupText markup = new MarkupText(getComment()); for (ChangeLogAnnotator a : ChangeLogAnnotator.all()) { a.annotate(getParent().build, this, markup); } return markup.toString(false); }
/** * {@inheritDoc} */ public String getUser() { return getAuthorName(); }
/*package*/ GitChangeSetList(AbstractBuild build, List<GitChangeSet> logs) { super(build); Collections.reverse(logs); // put new things first this.changeSets = Collections.unmodifiableList(logs); for (GitChangeSet log : logs) { log.setParent(this); } }
public GitChangeSet(List<String> lines, boolean authorOrCommitter) { this.authorOrCommitter = authorOrCommitter; if (lines.size() > 0) { parseCommit(lines); } }
/** * Return a diff link regardless of the edit type by appending the index of the pathname in the changeset. * * @param path * @return * @throws IOException */ private URL getDiffLinkRegardlessOfEditType(Path path) throws IOException { final GitChangeSet changeSet = path.getChangeSet(); final ArrayList<String> affectedPaths = new ArrayList<String>(changeSet.getAffectedPaths()); // Github seems to sort the output alphabetically by the path. Collections.sort(affectedPaths); final String pathAsString = path.getPath(); final int i = Collections.binarySearch(affectedPaths, pathAsString); assert i >= 0; return new URL(getChangeSetLink(changeSet), "#diff-" + String.valueOf(i)); }
@CheckForNull public Boolean isRevExcluded(GitSCM scm, GitClient git, GitChangeSet commit, TaskListener listener, BuildData buildData) { Collection<String> paths = commit.getAffectedPaths(); if (paths.isEmpty()) {// nothing modified, so no need to compute any of this return null; listener.getLogger().println("Ignored commit " + commit.getCommitId() + ": No paths matched included region whitelist"); return true; } else if (includedPaths.size() == excludedPaths.size()) { listener.getLogger().println("Ignored commit " + commit.getCommitId() + ": Found only excluded paths: " + Util.join(excludedPaths, ", "));
this.committer = committerMatcher.group(1).trim(); this.committerEmail = committerMatcher.group(2); this.committerTime = isoDateFormat(committerMatcher.group(3)); this.author = authorMatcher.group(1).trim(); this.authorEmail = authorMatcher.group(2); this.authorTime = isoDateFormat(authorMatcher.group(3)); if (editMode == 'M' || editMode == 'A' || editMode == 'D' || editMode == 'R' || editMode == 'C') { src = parseHash(fileMatcher.group(1)); dst = parseHash(fileMatcher.group(2));
private GitSCM getScmFromProject(GitChangeSet changeSet) { AbstractProject<?,?> build = (AbstractProject<?, ?>) changeSet.getParent().getRun().getParent(); return (GitSCM) build.getScm(); }
@Override public URL getDiffLink(Path path) throws IOException { if (path.getEditType() != EditType.EDIT) return null; // no diff if this is not an edit change String r1 = path.getChangeSet().getParentCommit(); String r2 = path.getChangeSet().getId(); return new URL(getUrl(), getPath(path) + String.format("?r1=%s&r2=%s", r1, r2)); }
GitChangeSet change = new GitChangeSet(revShow, authorOrCommitter); Set<String> excludedUsers = getExcludedUsersNormalized(); String author = change.getAuthorName(); if (excludedUsers.contains(author)) { List<String> paths = new ArrayList<String>(change.getAffectedPaths()); if (paths.isEmpty()) {
/** * Creates a link to the file diff. * http://[KilnGit URL]/History/[commit]#diff-N * * @param path affected file path * @return diff link * @throws IOException on input or output error */ @Override public URL getDiffLink(Path path) throws IOException { if (path.getEditType() != EditType.EDIT || path.getSrc() == null || path.getDst() == null || path.getChangeSet().getParentCommit() == null) { return null; } return getDiffLinkRegardlessOfEditType(path); }