Switch PatchLineComment's side field to be a numeric
This way we can record it as the nth file in the patch, rather than as just left vs. right. This facilitates comments on an N-way diff (where N >3) such as git produces when a merge has a conflict resolution. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -368,8 +368,8 @@ INSERT INTO patch_comments
|
|||||||
CASE WHEN c.draft = 'Y' THEN 'd'
|
CASE WHEN c.draft = 'Y' THEN 'd'
|
||||||
ELSE 'P'
|
ELSE 'P'
|
||||||
END,
|
END,
|
||||||
CASE WHEN c.is_left = 'Y' THEN 'o'
|
CASE WHEN c.is_left = 'Y' THEN 0
|
||||||
ELSE 'n'
|
ELSE 1
|
||||||
END,
|
END,
|
||||||
c.body,
|
c.body,
|
||||||
o_c.change_id,
|
o_c.change_id,
|
||||||
|
|||||||
@@ -75,31 +75,6 @@ public final class PatchLineComment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum Side {
|
|
||||||
PRE_IMAGE('o'),
|
|
||||||
|
|
||||||
POST_IMAGE('n');
|
|
||||||
|
|
||||||
private final char code;
|
|
||||||
|
|
||||||
private Side(final char c) {
|
|
||||||
code = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Side forCode(final char c) {
|
|
||||||
for (final Side s : Side.values()) {
|
|
||||||
if (s.code == c) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Column(name = Column.NONE)
|
@Column(name = Column.NONE)
|
||||||
protected Id key;
|
protected Id key;
|
||||||
|
|
||||||
@@ -119,9 +94,9 @@ public final class PatchLineComment {
|
|||||||
@Column
|
@Column
|
||||||
protected char status;
|
protected char status;
|
||||||
|
|
||||||
/** Which version of the file is this comment on (old vs. new). */
|
/** Which file is this comment; 0 is ancestor, 1 is new version. */
|
||||||
@Column
|
@Column
|
||||||
protected char side;
|
protected short side;
|
||||||
|
|
||||||
/** The text left by the user. */
|
/** The text left by the user. */
|
||||||
@Column(notNull = false, length = Integer.MAX_VALUE)
|
@Column(notNull = false, length = Integer.MAX_VALUE)
|
||||||
@@ -137,7 +112,7 @@ public final class PatchLineComment {
|
|||||||
author = a;
|
author = a;
|
||||||
writtenOn = new Timestamp(System.currentTimeMillis());
|
writtenOn = new Timestamp(System.currentTimeMillis());
|
||||||
setStatus(Status.DRAFT);
|
setStatus(Status.DRAFT);
|
||||||
setSide(Side.POST_IMAGE);
|
setSide((short) 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PatchLineComment.Id getKey() {
|
public PatchLineComment.Id getKey() {
|
||||||
@@ -164,12 +139,12 @@ public final class PatchLineComment {
|
|||||||
status = s.getCode();
|
status = s.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Side getSide() {
|
public short getSide() {
|
||||||
return Side.forCode(side);
|
return side;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSide(final Side s) {
|
public void setSide(final short s) {
|
||||||
side = s.getCode();
|
side = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
|
|||||||
Reference in New Issue
Block a user