-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding annotation to context of tag #36
- Loading branch information
1 parent
4ab05cc
commit ecd852c
Showing
13 changed files
with
111 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 19 additions & 10 deletions
29
src/main/java/se/bjurr/gitchangelog/internal/git/model/GitTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,48 @@ | ||
package se.bjurr.gitchangelog.internal.git.model; | ||
|
||
import static com.google.common.base.Optional.fromNullable; | ||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import java.util.List; | ||
|
||
import com.google.common.base.Optional; | ||
|
||
import se.bjurr.gitchangelog.internal.model.interfaces.IGitCommitReferer; | ||
|
||
public class GitTag implements IGitCommitReferer { | ||
|
||
private final String name; | ||
private final String annotation; | ||
private final List<GitCommit> gitCommits; | ||
private final String name; | ||
|
||
public GitTag(String name, List<GitCommit> gitCommits) { | ||
public GitTag(String name, String annotation, List<GitCommit> gitCommits) { | ||
checkArgument(!gitCommits.isEmpty(), "No commits in " + name); | ||
this.name = name; | ||
this.name = checkNotNull(name, "name"); | ||
this.annotation = annotation; | ||
this.gitCommits = gitCommits; | ||
} | ||
|
||
@Override | ||
public GitCommit getGitCommit() { | ||
return checkNotNull(gitCommits.get(0), name); | ||
public Optional<String> findAnnotation() { | ||
return fromNullable(this.annotation); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
public GitCommit getGitCommit() { | ||
return checkNotNull(this.gitCommits.get(0), this.name); | ||
} | ||
|
||
public List<GitCommit> getGitCommits() { | ||
return gitCommits; | ||
return this.gitCommits; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Tag: " + name + ": " + getGitCommit(); | ||
return "Tag: " + this.name + " Annotation: " + this.annotation + ", " + getGitCommit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters