Merge "Fix comment range parsing for file comments in notedb"
This commit is contained in:
@@ -232,7 +232,9 @@ public class CommentsInNotesUtil {
|
|||||||
|
|
||||||
int startLine = RawParseUtils.parseBase10(note, ptr.value, ptr);
|
int startLine = RawParseUtils.parseBase10(note, ptr.value, ptr);
|
||||||
if (startLine == 0) {
|
if (startLine == 0) {
|
||||||
return null;
|
range.setEndLine(0);
|
||||||
|
ptr.value += 1;
|
||||||
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note[ptr.value] == '\n') {
|
if (note[ptr.value] == '\n') {
|
||||||
|
|||||||
@@ -812,7 +812,6 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
|
|||||||
noteString);
|
noteString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void patchLineCommentMultipleOnePatchsetOneFileBothSides()
|
public void patchLineCommentMultipleOnePatchsetOneFileBothSides()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
@@ -1153,6 +1152,34 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
|
|||||||
assertTrue(notes.getDraftPsComments(otherUserId).values().isEmpty());
|
assertTrue(notes.getDraftPsComments(otherUserId).values().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fileComment() throws Exception {
|
||||||
|
Change c = newChange();
|
||||||
|
ChangeUpdate update = newUpdate(c, otherUser);
|
||||||
|
String uuid = "uuid";
|
||||||
|
String messageForBase = "comment for base";
|
||||||
|
Timestamp now = TimeUtil.nowTs();
|
||||||
|
PatchSet.Id psId = c.currentPatchSetId();
|
||||||
|
|
||||||
|
PatchLineComment commentForBase =
|
||||||
|
newPublishedPatchLineComment(psId, "filename", uuid,
|
||||||
|
null, 0, otherUser, null, now, messageForBase,
|
||||||
|
(short) 0, "abcd1234abcd1234abcd1234abcd1234abcd1234");
|
||||||
|
update.setPatchSetId(psId);
|
||||||
|
update.upsertComment(commentForBase);
|
||||||
|
update.commit();
|
||||||
|
|
||||||
|
ChangeNotes notes = newNotes(c);
|
||||||
|
Multimap<PatchSet.Id, PatchLineComment> commentsForBase =
|
||||||
|
notes.getBaseComments();
|
||||||
|
Multimap<PatchSet.Id, PatchLineComment> commentsForPs =
|
||||||
|
notes.getPatchSetComments();
|
||||||
|
|
||||||
|
assertTrue(commentsForPs.isEmpty());
|
||||||
|
assertEquals(commentForBase,
|
||||||
|
Iterables.getOnlyElement(commentsForBase.get(psId)));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void patchLineCommentNoRange() throws Exception {
|
public void patchLineCommentNoRange() throws Exception {
|
||||||
Change c = newChange();
|
Change c = newChange();
|
||||||
|
|||||||
Reference in New Issue
Block a user