From af7fb473741f8762a32ff7d9f4060ae3bade224b Mon Sep 17 00:00:00 2001 From: Georg Seibt <seibt@fim.uni-passau.de> Date: Fri, 21 Oct 2016 15:42:15 +0200 Subject: [PATCH] formatting --- .../gitwrapper/process/ProcessExecutor.java | 19 +++++++------ .../fim/seibt/gitwrapper/repo/BlameLine.java | 1 - .../fim/seibt/gitwrapper/repo/Branch.java | 8 +++--- .../fim/seibt/gitwrapper/repo/Commit.java | 27 ++++++++++++------- .../fim/seibt/gitwrapper/repo/GitWrapper.java | 18 +++++++------ .../fim/seibt/gitwrapper/repo/Reference.java | 11 ++++---- .../fim/seibt/gitwrapper/repo/Status.java | 16 ++++++----- 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java b/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java index 8660d6a..380b919 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java @@ -1,9 +1,5 @@ package de.uni_passau.fim.seibt.gitwrapper.process; -import static java.nio.charset.StandardCharsets.UTF_8; -import static java.util.logging.Level.FINER; -import static java.util.logging.Level.WARNING; - import java.io.File; import java.io.IOException; import java.util.Collections; @@ -20,6 +16,10 @@ import java.util.logging.Logger; import org.apache.commons.io.IOUtils; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.logging.Level.FINER; +import static java.util.logging.Level.WARNING; + /** * Contains static methods for executing commands and gathering their output and exit code. */ @@ -60,9 +60,12 @@ public class ProcessExecutor { /** * Constructs a new {@link ExecRes} containing the given results from the execution of a process. * - * @param exitCode the exit code of the process - * @param stdOut the standard output of the process - * @param stdErr the standard error output of the process + * @param exitCode + * the exit code of the process + * @param stdOut + * the standard output of the process + * @param stdErr + * the standard error output of the process */ private ExecRes(int exitCode, String stdOut, String stdErr) { this.exitCode = exitCode; @@ -205,7 +208,7 @@ public class ProcessExecutor { IOUtils.closeQuietly(p.getOutputStream()); int exitCode; - + try { exitCode = p.waitFor(); } catch (InterruptedException e) { diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java index fe623a7..6f1937c 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java @@ -1,6 +1,5 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; -import java.io.File; import java.nio.file.Path; import java.util.Collections; import java.util.Map; diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java index f5be620..2dbcdd7 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Branch.java @@ -7,7 +7,7 @@ import java.util.logging.Logger; import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor; /** - * A {@link Branch} is a named {@link Reference} to a git branch pointing to a {@link Commit}. + * A {@link Branch} is a named {@link Reference} to a git branch pointing to a {@link Commit}. */ public class Branch extends Reference { @@ -16,8 +16,10 @@ public class Branch extends Reference { /** * Constructs a new {@link Branch} referencing an existing git branch. * - * @param repo the repo this branch is part of - * @param name the branch name + * @param repo + * the repo this branch is part of + * @param name + * the branch name */ Branch(Repository repo, String name) { super(repo, name); diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java index a19e4a2..a26c072 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Commit.java @@ -33,8 +33,10 @@ public class Commit extends Reference { /** * Constructs a new {@link Commit} with the given <code>id</code> made in the <code>repo</code>. * - * @param repo the {@link Repository} the {@link Commit} was made in - * @param id the ID of the {@link Commit} + * @param repo + * the {@link Repository} the {@link Commit} was made in + * @param id + * the ID of the {@link Commit} */ Commit(Repository repo, String id) { super(repo, id); @@ -56,7 +58,8 @@ public class Commit extends Reference { /** * Sets the author to the new value. * - * @param author the new author + * @param author + * the new author */ void setAuthor(String author) { this.author = author; @@ -78,7 +81,8 @@ public class Commit extends Reference { /** * Sets the author mail to the new value. * - * @param authorMail the new author mail + * @param authorMail + * the new author mail */ void setAuthorMail(String authorMail) { this.authorMail = authorMail; @@ -100,7 +104,8 @@ public class Commit extends Reference { /** * Sets the author time to the new value. * - * @param authorTime the new author time + * @param authorTime + * the new author time */ void setAuthorTime(OffsetDateTime authorTime) { this.authorTime = authorTime; @@ -122,7 +127,8 @@ public class Commit extends Reference { /** * Sets the committer to the new value. * - * @param committer the new committer + * @param committer + * the new committer */ void setCommitter(String committer) { this.committer = committer; @@ -144,7 +150,8 @@ public class Commit extends Reference { /** * Sets the committer mail to the new value. * - * @param committerMail the new committer mail + * @param committerMail + * the new committer mail */ void setCommitterMail(String committerMail) { this.committerMail = committerMail; @@ -166,7 +173,8 @@ public class Commit extends Reference { /** * Sets the committer time to the new value. * - * @param committerTime the new committer time + * @param committerTime + * the new committer time */ void setCommitterTime(OffsetDateTime committerTime) { this.committerTime = committerTime; @@ -188,7 +196,8 @@ public class Commit extends Reference { /** * Sets the commit message. * - * @param message the commit message + * @param message + * the commit message */ void setMessage(String message) { this.message = message; diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java index 27d0b12..2c0a418 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java @@ -1,10 +1,5 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; - -import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes; -import de.uni_passau.fim.seibt.gitwrapper.process.ToolNotWorkingException; -import de.uni_passau.fim.seibt.gitwrapper.process.ToolWrapper; - import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -17,6 +12,10 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes; +import de.uni_passau.fim.seibt.gitwrapper.process.ToolNotWorkingException; +import de.uni_passau.fim.seibt.gitwrapper.process.ToolWrapper; + import static de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.asList; /** @@ -49,7 +48,8 @@ public class GitWrapper extends ToolWrapper { /** * Constructs a new {@link GitWrapper} * - * @param git the git command, e.g. '/usr/bin/git' or just 'git' + * @param git + * the git command, e.g. '/usr/bin/git' or just 'git' */ public GitWrapper(String git) throws ToolNotWorkingException { super(git); @@ -132,7 +132,8 @@ public class GitWrapper extends ToolWrapper { /** * Imports an existing repository. * - * @param directory the path to the repository + * @param directory + * the path to the repository * @return the {@link Repository} if the import was successful or an empty {@link Optional} if there was an error */ public Optional<Repository> importRepository(File directory) { @@ -194,7 +195,8 @@ public class GitWrapper extends ToolWrapper { * Returns whether the given git command failed. This relies on exit code first and then on the assumption that * the output (in case of failure) starts with either "{@value FATAL_PREFIX}" or "{@value ERROR_PREFIX}". * - * @param res the {@link ExecRes} to check + * @param res + * the {@link ExecRes} to check * @return whether the git command failed */ public boolean failed(ExecRes res) { diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java index 28ccd37..931b797 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Reference.java @@ -1,7 +1,5 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; -import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes; - import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -10,6 +8,8 @@ import java.util.function.Function; import java.util.logging.Logger; import java.util.stream.Collectors; +import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes; + /** * A git object referencing a tree-ish object. * @@ -52,7 +52,8 @@ public abstract class Reference { * Optionally returns the merge base for <code>this</code> and <code>other</code>. The <code>other</code> reference * must be part of the same {@link Repository} this {@link Reference} is. * - * @param other the other {@link Reference} + * @param other + * the other {@link Reference} * @return the merge base or an empty {@link Optional} if there is no merge base or an exception occurred */ public Optional<Commit> getMergeBase(Reference other) { @@ -87,7 +88,8 @@ public abstract class Reference { * Performs a checkout followed by a merge of <code>this</code> and <code>other</code>. <code>Other</code> must be * part of the same {@link Repository} this {@link Reference} is. * - * @param other the {@link Reference} to merge + * @param other + * the {@link Reference} to merge * @return the {@link Status} of the working directory after the merge */ public Optional<Status> merge(Reference other) { @@ -99,7 +101,6 @@ public abstract class Reference { return mergeBase.flatMap(res -> repo.getStatus()); } - /** * Returns the parents of this {@link Commit}. * diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java index 790412f..d2730b5 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java @@ -1,6 +1,5 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; -import java.io.StringWriter; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; @@ -37,9 +36,12 @@ public class Status { /** * Constructs a new {@link Status}. * - * @param commit the current HEAD {@link Commit} at the time this {@link Status} is constructed - * @param changed a map of changed files and heir status codes - * @param unmerged a map of unmerged files an their status code. + * @param commit + * the current HEAD {@link Commit} at the time this {@link Status} is constructed + * @param changed + * a map of changed files and heir status codes + * @param unmerged + * a map of unmerged files an their status code. */ private Status(Commit commit, Map<Path, String> changed, Map<Path, String> unmerged) { this.commit = commit; @@ -89,8 +91,10 @@ public class Status { /** * Parses the output from git into a new object. * - * @param repo the repo this status report is from - * @param gitOutput the status report from git + * @param repo + * the repo this status report is from + * @param gitOutput + * the status report from git * @return optionally a {@link Status} object, representing the status read from the git output */ static Optional<Status> parseStatus(Repository repo, String gitOutput) { -- GitLab