Create missing repository only at the remote we are pushing to

When replication of a ref failed due to missing remote repository at one
remote site, we then initiated creation of the missing repository on all
remotes where this repository is replicated. The creation of the missing
repository is considered to be success if it succeeded for all remotes
and only in this case the ref replication was rescheduled. This logic
could cause a ref replication to not be rescheduled when creation of a
missing repository fails in a remote which is unrelated to the current
push operation. For example, if we replicate to two remote sites:

  [remote "foo"]
    url = https://foo.org/...
    adminUrl = ssh://gerrit@foo.org/...

  [remote "bar"]
    url = https://bar.org/...
    adminUrl = ssh://gerrit@bar.org/...

and if during a push to "foo" we find that the repository is missing
then we will try to create it on both "foo" and "bar". It could happen
that the creation of the missing repository succeeds on "foo" and then
fails on "bar" because "bar" is unreachable or down at that moment.
In this case the replication to "foo" will not be rescheduled but it
should be as we successfully created the missing repository in "foo".

Create missing repository only under the (admin) URL in the same remote.

Note that there will be one ref replication task for each remote which
ensures that the missing repository will be created in all remotes.

Change-Id: Idbc3f614df53bb3aabcc4cf6cb0d6540e7000e29
(cherry picked from commit abafb83c47eb50c0ec5ce9a4b8d04dc355d5a5bf)
2 files changed
tree: 426721477b2bc0d80bb23d6034bab05bfcc377ec
  1. .settings/
  2. src/
  3. .gitignore
  4. .mailmap
  5. BUILD
  6. LICENSE