
Currently Submission Id is constructed by the change-id of the change that triggered the submission, the timestamp, and a random alphanumeric string. This is not pretty. Since we recently revealed the submission id via ChangeInfo in Ic557e0c94 and via queries in I337f7f8ae, it's a good idea to change the submission id to be more user friendly. Submission Id is now constructed of "<numeric-id>-<topic>" or "<numeric-id>" if topic doesn't exist for that change. The change id is used because it makes the submission id unique (a change can only be submitted once). The topic is used mostly since this is currently one of the main use cases for Revert Submission. Change-Id: Iec8b0db66adf9a7ff2809994acaedef09e4e885c
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
// Copyright (C) 2019 The Android Open Source Project
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package com.google.gerrit.entities;
|
|
|
|
import org.eclipse.jgit.annotations.Nullable;
|
|
|
|
public class SubmissionId {
|
|
private final String submissionId;
|
|
|
|
public SubmissionId(Change.Id changeId, @Nullable String topic) {
|
|
submissionId = topic != null ? String.format("%s-%s", changeId, topic) : changeId.toString();
|
|
}
|
|
|
|
public SubmissionId(Change change) {
|
|
this(change.getId(), change.getTopic());
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return submissionId;
|
|
}
|
|
}
|