PatchSet: Change isRef to isChangeRef

The name isChangeRef is clearer.

Update the replication plugin to use the new method name.

For backwards compatibility for other plugins, keep the isRef method
and mark it as deprecated.

Change-Id: I99c6b2daeaf6c3a5e5d948ae32e0751f3ffedf31
This commit is contained in:
David Pursehouse
2015-10-08 17:49:14 +09:00
parent 22345d1c2a
commit 7b9f5910fb
4 changed files with 13 additions and 5 deletions

View File

@@ -26,10 +26,18 @@ import java.util.List;
/** A single revision of a {@link Change}. */
public final class PatchSet {
/** Is the reference name a change reference? */
public static boolean isRef(String name) {
public static boolean isChangeRef(String name) {
return Id.fromRef(name) != null;
}
/** Is the reference name a change reference?
*
* @deprecated use isChangeRef instead.
**/
public static boolean isRef(String name) {
return isChangeRef(name);
}
public static String joinGroups(Iterable<String> groups) {
if (groups == null) {
return null;

View File

@@ -84,13 +84,13 @@ public class PatchSetTest {
}
private static void assertRef(int changeId, int psId, String refName) {
assertThat(PatchSet.isRef(refName)).isTrue();
assertThat(PatchSet.isChangeRef(refName)).isTrue();
assertThat(PatchSet.Id.fromRef(refName))
.isEqualTo(new PatchSet.Id(new Change.Id(changeId), psId));
}
private static void assertNotRef(String refName) {
assertThat(PatchSet.isRef(refName)).isFalse();
assertThat(PatchSet.isChangeRef(refName)).isFalse();
assertThat(PatchSet.Id.fromRef(refName)).isNull();
}
}

View File

@@ -332,7 +332,7 @@ class TagSet {
static boolean skip(Ref ref) {
return ref.isSymbolic() || ref.getObjectId() == null
|| PatchSet.isRef(ref.getName());
|| PatchSet.isChangeRef(ref.getName());
}
private static boolean isTag(Ref ref) {