Skip to content
Snippets Groups Projects
Commit af7fb473 authored by Georg Seibt's avatar Georg Seibt :nerd:
Browse files

formatting

parent da538e06
No related branches found
No related tags found
No related merge requests found
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) {
......
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;
......
......@@ -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);
......
......@@ -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;
......
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) {
......
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}.
*
......
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment