Rename "GitReferenceUpdated replication" to "GitReferenceUpdated gitRefUpdated"

The concept of replication is not a part of the Gerrit core any more. Rename all
variables of type GitReferenceUpdated which were named "replication" to
"gitRefUpdated". Also rename the "MetaDataUpdate.replicate" method to
"fireGitRefUpdatedEvent" as this is exactly what it does.

Change-Id: I4ebe9ce05849e5f35e344195e6e5b561a079a965
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
Sasa Zivkov 2012-12-07 16:41:32 +01:00 committed by Edwin Kempin
parent c21f309f71
commit 336eb70b51
15 changed files with 72 additions and 72 deletions

View File

@ -38,7 +38,7 @@ class DeleteDraftChange extends Handler<VoidResult> {
private final ChangeControl.Factory changeControlFactory; private final ChangeControl.Factory changeControlFactory;
private final ReviewDb db; private final ReviewDb db;
private final GitRepositoryManager gitManager; private final GitRepositoryManager gitManager;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final PatchSet.Id patchSetId; private final PatchSet.Id patchSetId;
@ -46,12 +46,12 @@ class DeleteDraftChange extends Handler<VoidResult> {
DeleteDraftChange(final ReviewDb db, DeleteDraftChange(final ReviewDb db,
final ChangeControl.Factory changeControlFactory, final ChangeControl.Factory changeControlFactory,
final GitRepositoryManager gitManager, final GitRepositoryManager gitManager,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
@Assisted final PatchSet.Id patchSetId) { @Assisted final PatchSet.Id patchSetId) {
this.changeControlFactory = changeControlFactory; this.changeControlFactory = changeControlFactory;
this.db = db; this.db = db;
this.gitManager = gitManager; this.gitManager = gitManager;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.patchSetId = patchSetId; this.patchSetId = patchSetId;
} }
@ -65,7 +65,7 @@ class DeleteDraftChange extends Handler<VoidResult> {
throw new NoSuchChangeException(changeId); throw new NoSuchChangeException(changeId);
} }
ChangeUtil.deleteDraftChange(patchSetId, gitManager, replication, db); ChangeUtil.deleteDraftChange(patchSetId, gitManager, gitRefUpdated, db);
return VoidResult.INSTANCE; return VoidResult.INSTANCE;
} }
} }

View File

@ -60,7 +60,7 @@ class EditCommitMessageHandler extends Handler<ChangeDetail> {
private final ChangeDetailFactory.Factory changeDetailFactory; private final ChangeDetailFactory.Factory changeDetailFactory;
private final CommitMessageEditedSender.Factory commitMessageEditedSenderFactory; private final CommitMessageEditedSender.Factory commitMessageEditedSenderFactory;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final PatchSet.Id patchSetId; private final PatchSet.Id patchSetId;
@Nullable @Nullable
@ -84,7 +84,7 @@ class EditCommitMessageHandler extends Handler<ChangeDetail> {
final CommitValidators.Factory commitValidatorsFactory, final CommitValidators.Factory commitValidatorsFactory,
final GitRepositoryManager gitManager, final GitRepositoryManager gitManager,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
@GerritPersonIdent final PersonIdent myIdent) { @GerritPersonIdent final PersonIdent myIdent) {
this.changeControlFactory = changeControlFactory; this.changeControlFactory = changeControlFactory;
this.db = db; this.db = db;
@ -99,7 +99,7 @@ class EditCommitMessageHandler extends Handler<ChangeDetail> {
this.gitManager = gitManager; this.gitManager = gitManager;
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.myIdent = myIdent; this.myIdent = myIdent;
} }
@ -127,7 +127,7 @@ class EditCommitMessageHandler extends Handler<ChangeDetail> {
commitValidatorsFactory.create(control.getRefControl(), new NoSshInfo(), git); commitValidatorsFactory.create(control.getRefControl(), new NoSshInfo(), git);
ChangeUtil.editCommitMessage(patchSetId, control.getRefControl(), commitValidators, currentUser, message, db, ChangeUtil.editCommitMessage(patchSetId, control.getRefControl(), commitValidators, currentUser, message, db,
commitMessageEditedSenderFactory, hooks, git, patchSetInfoFactory, replication, myIdent); commitMessageEditedSenderFactory, hooks, git, patchSetInfoFactory, gitRefUpdated, myIdent);
return changeDetailFactory.create(changeId).call(); return changeDetailFactory.create(changeId).call();
} finally { } finally {

View File

@ -50,7 +50,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
private final ProjectControl.Factory projectControlFactory; private final ProjectControl.Factory projectControlFactory;
private final GitRepositoryManager repoManager; private final GitRepositoryManager repoManager;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final IdentifiedUser identifiedUser; private final IdentifiedUser identifiedUser;
private final ChangeHooks hooks; private final ChangeHooks hooks;
private final ReviewDb db; private final ReviewDb db;
@ -61,7 +61,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
@Inject @Inject
DeleteBranches(final ProjectControl.Factory projectControlFactory, DeleteBranches(final ProjectControl.Factory projectControlFactory,
final GitRepositoryManager repoManager, final GitRepositoryManager repoManager,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
final IdentifiedUser identifiedUser, final IdentifiedUser identifiedUser,
final ChangeHooks hooks, final ChangeHooks hooks,
final ReviewDb db, final ReviewDb db,
@ -69,7 +69,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
@Assisted Project.NameKey name, @Assisted Set<Branch.NameKey> toRemove) { @Assisted Project.NameKey name, @Assisted Set<Branch.NameKey> toRemove) {
this.projectControlFactory = projectControlFactory; this.projectControlFactory = projectControlFactory;
this.repoManager = repoManager; this.repoManager = repoManager;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.identifiedUser = identifiedUser; this.identifiedUser = identifiedUser;
this.hooks = hooks; this.hooks = hooks;
this.db = db; this.db = db;
@ -121,7 +121,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
case FAST_FORWARD: case FAST_FORWARD:
case FORCED: case FORCED:
deleted.add(branchKey); deleted.add(branchKey);
replication.fire(projectName, u); gitRefUpdated.fire(projectName, u);
hooks.doRefUpdatedHook(branchKey, u, identifiedUser.getAccount()); hooks.doRefUpdatedHook(branchKey, u, identifiedUser.getAccount());
break; break;

View File

@ -198,7 +198,7 @@ public class ChangeUtil {
final RevertedSender.Factory revertedSenderFactory, final RevertedSender.Factory revertedSenderFactory,
final ChangeHooks hooks, Repository git, final ChangeHooks hooks, Repository git,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final GitReferenceUpdated replication, PersonIdent myIdent, final GitReferenceUpdated gitRefUpdated, PersonIdent myIdent,
String canonicalWebUrl) throws NoSuchChangeException, EmailException, String canonicalWebUrl) throws NoSuchChangeException, EmailException,
OrmException, MissingObjectException, IncorrectObjectTypeException, OrmException, MissingObjectException, IncorrectObjectTypeException,
IOException, InvalidChangeOperationException { IOException, InvalidChangeOperationException {
@ -279,7 +279,7 @@ public class ChangeUtil {
"Failed to create ref %s in %s: %s", ps.getRefName(), "Failed to create ref %s in %s: %s", ps.getRefName(),
change.getDest().getParentKey().get(), ru.getResult())); change.getDest().getParentKey().get(), ru.getResult()));
} }
replication.fire(change.getProject(), ru); gitRefUpdated.fire(change.getProject(), ru);
db.changes().beginTransaction(change.getId()); db.changes().beginTransaction(change.getId());
try { try {
@ -321,7 +321,7 @@ public class ChangeUtil {
final CommitMessageEditedSender.Factory commitMessageEditedSenderFactory, final CommitMessageEditedSender.Factory commitMessageEditedSenderFactory,
final ChangeHooks hooks, Repository git, final ChangeHooks hooks, Repository git,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final GitReferenceUpdated replication, PersonIdent myIdent) final GitReferenceUpdated gitRefUpdated, PersonIdent myIdent)
throws NoSuchChangeException, EmailException, OrmException, throws NoSuchChangeException, EmailException, OrmException,
MissingObjectException, IncorrectObjectTypeException, IOException, MissingObjectException, IncorrectObjectTypeException, IOException,
InvalidChangeOperationException, PatchSetInfoNotAvailableException { InvalidChangeOperationException, PatchSetInfoNotAvailableException {
@ -397,7 +397,7 @@ public class ChangeUtil {
"Failed to create ref %s in %s: %s", newPatchSet.getRefName(), "Failed to create ref %s in %s: %s", newPatchSet.getRefName(),
change.getDest().getParentKey().get(), ru.getResult())); change.getDest().getParentKey().get(), ru.getResult()));
} }
replication.fire(change.getProject(), ru); gitRefUpdated.fire(change.getProject(), ru);
db.changes().beginTransaction(change.getId()); db.changes().beginTransaction(change.getId());
try { try {
@ -463,7 +463,7 @@ public class ChangeUtil {
public static void deleteDraftChange(final PatchSet.Id patchSetId, public static void deleteDraftChange(final PatchSet.Id patchSetId,
GitRepositoryManager gitManager, GitRepositoryManager gitManager,
final GitReferenceUpdated replication, final ReviewDb db) final GitReferenceUpdated gitRefUpdated, final ReviewDb db)
throws NoSuchChangeException, OrmException, IOException { throws NoSuchChangeException, OrmException, IOException {
final Change.Id changeId = patchSetId.getParentKey(); final Change.Id changeId = patchSetId.getParentKey();
final Change change = db.changes().get(changeId); final Change change = db.changes().get(changeId);
@ -473,7 +473,7 @@ public class ChangeUtil {
for (PatchSet ps : db.patchSets().byChange(changeId)) { for (PatchSet ps : db.patchSets().byChange(changeId)) {
// These should all be draft patch sets. // These should all be draft patch sets.
deleteOnlyDraftPatchSet(ps, change, gitManager, replication, db); deleteOnlyDraftPatchSet(ps, change, gitManager, gitRefUpdated, db);
} }
db.changeMessages().delete(db.changeMessages().byChange(changeId)); db.changeMessages().delete(db.changeMessages().byChange(changeId));
@ -484,7 +484,7 @@ public class ChangeUtil {
public static void deleteOnlyDraftPatchSet(final PatchSet patch, public static void deleteOnlyDraftPatchSet(final PatchSet patch,
final Change change, GitRepositoryManager gitManager, final Change change, GitRepositoryManager gitManager,
final GitReferenceUpdated replication, final ReviewDb db) final GitReferenceUpdated gitRefUpdated, final ReviewDb db)
throws NoSuchChangeException, OrmException, IOException { throws NoSuchChangeException, OrmException, IOException {
final PatchSet.Id patchSetId = patch.getId(); final PatchSet.Id patchSetId = patch.getId();
if (patch == null || !patch.isDraft()) { if (patch == null || !patch.isDraft()) {
@ -507,7 +507,7 @@ public class ChangeUtil {
throw new IOException("Failed to delete ref " + patch.getRefName() + throw new IOException("Failed to delete ref " + patch.getRefName() +
" in " + repo.getDirectory() + ": " + update.getResult()); " in " + repo.getDirectory() + ": " + update.getResult());
} }
replication.fire(change.getProject(), update); gitRefUpdated.fire(change.getProject(), update);
} finally { } finally {
repo.close(); repo.close();
} }

View File

@ -53,7 +53,7 @@ public class Revert implements RestModifyView<ChangeResource, Input> {
private final GitRepositoryManager gitManager; private final GitRepositoryManager gitManager;
private final PersonIdent myIdent; private final PersonIdent myIdent;
private final PatchSetInfoFactory patchSetInfoFactory; private final PatchSetInfoFactory patchSetInfoFactory;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final String canonicalWebUrl; private final String canonicalWebUrl;
public static class Input { public static class Input {
@ -68,7 +68,7 @@ public class Revert implements RestModifyView<ChangeResource, Input> {
ChangeJson json, ChangeJson json,
GitRepositoryManager gitManager, GitRepositoryManager gitManager,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
@GerritPersonIdent final PersonIdent myIdent, @GerritPersonIdent final PersonIdent myIdent,
@CanonicalWebUrl @Nullable final String canonicalWebUrl) { @CanonicalWebUrl @Nullable final String canonicalWebUrl) {
this.hooks = hooks; this.hooks = hooks;
@ -78,7 +78,7 @@ public class Revert implements RestModifyView<ChangeResource, Input> {
this.json = json; this.json = json;
this.gitManager = gitManager; this.gitManager = gitManager;
this.myIdent = myIdent; this.myIdent = myIdent;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.canonicalWebUrl = canonicalWebUrl; this.canonicalWebUrl = canonicalWebUrl;
} }
@ -104,7 +104,7 @@ public class Revert implements RestModifyView<ChangeResource, Input> {
commitValidators, commitValidators,
Strings.emptyToNull(input.message), dbProvider.get(), Strings.emptyToNull(input.message), dbProvider.get(),
revertedSenderFactory, hooks, git, patchSetInfoFactory, revertedSenderFactory, hooks, git, patchSetInfoFactory,
replication, myIdent, canonicalWebUrl); gitRefUpdated, myIdent, canonicalWebUrl);
return json.format(revertedChangeId); return json.format(revertedChangeId);
} catch (InvalidChangeOperationException e) { } catch (InvalidChangeOperationException e) {

View File

@ -44,7 +44,7 @@ public class DeleteDraftPatchSet implements Callable<ReviewResult> {
private final ChangeControl.Factory changeControlFactory; private final ChangeControl.Factory changeControlFactory;
private final ReviewDb db; private final ReviewDb db;
private final GitRepositoryManager gitManager; private final GitRepositoryManager gitManager;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final PatchSetInfoFactory patchSetInfoFactory; private final PatchSetInfoFactory patchSetInfoFactory;
private final PatchSet.Id patchSetId; private final PatchSet.Id patchSetId;
@ -52,12 +52,12 @@ public class DeleteDraftPatchSet implements Callable<ReviewResult> {
@Inject @Inject
DeleteDraftPatchSet(ChangeControl.Factory changeControlFactory, DeleteDraftPatchSet(ChangeControl.Factory changeControlFactory,
ReviewDb db, GitRepositoryManager gitManager, ReviewDb db, GitRepositoryManager gitManager,
GitReferenceUpdated replication, PatchSetInfoFactory patchSetInfoFactory, GitReferenceUpdated gitRefUpdated, PatchSetInfoFactory patchSetInfoFactory,
@Assisted final PatchSet.Id patchSetId) { @Assisted final PatchSet.Id patchSetId) {
this.changeControlFactory = changeControlFactory; this.changeControlFactory = changeControlFactory;
this.db = db; this.db = db;
this.gitManager = gitManager; this.gitManager = gitManager;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.patchSetId = patchSetId; this.patchSetId = patchSetId;
@ -88,7 +88,7 @@ public class DeleteDraftPatchSet implements Callable<ReviewResult> {
final Change change = control.getChange(); final Change change = control.getChange();
try { try {
ChangeUtil.deleteOnlyDraftPatchSet(patch, change, gitManager, replication, db); ChangeUtil.deleteOnlyDraftPatchSet(patch, change, gitManager, gitRefUpdated, db);
} catch (IOException e) { } catch (IOException e) {
result.addError(new ReviewResult.Error( result.addError(new ReviewResult.Error(
ReviewResult.Error.Type.GIT_ERROR, e.getMessage())); ReviewResult.Error.Type.GIT_ERROR, e.getMessage()));
@ -97,7 +97,7 @@ public class DeleteDraftPatchSet implements Callable<ReviewResult> {
List<PatchSet> restOfPatches = db.patchSets().byChange(changeId).toList(); List<PatchSet> restOfPatches = db.patchSets().byChange(changeId).toList();
if (restOfPatches.size() == 0) { if (restOfPatches.size() == 0) {
try { try {
ChangeUtil.deleteDraftChange(patchSetId, gitManager, replication, db); ChangeUtil.deleteDraftChange(patchSetId, gitManager, gitRefUpdated, db);
result.setChangeId(null); result.setChangeId(null);
} catch (IOException e) { } catch (IOException e) {
result.addError(new ReviewResult.Error( result.addError(new ReviewResult.Error(

View File

@ -68,7 +68,7 @@ public class RebaseChange {
private final ReviewDb db; private final ReviewDb db;
private final GitRepositoryManager gitManager; private final GitRepositoryManager gitManager;
private final PersonIdent myIdent; private final PersonIdent myIdent;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final RebasedPatchSetSender.Factory rebasedPatchSetSenderFactory; private final RebasedPatchSetSender.Factory rebasedPatchSetSenderFactory;
private final ChangeHookRunner hooks; private final ChangeHookRunner hooks;
private final ApprovalsUtil approvalsUtil; private final ApprovalsUtil approvalsUtil;
@ -78,7 +78,7 @@ public class RebaseChange {
final PatchSetInfoFactory patchSetInfoFactory, final ReviewDb db, final PatchSetInfoFactory patchSetInfoFactory, final ReviewDb db,
@GerritPersonIdent final PersonIdent myIdent, @GerritPersonIdent final PersonIdent myIdent,
final GitRepositoryManager gitManager, final GitRepositoryManager gitManager,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
final RebasedPatchSetSender.Factory rebasedPatchSetSenderFactory, final RebasedPatchSetSender.Factory rebasedPatchSetSenderFactory,
final ChangeHookRunner hooks, final ApprovalsUtil approvalsUtil) { final ChangeHookRunner hooks, final ApprovalsUtil approvalsUtil) {
this.changeControlFactory = changeControlFactory; this.changeControlFactory = changeControlFactory;
@ -86,7 +86,7 @@ public class RebaseChange {
this.db = db; this.db = db;
this.gitManager = gitManager; this.gitManager = gitManager;
this.myIdent = myIdent; this.myIdent = myIdent;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.rebasedPatchSetSenderFactory = rebasedPatchSetSenderFactory; this.rebasedPatchSetSenderFactory = rebasedPatchSetSenderFactory;
this.hooks = hooks; this.hooks = hooks;
this.approvalsUtil = approvalsUtil; this.approvalsUtil = approvalsUtil;
@ -333,7 +333,7 @@ public class RebaseChange {
newPatchSet.getRefName(), change.getDest().getParentKey().get(), newPatchSet.getRefName(), change.getDest().getParentKey().get(),
ru.getResult())); ru.getResult()));
} }
replication.fire(change.getProject(), ru); gitRefUpdated.fire(change.getProject(), ru);
db.changes().beginTransaction(change.getId()); db.changes().beginTransaction(change.getId());
try { try {

View File

@ -54,19 +54,19 @@ public class CherryPick extends SubmitStrategy {
private final PatchSetInfoFactory patchSetInfoFactory; private final PatchSetInfoFactory patchSetInfoFactory;
private final Provider<String> urlProvider; private final Provider<String> urlProvider;
private final ApprovalTypes approvalTypes; private final ApprovalTypes approvalTypes;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final Map<Change.Id, CodeReviewCommit> newCommits; private final Map<Change.Id, CodeReviewCommit> newCommits;
CherryPick(final SubmitStrategy.Arguments args, CherryPick(final SubmitStrategy.Arguments args,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final Provider<String> urlProvider, final ApprovalTypes approvalTypes, final Provider<String> urlProvider, final ApprovalTypes approvalTypes,
final GitReferenceUpdated replication) { final GitReferenceUpdated gitRefUpdated) {
super(args); super(args);
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.urlProvider = urlProvider; this.urlProvider = urlProvider;
this.approvalTypes = approvalTypes; this.approvalTypes = approvalTypes;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.newCommits = new HashMap<Change.Id, CodeReviewCommit>(); this.newCommits = new HashMap<Change.Id, CodeReviewCommit>();
} }
@ -202,7 +202,7 @@ public class CherryPick extends SubmitStrategy {
ru.getResult())); ru.getResult()));
} }
replication.fire(n.change.getProject(), ru); gitRefUpdated.fire(n.change.getProject(), ru);
newCommit.copyFrom(n); newCommit.copyFrom(n);
newCommit.statusCode = CommitMergeStatus.CLEAN_PICK; newCommit.statusCode = CommitMergeStatus.CLEAN_PICK;

View File

@ -122,7 +122,7 @@ public class MergeOp {
private final SchemaFactory<ReviewDb> schemaFactory; private final SchemaFactory<ReviewDb> schemaFactory;
private final ProjectCache projectCache; private final ProjectCache projectCache;
private final FunctionState.Factory functionState; private final FunctionState.Factory functionState;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final MergedSender.Factory mergedSenderFactory; private final MergedSender.Factory mergedSenderFactory;
private final MergeFailSender.Factory mergeFailSenderFactory; private final MergeFailSender.Factory mergeFailSenderFactory;
private final ApprovalTypes approvalTypes; private final ApprovalTypes approvalTypes;
@ -159,7 +159,7 @@ public class MergeOp {
@Inject @Inject
MergeOp(final GitRepositoryManager grm, final SchemaFactory<ReviewDb> sf, MergeOp(final GitRepositoryManager grm, final SchemaFactory<ReviewDb> sf,
final ProjectCache pc, final FunctionState.Factory fs, final ProjectCache pc, final FunctionState.Factory fs,
final GitReferenceUpdated rq, final MergedSender.Factory msf, final GitReferenceUpdated gru, final MergedSender.Factory msf,
final MergeFailSender.Factory mfsf, final MergeFailSender.Factory mfsf,
final ApprovalTypes approvalTypes, final PatchSetInfoFactory psif, final ApprovalTypes approvalTypes, final PatchSetInfoFactory psif,
final IdentifiedUser.GenericFactory iuf, final IdentifiedUser.GenericFactory iuf,
@ -177,7 +177,7 @@ public class MergeOp {
schemaFactory = sf; schemaFactory = sf;
functionState = fs; functionState = fs;
projectCache = pc; projectCache = pc;
replication = rq; gitRefUpdated = gru;
mergedSenderFactory = msf; mergedSenderFactory = msf;
mergeFailSenderFactory = mfsf; mergeFailSenderFactory = mfsf;
this.approvalTypes = approvalTypes; this.approvalTypes = approvalTypes;
@ -686,7 +686,7 @@ public class MergeOp {
destProject.getProject().getDescription()); destProject.getProject().getDescription());
} }
replication.fire(destBranch.getParentKey(), branchUpdate); gitRefUpdated.fire(destBranch.getParentKey(), branchUpdate);
Account account = null; Account account = null;
final PatchSetApproval submitter = getSubmitter(db, mergeTip.patchsetId); final PatchSetApproval submitter = getSubmitter(db, mergeTip.patchsetId);

View File

@ -88,15 +88,15 @@ public class MetaDataUpdate {
@Assisted Repository db); @Assisted Repository db);
} }
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final Project.NameKey projectName; private final Project.NameKey projectName;
private final Repository db; private final Repository db;
private final CommitBuilder commit; private final CommitBuilder commit;
@Inject @Inject
public MetaDataUpdate(GitReferenceUpdated replication, public MetaDataUpdate(GitReferenceUpdated gitRefUpdated,
@Assisted Project.NameKey projectName, @Assisted Repository db) { @Assisted Project.NameKey projectName, @Assisted Repository db) {
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.projectName = projectName; this.projectName = projectName;
this.db = db; this.db = db;
this.commit = new CommitBuilder(); this.commit = new CommitBuilder();
@ -130,7 +130,7 @@ public class MetaDataUpdate {
return commit; return commit;
} }
void replicate(RefUpdate ru) { void fireGitRefUpdatedEvent(RefUpdate ru) {
replication.fire(projectName, ru); gitRefUpdated.fire(projectName, ru);
} }
} }

View File

@ -235,7 +235,7 @@ public class ReceiveCommits {
private final CreateChangeSender.Factory createChangeSenderFactory; private final CreateChangeSender.Factory createChangeSenderFactory;
private final MergedSender.Factory mergedSenderFactory; private final MergedSender.Factory mergedSenderFactory;
private final ReplacePatchSetSender.Factory replacePatchSetFactory; private final ReplacePatchSetSender.Factory replacePatchSetFactory;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final PatchSetInfoFactory patchSetInfoFactory; private final PatchSetInfoFactory patchSetInfoFactory;
private final ChangeHooks hooks; private final ChangeHooks hooks;
private final ApprovalsUtil approvalsUtil; private final ApprovalsUtil approvalsUtil;
@ -289,7 +289,7 @@ public class ReceiveCommits {
final CreateChangeSender.Factory createChangeSenderFactory, final CreateChangeSender.Factory createChangeSenderFactory,
final MergedSender.Factory mergedSenderFactory, final MergedSender.Factory mergedSenderFactory,
final ReplacePatchSetSender.Factory replacePatchSetFactory, final ReplacePatchSetSender.Factory replacePatchSetFactory,
final GitReferenceUpdated replication, final GitReferenceUpdated gitRefUpdated,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
final ChangeHooks hooks, final ChangeHooks hooks,
final ApprovalsUtil approvalsUtil, final ApprovalsUtil approvalsUtil,
@ -316,7 +316,7 @@ public class ReceiveCommits {
this.createChangeSenderFactory = createChangeSenderFactory; this.createChangeSenderFactory = createChangeSenderFactory;
this.mergedSenderFactory = mergedSenderFactory; this.mergedSenderFactory = mergedSenderFactory;
this.replacePatchSetFactory = replacePatchSetFactory; this.replacePatchSetFactory = replacePatchSetFactory;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.hooks = hooks; this.hooks = hooks;
this.approvalsUtil = approvalsUtil; this.approvalsUtil = approvalsUtil;
@ -586,10 +586,10 @@ public class ReceiveCommits {
} }
if (!MagicBranch.isMagicBranch(c.getRefName())) { if (!MagicBranch.isMagicBranch(c.getRefName())) {
// We only schedule direct refs updates for replication. // We only fire gitRefUpdated for direct refs updates.
// Change refs are scheduled when they are created. // Events for change refs are fired when they are created.
// //
replication.fire(project.getNameKey(), c.getRefName(), gitRefUpdated.fire(project.getNameKey(), c.getRefName(),
c.getOldId(), c.getNewId()); c.getOldId(), c.getNewId());
hooks.doRefUpdatedHook( hooks.doRefUpdatedHook(
new Branch.NameKey(project.getNameKey(), c.getRefName()), new Branch.NameKey(project.getNameKey(), c.getRefName()),
@ -1384,7 +1384,7 @@ public class ReceiveCommits {
} }
created = true; created = true;
replication.fire(project.getNameKey(), ps.getRefName(), gitRefUpdated.fire(project.getNameKey(), ps.getRefName(),
ObjectId.zeroId(), commit); ObjectId.zeroId(), commit);
hooks.doPatchsetCreatedHook(change, ps, db); hooks.doPatchsetCreatedHook(change, ps, db);
workQueue.getDefaultQueue() workQueue.getDefaultQueue()
@ -1747,7 +1747,7 @@ public class ReceiveCommits {
if (cmd.getResult() == NOT_ATTEMPTED) { if (cmd.getResult() == NOT_ATTEMPTED) {
cmd.execute(rp); cmd.execute(rp);
} }
replication.fire(project.getNameKey(), newPatchSet.getRefName(), gitRefUpdated.fire(project.getNameKey(), newPatchSet.getRefName(),
ObjectId.zeroId(), newCommit); ObjectId.zeroId(), newCommit);
hooks.doPatchsetCreatedHook(change, newPatchSet, db); hooks.doPatchsetCreatedHook(change, newPatchSet, db);
if (mergedIntoRef != null) { if (mergedIntoRef != null) {

View File

@ -50,7 +50,7 @@ public class SubmitStrategyFactory {
private final PatchSetInfoFactory patchSetInfoFactory; private final PatchSetInfoFactory patchSetInfoFactory;
private final Provider<String> urlProvider; private final Provider<String> urlProvider;
private final ApprovalTypes approvalTypes; private final ApprovalTypes approvalTypes;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final RebaseChange rebaseChange; private final RebaseChange rebaseChange;
@Inject @Inject
@ -59,14 +59,14 @@ public class SubmitStrategyFactory {
@GerritPersonIdent final PersonIdent myIdent, @GerritPersonIdent final PersonIdent myIdent,
final PatchSetInfoFactory patchSetInfoFactory, final PatchSetInfoFactory patchSetInfoFactory,
@CanonicalWebUrl @Nullable final Provider<String> urlProvider, @CanonicalWebUrl @Nullable final Provider<String> urlProvider,
final ApprovalTypes approvalTypes, final GitReferenceUpdated replication, final ApprovalTypes approvalTypes, final GitReferenceUpdated gitRefUpdated,
final RebaseChange rebaseChange) { final RebaseChange rebaseChange) {
this.identifiedUserFactory = identifiedUserFactory; this.identifiedUserFactory = identifiedUserFactory;
this.myIdent = myIdent; this.myIdent = myIdent;
this.patchSetInfoFactory = patchSetInfoFactory; this.patchSetInfoFactory = patchSetInfoFactory;
this.urlProvider = urlProvider; this.urlProvider = urlProvider;
this.approvalTypes = approvalTypes; this.approvalTypes = approvalTypes;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
this.rebaseChange = rebaseChange; this.rebaseChange = rebaseChange;
} }
@ -82,7 +82,7 @@ public class SubmitStrategyFactory {
switch (submitType) { switch (submitType) {
case CHERRY_PICK: case CHERRY_PICK:
return new CherryPick(args, patchSetInfoFactory, urlProvider, return new CherryPick(args, patchSetInfoFactory, urlProvider,
approvalTypes, replication); approvalTypes, gitRefUpdated);
case FAST_FORWARD_ONLY: case FAST_FORWARD_ONLY:
return new FastForwardOnly(args); return new FastForwardOnly(args);
case MERGE_ALWAYS: case MERGE_ALWAYS:

View File

@ -85,7 +85,7 @@ public class SubmoduleOp {
private final Map<Change.Id, CodeReviewCommit> commits; private final Map<Change.Id, CodeReviewCommit> commits;
private final PersonIdent myIdent; private final PersonIdent myIdent;
private final GitRepositoryManager repoManager; private final GitRepositoryManager repoManager;
private final GitReferenceUpdated replication; private final GitReferenceUpdated gitRefUpdated;
private final SchemaFactory<ReviewDb> schemaFactory; private final SchemaFactory<ReviewDb> schemaFactory;
private final Set<Branch.NameKey> updatedSubscribers; private final Set<Branch.NameKey> updatedSubscribers;
@ -97,7 +97,7 @@ public class SubmoduleOp {
@Assisted Project destProject, @Assisted List<Change> submitted, @Assisted Project destProject, @Assisted List<Change> submitted,
@Assisted final Map<Change.Id, CodeReviewCommit> commits, @Assisted final Map<Change.Id, CodeReviewCommit> commits,
@GerritPersonIdent final PersonIdent myIdent, @GerritPersonIdent final PersonIdent myIdent,
GitRepositoryManager repoManager, GitReferenceUpdated replication) { GitRepositoryManager repoManager, GitReferenceUpdated gitRefUpdated) {
this.destBranch = destBranch; this.destBranch = destBranch;
this.mergeTip = mergeTip; this.mergeTip = mergeTip;
this.rw = rw; this.rw = rw;
@ -109,7 +109,7 @@ public class SubmoduleOp {
this.commits = commits; this.commits = commits;
this.myIdent = myIdent; this.myIdent = myIdent;
this.repoManager = repoManager; this.repoManager = repoManager;
this.replication = replication; this.gitRefUpdated = gitRefUpdated;
updatedSubscribers = new HashSet<Branch.NameKey>(); updatedSubscribers = new HashSet<Branch.NameKey>();
} }
@ -337,7 +337,7 @@ public class SubmoduleOp {
switch (rfu.update()) { switch (rfu.update()) {
case NEW: case NEW:
case FAST_FORWARD: case FAST_FORWARD:
replication.fire(subscriber.getParentKey(), rfu); gitRefUpdated.fire(subscriber.getParentKey(), rfu);
// TODO since this is performed "in the background" no mail will be // TODO since this is performed "in the background" no mail will be
// sent to inform users about the updated branch // sent to inform users about the updated branch
break; break;

View File

@ -260,7 +260,7 @@ public abstract class VersionedMetaData {
switch (result) { switch (result) {
case NEW: case NEW:
revision = rw.parseCommit(ru.getNewObjectId()); revision = rw.parseCommit(ru.getNewObjectId());
update.replicate(ru); update.fireGitRefUpdatedEvent(ru);
return revision; return revision;
default: default:
throw new IOException("Cannot update " + ru.getName() + " in " throw new IOException("Cannot update " + ru.getName() + " in "
@ -293,7 +293,7 @@ public abstract class VersionedMetaData {
case NEW: case NEW:
case FAST_FORWARD: case FAST_FORWARD:
revision = rw.parseCommit(ru.getNewObjectId()); revision = rw.parseCommit(ru.getNewObjectId());
update.replicate(ru); update.fireGitRefUpdatedEvent(ru);
return revision; return revision;
default: default:

View File

@ -77,7 +77,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
private ReviewDb schema; private ReviewDb schema;
private Provider<String> urlProvider; private Provider<String> urlProvider;
private GitRepositoryManager repoManager; private GitRepositoryManager repoManager;
private GitReferenceUpdated replication; private GitReferenceUpdated gitRefUpdated;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@ -90,17 +90,17 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
subscriptions = createStrictMock(SubmoduleSubscriptionAccess.class); subscriptions = createStrictMock(SubmoduleSubscriptionAccess.class);
urlProvider = createStrictMock(Provider.class); urlProvider = createStrictMock(Provider.class);
repoManager = createStrictMock(GitRepositoryManager.class); repoManager = createStrictMock(GitRepositoryManager.class);
replication = createStrictMock(GitReferenceUpdated.class); gitRefUpdated = createStrictMock(GitReferenceUpdated.class);
} }
private void doReplay() { private void doReplay() {
replay(schemaFactory, schema, subscriptions, urlProvider, repoManager, replay(schemaFactory, schema, subscriptions, urlProvider, repoManager,
replication); gitRefUpdated);
} }
private void doVerify() { private void doVerify() {
verify(schemaFactory, schema, subscriptions, urlProvider, repoManager, verify(schemaFactory, schema, subscriptions, urlProvider, repoManager,
replication); gitRefUpdated);
} }
/** /**
@ -645,7 +645,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
.andReturn(targetRepository); .andReturn(targetRepository);
Capture<RefUpdate> ruCapture = new Capture<RefUpdate>(); Capture<RefUpdate> ruCapture = new Capture<RefUpdate>();
replication.fire(eq(targetBranchNameKey.getParentKey()), gitRefUpdated.fire(eq(targetBranchNameKey.getParentKey()),
capture(ruCapture)); capture(ruCapture));
expect(schema.submoduleSubscriptions()).andReturn(subscriptions); expect(schema.submoduleSubscriptions()).andReturn(subscriptions);
@ -665,7 +665,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
new SubmoduleOp(sourceBranchNameKey, sourceMergeTip, new RevWalk( new SubmoduleOp(sourceBranchNameKey, sourceMergeTip, new RevWalk(
sourceRepository), urlProvider, schemaFactory, sourceRepository, sourceRepository), urlProvider, schemaFactory, sourceRepository,
new Project(sourceBranchNameKey.getParentKey()), submitted, new Project(sourceBranchNameKey.getParentKey()), submitted,
mergedCommits, myIdent, repoManager, replication); mergedCommits, myIdent, repoManager, gitRefUpdated);
submoduleOp.update(); submoduleOp.update();
@ -749,7 +749,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
.andReturn(targetRepository); .andReturn(targetRepository);
Capture<RefUpdate> ruCapture = new Capture<RefUpdate>(); Capture<RefUpdate> ruCapture = new Capture<RefUpdate>();
replication.fire(eq(targetBranchNameKey.getParentKey()), gitRefUpdated.fire(eq(targetBranchNameKey.getParentKey()),
capture(ruCapture)); capture(ruCapture));
expect(schema.submoduleSubscriptions()).andReturn(subscriptions); expect(schema.submoduleSubscriptions()).andReturn(subscriptions);
@ -771,7 +771,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
new SubmoduleOp(sourceBranchNameKey, sourceMergeTip, new RevWalk( new SubmoduleOp(sourceBranchNameKey, sourceMergeTip, new RevWalk(
sourceRepository), urlProvider, schemaFactory, sourceRepository, sourceRepository), urlProvider, schemaFactory, sourceRepository,
new Project(sourceBranchNameKey.getParentKey()), submitted, new Project(sourceBranchNameKey.getParentKey()), submitted,
mergedCommits, myIdent, repoManager, replication); mergedCommits, myIdent, repoManager, gitRefUpdated);
submoduleOp.update(); submoduleOp.update();