in src/main/java/com/googlesource/gerrit/plugins/importer/AddHashtagsStep.java [76:112]
void add()
throws IllegalArgumentException, OrmException, NoSuchChangeException, UpdateException,
RestApiException {
ChangeNotes notes = changeNotesFactory.createChecked(db.get(), change);
try {
if (resume) {
HashtagsInput input = new HashtagsInput();
input.remove = notes.load().getHashtags();
try (BatchUpdate bu =
batchUpdateFactory.create(
db.get(), change.getProject(), currentUser, TimeUtil.nowTs())) {
SetHashtagsOp op = hashtagsFactory.create(input);
bu.addOp(change.getId(), op);
bu.execute();
}
}
HashtagsInput input = new HashtagsInput();
input.add = new HashSet<>(changeInfo.hashtags);
try (BatchUpdate bu =
batchUpdateFactory.create(db.get(), change.getProject(), currentUser, TimeUtil.nowTs())) {
SetHashtagsOp op = hashtagsFactory.create(input);
bu.addOp(change.getId(), op);
bu.execute();
}
} catch (AuthException e) {
log.warn(
String.format(
"Hashtags cannot be set on change %s because the importing"
+ " user %s doesn't have permissions to edit hashtags"
+ " (e.g. assign the 'Edit Hashtags' global capability"
+ " and resume the import with the force option).",
ChangeTriplet.format(change), currentUser.getUserName()));
}
}