forked from TouK/sputnik
-
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.
Merge pull request TouK#22 from zygm0nt/GITHUB-19-dont-repeat-comments
Fix for duplicated comments
- Loading branch information
Showing
12 changed files
with
142 additions
and
49 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
2 changes: 2 additions & 0 deletions
2
src/main/java/pl/touk/sputnik/connector/gerrit/json/ReviewFileComment.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
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,5 +1,12 @@ | ||
package pl.touk.sputnik.connector.stash; | ||
|
||
public enum ChangeType { | ||
ADDED, REMOVED, CONTEXT | ||
ADDED, REMOVED, CONTEXT, NONE; | ||
|
||
public String getNameForStash() { | ||
if (this.equals(NONE)) { | ||
return CONTEXT.name(); | ||
} | ||
return name(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/pl/touk/sputnik/connector/stash/CrcMessage.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package pl.touk.sputnik.connector.stash; | ||
|
||
import pl.touk.sputnik.connector.gerrit.json.ReviewLineComment; | ||
|
||
public class CrcMessage extends ReviewLineComment { | ||
public CrcMessage(ReviewLineComment comment) { | ||
super(comment.line, comment.message); | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return String.format("%s (%s)", message, line); | ||
} | ||
} |
21 changes: 19 additions & 2 deletions
21
src/main/java/pl/touk/sputnik/connector/stash/SingleFileChanges.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,26 +1,43 @@ | ||
package pl.touk.sputnik.connector.stash; | ||
|
||
import com.google.common.collect.Maps; | ||
import com.google.common.collect.Sets; | ||
import lombok.Data; | ||
import lombok.experimental.Builder; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
@Data | ||
@Builder | ||
public class SingleFileChanges { | ||
|
||
private String filename; | ||
private Map<Integer, ChangeType> changesMap; | ||
private Set<String> commentsCrcSet; | ||
|
||
public void addChange(int line, ChangeType changeType) { | ||
getMap().put(line, changeType); | ||
getChangesMap().put(line, changeType); | ||
} | ||
|
||
private Map<Integer, ChangeType> getMap() { | ||
public Map<Integer, ChangeType> getChangesMap() { | ||
if (changesMap == null) { | ||
changesMap = Maps.newHashMap(); | ||
} | ||
return changesMap; | ||
} | ||
|
||
public Set<String> getCommentsCrcSet() { | ||
if (commentsCrcSet == null) { | ||
commentsCrcSet = Sets.newHashSet(); | ||
} | ||
return commentsCrcSet; | ||
} | ||
|
||
public void setComments(List<String> comments) { | ||
for (String comment : comments) { | ||
getCommentsCrcSet().add(comment); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"diffs": [ | ||
|
||
] | ||
} |
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