Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions java/com/google/copybara/git/GerritDestination.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ private String computeInternalHashTag(TransformResult result) {

private Optional<ChangeInfo> findActiveChange(String hashTag)
throws RepoException, ValidationException {
if (gerritOptions.unsafeDontCheckForDups) {
// --gerrit-unsafe-dont-check-for-dups: skip the REST query and behave as if no existing
// change was found.
return Optional.empty();
}

console.progressFmt("Querying Gerrit ('%s') for active changes with hashtag '%s'",
repoUrl, hashTag);
Expand Down
11 changes: 11 additions & 0 deletions java/com/google/copybara/git/GerritOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ public void validate(String name, String value) throws ParameterException {
description = "Create a new change instead of trying to reuse an existing one.")
protected boolean newChange = false;

@Parameter(
names = "--gerrit-unsafe-dont-check-for-dups",
description =
"UNSAFE: skip querying Gerrit (by the internal copybara hashtag) for an existing open"
+ " change before creating one. Lets git.gerrit_destination run with no Gerrit REST"
+ " call at all, e.g. against an ssh-only Gerrit URL. Cost: each run mints a fresh"
+ " Change-Id, so re-running before a change is submitted _may_ create a duplicate"
+ " change instead of a new patch set. Generated Change-Ids are stable so you"
+ " might get lucky.")
protected boolean unsafeDontCheckForDups = false;

@Parameter(names = "--gerrit-topic", description = "Gerrit topic to use")
protected String gerritTopic = "";

Expand Down