forked from git-commit-id/git-commit-id-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-commit-id#365 set ahead and behind properties
- Loading branch information
Showing
7 changed files
with
134 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package pl.project13.maven.git; | ||
|
||
import java.util.Objects; | ||
|
||
public class AheadBehind { | ||
|
||
public static final AheadBehind NO_REMOTE = AheadBehind.of("NO_REMOTE", "NO_REMOTE"); | ||
|
||
private final String ahead; | ||
|
||
private final String behind; | ||
|
||
private AheadBehind(String ahead, String behind) { | ||
this.ahead = ahead; | ||
this.behind = behind; | ||
} | ||
|
||
public static AheadBehind of(int ahead, int behind) { | ||
return new AheadBehind(String.valueOf(ahead), String.valueOf(behind)); | ||
} | ||
|
||
public static AheadBehind of(String ahead, String behind) { | ||
return new AheadBehind(ahead, behind); | ||
} | ||
|
||
public String ahead() { | ||
return ahead; | ||
} | ||
|
||
public String behind() { | ||
return behind; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(ahead, behind); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
AheadBehind other = (AheadBehind) obj; | ||
|
||
if (!Objects.equals(ahead, other.ahead)) { | ||
return false; | ||
} | ||
if (!Objects.equals(behind, other.behind)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
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