Fix parameters for debug logs that use Flogger's logVarargs method

Change-Id: I4fd19ff786063319c584f47090b62ed63555a6e6
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-06-07 09:27:54 +02:00
parent 3c1acebe1a
commit edb5c832d8
8 changed files with 104 additions and 115 deletions

View File

@@ -580,7 +580,7 @@ class ReceiveCommits {
replaceProgress.end();
if (!errors.isEmpty()) {
logDebug("Handling error conditions: {}", errors.keySet());
logDebug("Handling error conditions: %s", errors.keySet());
for (ReceiveError error : errors.keySet()) {
rp.sendMessage(buildError(error, errors.get(error)));
}
@@ -732,20 +732,20 @@ class ReceiveCommits {
bu.setRequestId(receiveId);
bu.setRefLogMessage("push");
logDebug("Adding {} replace requests", newChanges.size());
logDebug("Adding %d replace requests", newChanges.size());
for (ReplaceRequest replace : replaceByChange.values()) {
replace.addOps(bu, replaceProgress);
}
logDebug("Adding {} create requests", newChanges.size());
logDebug("Adding %d create requests", newChanges.size());
for (CreateRequest create : newChanges) {
create.addOps(bu);
}
logDebug("Adding {} group update requests", newChanges.size());
logDebug("Adding %d group update requests", newChanges.size());
updateGroups.forEach(r -> r.addOps(bu));
logDebug("Adding {} additional ref updates", actualCommands.size());
logDebug("Adding %d additional ref updates", actualCommands.size());
actualCommands.forEach(c -> bu.addRepoOnlyOp(new UpdateOneRefOp(c)));
logDebug("Executing batch");
@@ -841,11 +841,11 @@ class ReceiveCommits {
private void parseCommands(Collection<ReceiveCommand> commands)
throws PermissionBackendException, NoSuchProjectException, IOException {
logDebug("Parsing {} commands", commands.size());
logDebug("Parsing %d commands", commands.size());
for (ReceiveCommand cmd : commands) {
if (cmd.getResult() != NOT_ATTEMPTED) {
// Already rejected by the core receive process.
logDebug("Already processed by core: {} {}", cmd.getResult(), cmd);
logDebug("Already processed by core: %s %s", cmd.getResult(), cmd);
continue;
}
@@ -866,7 +866,7 @@ class ReceiveCommits {
if (projectState.isAllUsers() && RefNames.REFS_USERS_SELF.equals(cmd.getRefName())) {
String newName = RefNames.refsUsers(user.getAccountId());
logDebug("Swapping out command for {} to {}", RefNames.REFS_USERS_SELF, newName);
logDebug("Swapping out command for %s to %s", RefNames.REFS_USERS_SELF, newName);
final ReceiveCommand orgCmd = cmd;
cmd =
new ReceiveCommand(cmd.getOldId(), cmd.getNewId(), newName, cmd.getType()) {
@@ -897,11 +897,8 @@ class ReceiveCommits {
// migrate to NoteDb eventually, and we don't want garbage data waiting there when the
// migration finishes.
logDebug(
"{} NoteDb ref {} with {}={}",
cmd.getType(),
cmd.getRefName(),
NoteDbPushOption.OPTION_NAME,
noteDbPushOption);
"%s NoteDb ref %s with %s=%s",
cmd.getType(), cmd.getRefName(), NoteDbPushOption.OPTION_NAME, noteDbPushOption);
if (!Optional.of(NoteDbPushOption.ALLOW).equals(noteDbPushOption)) {
// Only reject this command, not the whole push. This supports the use case of "git clone
// --mirror" followed by "git push --mirror", when the user doesn't really intend to clone
@@ -950,7 +947,7 @@ class ReceiveCommits {
}
if (isConfig(cmd)) {
logDebug("Processing {} command", cmd.getRefName());
logDebug("Processing %s command", cmd.getRefName());
try {
permissions.check(ProjectPermission.WRITE_CONFIG);
} catch (AuthException e) {
@@ -1089,7 +1086,7 @@ class ReceiveCommits {
reject(cmd, "invalid object");
return;
}
logDebug("Creating {}", cmd);
logDebug("Creating %s", cmd);
if (isHead(cmd) && !isCommit(cmd)) {
return;
@@ -1115,7 +1112,7 @@ class ReceiveCommits {
}
private void parseUpdate(ReceiveCommand cmd) throws PermissionBackendException {
logDebug("Updating {}", cmd);
logDebug("Updating %s", cmd);
boolean ok;
try {
permissions.ref(cmd.getRefName()).check(RefPermission.UPDATE);
@@ -1160,7 +1157,7 @@ class ReceiveCommits {
}
private void parseDelete(ReceiveCommand cmd) throws PermissionBackendException {
logDebug("Deleting {}", cmd);
logDebug("Deleting %s", cmd);
if (cmd.getRefName().startsWith(REFS_CHANGES)) {
errors.put(ReceiveError.DELETE_CHANGES, cmd.getRefName());
reject(cmd, "cannot delete changes");
@@ -1204,7 +1201,7 @@ class ReceiveCommits {
reject(cmd, "invalid object");
return;
}
logDebug("Rewinding {}", cmd);
logDebug("Rewinding %s", cmd);
if (newObject != null) {
validateNewCommits(new Branch.NameKey(project.getNameKey(), cmd.getRefName()), cmd);
@@ -1509,7 +1506,7 @@ class ReceiveCommits {
return;
}
logDebug("Found magic branch {}", cmd.getRefName());
logDebug("Found magic branch %s", cmd.getRefName());
magicBranch = new MagicBranchInput(user, cmd, labelTypes, notesMigration);
magicBranch.reviewer.addAll(extraReviewers.get(ReviewerStateInternal.REVIEWER));
magicBranch.cc.addAll(extraReviewers.get(ReviewerStateInternal.CC));
@@ -1543,13 +1540,13 @@ class ReceiveCommits {
return;
}
if (projectState.isAllUsers() && RefNames.REFS_USERS_SELF.equals(ref)) {
logDebug("Handling {}", RefNames.REFS_USERS_SELF);
logDebug("Handling %s", RefNames.REFS_USERS_SELF);
ref = RefNames.refsUsers(user.getAccountId());
}
if (!rp.getAdvertisedRefs().containsKey(ref)
&& !ref.equals(readHEAD(repo))
&& !ref.equals(RefNames.REFS_CONFIG)) {
logDebug("Ref {} not found", ref);
logDebug("Ref %s not found", ref);
if (ref.startsWith(Constants.R_HEADS)) {
String n = ref.substring(Constants.R_HEADS.length());
reject(cmd, "branch " + n + " not found");
@@ -1622,7 +1619,7 @@ class ReceiveCommits {
RevCommit tip;
try {
tip = walk.parseCommit(magicBranch.cmd.getNewId());
logDebug("Tip of push: {}", tip.name());
logDebug("Tip of push: %s", tip.name());
} catch (IOException ex) {
magicBranch.cmd.setResult(REJECTED_MISSING_OBJECT);
logError("Invalid pack upload; one or more objects weren't sent", ex);
@@ -1657,7 +1654,7 @@ class ReceiveCommits {
}
if (magicBranch.base != null) {
logDebug("Handling %base: {}", magicBranch.base);
logDebug("Handling %base: %s", magicBranch.base);
magicBranch.baseCommit = Lists.newArrayListWithCapacity(magicBranch.base.size());
for (ObjectId id : magicBranch.base) {
try {
@@ -1680,7 +1677,7 @@ class ReceiveCommits {
return; // readBranchTip already rejected cmd.
}
magicBranch.baseCommit = Collections.singletonList(branchTip);
logDebug("Set baseCommit = {}", magicBranch.baseCommit.get(0).name());
logDebug("Set baseCommit = %s", magicBranch.baseCommit.get(0).name());
}
} catch (IOException ex) {
logWarn(
@@ -1704,7 +1701,7 @@ class ReceiveCommits {
return;
}
RevCommit h = walk.parseCommit(targetRef.getObjectId());
logDebug("Current branch tip: {}", h.name());
logDebug("Current branch tip: %s", h.name());
RevFilter oldRevFilter = walk.getRevFilter();
try {
walk.reset();
@@ -1752,7 +1749,7 @@ class ReceiveCommits {
RevCommit newCommit;
try {
newCommit = rp.getRevWalk().parseCommit(cmd.getNewId());
logDebug("Replacing with {}", newCommit);
logDebug("Replacing with %s", newCommit);
} catch (IOException e) {
logError("Cannot parse " + cmd.getNewId().name() + " as commit", e);
reject(cmd, "invalid commit");
@@ -1776,7 +1773,7 @@ class ReceiveCommits {
return;
}
logDebug("Replacing change {}", changeEnt.getId());
logDebug("Replacing change %s", changeEnt.getId());
requestReplace(cmd, true, changeEnt, newCommit);
}
@@ -1885,7 +1882,7 @@ class ReceiveCommits {
}
int n = pending.size() + newChanges.size();
if (maxBatchChanges != 0 && n > maxBatchChanges) {
logDebug("{} changes exceeds limit of {}", n, maxBatchChanges);
logDebug("%d changes exceeds limit of %d", n, maxBatchChanges);
reject(
magicBranch.cmd,
"the number of pushed changes in a batch exceeds the max limit " + maxBatchChanges);
@@ -1905,7 +1902,7 @@ class ReceiveCommits {
continue;
}
logDebug("Creating new change for {} even though it is already tracked", name);
logDebug("Creating new change for %s even though it is already tracked", name);
}
if (!validCommit(
@@ -1922,7 +1919,7 @@ class ReceiveCommits {
magicBranch.cmd,
"Pushing merges in commit chains with 'all not in target' is not allowed,\n"
+ "to override please set the base manually");
logDebug("Rejecting merge commit {} with newChangeForAllNotInTarget", name);
logDebug("Rejecting merge commit %s with newChangeForAllNotInTarget", name);
// TODO(dborowitz): Should we early return here?
}
@@ -1932,13 +1929,10 @@ class ReceiveCommits {
}
}
logDebug(
"Finished initial RevWalk with {} commits total: {} already"
+ " tracked, {} new changes with no Change-Id, and {} deferred"
"Finished initial RevWalk with %d commits total: %d already"
+ " tracked, %d new changes with no Change-Id, and %d deferred"
+ " lookups",
total,
alreadyTracked,
newChanges.size(),
pending.size());
total, alreadyTracked, newChanges.size(), pending.size());
if (rejectImplicitMerges) {
rejectImplicitMerges(mergedParents);
@@ -1951,7 +1945,7 @@ class ReceiveCommits {
}
if (newChangeIds.contains(p.changeKey)) {
logDebug("Multiple commits with Change-Id {}", p.changeKey);
logDebug("Multiple commits with Change-Id %s", p.changeKey);
reject(magicBranch.cmd, SAME_CHANGE_ID_IN_MULTIPLE_CHANGES);
newChanges = Collections.emptyList();
return;
@@ -1960,7 +1954,7 @@ class ReceiveCommits {
List<ChangeData> changes = p.destChanges;
if (changes.size() > 1) {
logDebug(
"Multiple changes in branch {} with Change-Id {}: {}",
"Multiple changes in branch %s with Change-Id %s: %s",
magicBranch.dest,
p.changeKey,
changes.stream().map(cd -> cd.getId().toString()).collect(joining()));
@@ -2022,9 +2016,8 @@ class ReceiveCommits {
newChanges.add(new CreateRequest(p.commit, magicBranch.dest.get()));
}
logDebug(
"Finished deferred lookups with {} updates and {} new changes",
replaceByChange.size(),
newChanges.size());
"Finished deferred lookups with %d updates and %d new changes",
replaceByChange.size(), newChanges.size());
} catch (IOException e) {
// Should never happen, the core receive process would have
// identified the missing object earlier before we got control.
@@ -2077,7 +2070,7 @@ class ReceiveCommits {
notesFactory.create(db, project.getNameKey(), Change.Id.fromRef(ref.getName()));
Change change = notes.getChange();
if (change.getDest().equals(magicBranch.dest)) {
logDebug("Found change {} from existing refs.", change.getKey());
logDebug("Found change %s from existing refs.", change.getKey());
// Reindex the change asynchronously, ignoring errors.
@SuppressWarnings("unused")
Future<?> possiblyIgnoredError = indexer.indexAsync(project.getNameKey(), change.getId());
@@ -2098,7 +2091,7 @@ class ReceiveCommits {
if (magicBranch.baseCommit != null) {
markExplicitBasesUninteresting();
} else if (magicBranch.merged) {
logDebug("Marking parents of merged commit {} uninteresting", start.name());
logDebug("Marking parents of merged commit %s uninteresting", start.name());
for (RevCommit c : start.getParents()) {
rw.markUninteresting(c);
}
@@ -2109,16 +2102,15 @@ class ReceiveCommits {
}
private void markExplicitBasesUninteresting() throws IOException {
logDebug("Marking {} base commits uninteresting", magicBranch.baseCommit.size());
logDebug("Marking %d base commits uninteresting", magicBranch.baseCommit.size());
for (RevCommit c : magicBranch.baseCommit) {
rp.getRevWalk().markUninteresting(c);
}
Ref targetRef = allRefs().get(magicBranch.dest.get());
if (targetRef != null) {
logDebug(
"Marking target ref {} ({}) uninteresting",
magicBranch.dest.get(),
targetRef.getObjectId().name());
"Marking target ref %s (%s) uninteresting",
magicBranch.dest.get(), targetRef.getObjectId().name());
rp.getRevWalk().markUninteresting(rp.getRevWalk().parseCommit(targetRef.getObjectId()));
}
}
@@ -2170,7 +2162,7 @@ class ReceiveCommits {
}
}
}
logDebug("Marked {} heads as uninteresting", i);
logDebug("Marked %d heads as uninteresting", i);
}
private static boolean isValidChangeId(String idStr) {
@@ -2314,7 +2306,7 @@ class ReceiveCommits {
checkNotNull(
tipChange, "tip of push does not correspond to a change; found these changes: %s", bySha);
logDebug(
"Processing submit with tip change {} ({})", tipChange.getId(), magicBranch.cmd.getNewId());
"Processing submit with tip change %s (%s)", tipChange.getId(), magicBranch.cmd.getNewId());
try (MergeOp op = mergeOpProvider.get()) {
op.merge(db, tipChange, user, false, new SubmitInput(), false);
}
@@ -2353,7 +2345,7 @@ class ReceiveCommits {
}
}
}
logDebug("Read {} changes to replace", replaceByChange.size());
logDebug("Read %d changes to replace", replaceByChange.size());
if (magicBranch != null && magicBranch.cmd.getResult() != NOT_ATTEMPTED) {
// Cancel creations tied to refs/for/ or refs/drafts/ command.
@@ -2689,7 +2681,7 @@ class ReceiveCommits {
public void postUpdate(Context ctx) {
String refName = cmd.getRefName();
if (cmd.getType() == ReceiveCommand.Type.UPDATE) { // aka fast-forward
logDebug("Updating tag cache on fast-forward of {}", cmd.getRefName());
logDebug("Updating tag cache on fast-forward of %s", cmd.getRefName());
tagCache.updateFastForward(project.getNameKey(), refName, cmd.getOldId(), cmd.getNewId());
}
if (isConfig(cmd)) {
@@ -2841,7 +2833,7 @@ class ReceiveCommits {
int n = 0;
for (RevCommit c; (c = walk.next()) != null; ) {
if (++n > limit) {
logDebug("Number of new commits exceeds limit of {}", limit);
logDebug("Number of new commits exceeds limit of %d", limit);
addMessage(
String.format(
"Cannot push more than %d commits to %s without %s option "
@@ -2862,7 +2854,7 @@ class ReceiveCommits {
missingFullName = false;
}
}
logDebug("Validated {} new commits", n);
logDebug("Validated %d new commits", n);
} catch (IOException err) {
cmd.setResult(REJECTED_MISSING_OBJECT);
logError("Invalid pack upload; one or more objects weren't sent", err);
@@ -2899,7 +2891,7 @@ class ReceiveCommits {
perm, branch, user.asIdentifiedUser(), sshInfo, repo, rw, change);
messages.addAll(validators.validate(receiveEvent));
} catch (CommitValidationException e) {
logDebug("Commit validation failed on {}", c.name());
logDebug("Commit validation failed on %s", c.name());
messages.addAll(e.getMessages());
reject(cmd, e.getMessage());
return false;
@@ -2982,7 +2974,7 @@ class ReceiveCommits {
for (ReplaceRequest req : replaceAndClose) {
Change.Id id = req.notes.getChangeId();
if (!executeRequestValidation(() -> req.validate(true))) {
logDebug("Not closing {} because validation failed", id);
logDebug("Not closing %s because validation failed", id);
continue;
}
req.addOps(bu, null);
@@ -2995,9 +2987,8 @@ class ReceiveCommits {
}
logDebug(
"Auto-closing {} changes with existing patch sets and {} with new patch sets",
existingPatchSets,
newPatchSets);
"Auto-closing %s changes with existing patch sets and %s with new patch sets",
existingPatchSets, newPatchSets);
bu.execute();
} catch (IOException | OrmException | PermissionBackendException e) {
logError("Failed to auto-close changes", e);

View File

@@ -62,7 +62,7 @@ public class GitModules {
throws IOException {
this.submissionId = orm.getSubmissionId();
Project.NameKey project = branch.getParentKey();
logDebug("Loading .gitmodules of {} for project {}", branch, project);
logDebug("Loading .gitmodules of %s for project %s", branch, project);
try {
OpenRepo or = orm.getRepo(project);
ObjectId id = or.repo.resolve(branch.get());
@@ -74,7 +74,7 @@ public class GitModules {
try (TreeWalk tw = TreeWalk.forPath(or.repo, GIT_MODULES, commit.getTree())) {
if (tw == null || (tw.getRawMode(0) & FileMode.TYPE_MASK) != FileMode.TYPE_FILE) {
subscriptions = Collections.emptySet();
logDebug("The .gitmodules file doesn't exist in " + branch);
logDebug("The .gitmodules file doesn't exist in %s", branch);
return;
}
}
@@ -92,11 +92,11 @@ public class GitModules {
}
public Collection<SubmoduleSubscription> subscribedTo(Branch.NameKey src) {
logDebug("Checking for a subscription of " + src);
logDebug("Checking for a subscription of %s", src);
Collection<SubmoduleSubscription> ret = new ArrayList<>();
for (SubmoduleSubscription s : subscriptions) {
if (s.getSubmodule().equals(src)) {
logDebug("Found " + s);
logDebug("Found %s", s);
ret.add(s);
}
}

View File

@@ -443,7 +443,7 @@ public class MergeOp implements AutoCloseable {
this.db = db;
openRepoManager();
logDebug("Beginning integration of {}", change);
logDebug("Beginning integration of %s", change);
try {
ChangeSet indexBackedChangeSet =
mergeSuperSet.setMergeOpRepoManager(orm).completeChangeSet(db, change, caller);
@@ -456,7 +456,7 @@ public class MergeOp implements AutoCloseable {
throw new AuthException(
"A change to be submitted with " + change.getId() + " is not visible");
}
logDebug("Calculated to merge {}", indexBackedChangeSet);
logDebug("Calculated to merge %s", indexBackedChangeSet);
// Reload ChangeSet so that we don't rely on (potentially) stale index data for merging
ChangeSet cs = reloadChanges(indexBackedChangeSet);
@@ -475,7 +475,7 @@ public class MergeOp implements AutoCloseable {
long attempt = retryTracker.lastAttemptNumber + 1;
boolean isRetry = attempt > 1;
if (isRetry) {
logDebug("Retrying, attempt #{}; skipping merged changes", attempt);
logDebug("Retrying, attempt #%d; skipping merged changes", attempt);
this.ts = TimeUtil.nowTs();
openRepoManager();
}
@@ -565,7 +565,7 @@ public class MergeOp implements AutoCloseable {
private void integrateIntoHistory(ChangeSet cs)
throws IntegrationException, RestApiException, UpdateException {
checkArgument(!cs.furtherHiddenChanges(), "cannot integrate hidden changes into history");
logDebug("Beginning merge attempt on {}", cs);
logDebug("Beginning merge attempt on %s", cs);
Map<Branch.NameKey, BranchBatch> toSubmit = new HashMap<>();
ListMultimap<Branch.NameKey, ChangeData> cbb;
@@ -707,7 +707,7 @@ public class MergeOp implements AutoCloseable {
throw new IntegrationException("Failed to determine already accepted commits.", e);
}
logDebug("Found {} existing heads", alreadyAccepted.size());
logDebug("Found %d existing heads", alreadyAccepted.size());
return alreadyAccepted;
}
@@ -721,7 +721,7 @@ public class MergeOp implements AutoCloseable {
private BranchBatch validateChangeList(OpenRepo or, Collection<ChangeData> submitted)
throws IntegrationException {
logDebug("Validating {} changes", submitted.size());
logDebug("Validating %d changes", submitted.size());
Set<CodeReviewCommit> toSubmit = new LinkedHashSet<>(submitted.size());
SetMultimap<ObjectId, PatchSet.Id> revisions = getRevisions(or, submitted);
@@ -826,7 +826,7 @@ public class MergeOp implements AutoCloseable {
commit.add(or.canMergeFlag);
toSubmit.add(commit);
}
logDebug("Submitting on this run: {}", toSubmit);
logDebug("Submitting on this run: %s", toSubmit);
return new AutoValue_MergeOp_BranchBatch(submitType, toSubmit);
}

View File

@@ -102,7 +102,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
@Override
public final void updateRepo(RepoContext ctx) throws Exception {
logDebug("{}#updateRepo for change {}", getClass().getSimpleName(), toMerge.change().getId());
logDebug("%s#updateRepo for change %s", getClass().getSimpleName(), toMerge.change().getId());
checkState(
ctx.getRevWalk() == args.rw,
"SubmitStrategyOp requires callers to call BatchUpdate#setRepository with exactly the same"
@@ -116,7 +116,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
if (alreadyMergedCommit == null) {
updateRepoImpl(ctx);
} else {
logDebug("Already merged as {}", alreadyMergedCommit.name());
logDebug("Already merged as %s", alreadyMergedCommit.name());
}
CodeReviewCommit tipAfter = args.mergeTip.getCurrentTip();
@@ -127,7 +127,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
logDebug("No merge tip, no update to perform");
return;
}
logDebug("Moved tip from {} to {}", tipBefore, tipAfter);
logDebug("Moved tip from %s to %s", tipBefore, tipAfter);
checkProjectConfig(ctx, tipAfter);
@@ -143,7 +143,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
throws IntegrationException {
String refName = getDest().get();
if (RefNames.REFS_CONFIG.equals(refName)) {
logDebug("Loading new configuration from {}", RefNames.REFS_CONFIG);
logDebug("Loading new configuration from %s", RefNames.REFS_CONFIG);
try {
ProjectConfig cfg = new ProjectConfig(getProject());
cfg.load(ctx.getRevWalk(), commit);
@@ -215,7 +215,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
@Override
public final boolean updateChange(ChangeContext ctx) throws Exception {
logDebug("{}#updateChange for change {}", getClass().getSimpleName(), toMerge.change().getId());
logDebug("%s#updateChange for change %s", getClass().getSimpleName(), toMerge.change().getId());
toMerge.setNotes(ctx.getNotes()); // Update change and notes from ctx.
PatchSet.Id oldPsId = checkNotNull(toMerge.getPatchsetId());
PatchSet.Id newPsId;
@@ -226,7 +226,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
if (alreadyMergedCommit == null) {
logDebug(
"Change is already merged according to its status, but we were unable to find it"
+ " merged into the current tip ({})",
+ " merged into the current tip (%s)",
args.mergeTip.getCurrentTip().name());
} else {
logDebug("Change is already merged");
@@ -275,7 +275,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
checkNotNull(commit, "missing commit for change " + id);
CommitMergeStatus s = commit.getStatusCode();
checkNotNull(s, "status not set for change " + id + " expected to previously fail fast");
logDebug("Status of change {} ({}) on {}: {}", id, commit.name(), c.getDest(), s);
logDebug("Status of change %s (%s) on %s: %s", id, commit.name(), c.getDest(), s);
setApproval(ctx, args.caller);
mergeResultRev =
@@ -301,7 +301,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
private PatchSet getOrCreateAlreadyMergedPatchSet(ChangeContext ctx)
throws IOException, OrmException {
PatchSet.Id psId = alreadyMergedCommit.getPatchsetId();
logDebug("Fixing up already-merged patch set {}", psId);
logDebug("Fixing up already-merged patch set %s", psId);
PatchSet prevPs = args.psUtil.current(ctx.getDb(), ctx.getNotes());
ctx.getRevWalk().parseBody(alreadyMergedCommit);
ctx.getChange()
@@ -335,7 +335,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
PatchSet.Id oldPsId = toMerge.getPatchsetId();
PatchSet.Id newPsId = ctx.getChange().currentPatchSetId();
logDebug("Add approval for " + id);
logDebug("Add approval for %s", id);
ChangeUpdate origPsUpdate = ctx.getUpdate(oldPsId);
origPsUpdate.putReviewer(user.getAccountId(), REVIEWER);
LabelNormalizer.Result normalized = approve(ctx, origPsUpdate);
@@ -401,7 +401,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
// change happened.
for (PatchSetApproval psa : normalized.unchanged()) {
if (includeUnchanged || psa.isLegacySubmit()) {
logDebug("Adding submit label " + psa);
logDebug("Adding submit label %s", psa);
update.putApprovalFor(psa.getAccountId(), psa.getLabel(), psa.getValue());
}
}
@@ -492,7 +492,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
private void setMerged(ChangeContext ctx, ChangeMessage msg) throws OrmException {
Change c = ctx.getChange();
ReviewDb db = ctx.getDb();
logDebug("Setting change {} merged", c.getId());
logDebug("Setting change %s merged", c.getId());
c.setStatus(Change.Status.MERGED);
c.setSubmissionId(args.submissionId.toStringForStorage());
@@ -515,7 +515,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
// If we naively execute postUpdate even if the change is already merged when updateChange
// being, then we are subject to a race where postUpdate steps are run twice if two submit
// processes run at the same time.
logDebug("Skipping post-update steps for change {}", getId());
logDebug("Skipping post-update steps for change %s", getId());
return;
}
postUpdateImpl(ctx);

View File

@@ -212,7 +212,7 @@ public class SubmoduleOp {
LinkedHashSet<Branch.NameKey> currentVisited,
LinkedHashSet<Branch.NameKey> allVisited)
throws SubmoduleException {
logDebug("Now processing " + current);
logDebug("Now processing %s", current);
if (currentVisited.contains(current)) {
throw new SubmoduleException(
@@ -274,9 +274,9 @@ public class SubmoduleOp {
private Collection<Branch.NameKey> getDestinationBranches(Branch.NameKey src, SubscribeSection s)
throws IOException {
Collection<Branch.NameKey> ret = new HashSet<>();
logDebug("Inspecting SubscribeSection " + s);
logDebug("Inspecting SubscribeSection %s", s);
for (RefSpec r : s.getMatchingRefSpecs()) {
logDebug("Inspecting [matching] ref " + r);
logDebug("Inspecting [matching] ref %s", r);
if (!r.matchSource(src.get())) {
continue;
}
@@ -294,7 +294,7 @@ public class SubmoduleOp {
}
for (RefSpec r : s.getMultiMatchRefSpecs()) {
logDebug("Inspecting [all] ref " + r);
logDebug("Inspecting [all] ref %s", r);
if (!r.matchSource(src.get())) {
continue;
}
@@ -318,17 +318,17 @@ public class SubmoduleOp {
}
}
}
logDebug("Returning possible branches: " + ret + "for project " + s.getProject());
logDebug("Returning possible branches: %s for project %s", ret, s.getProject());
return ret;
}
public Collection<SubmoduleSubscription> superProjectSubscriptionsForSubmoduleBranch(
Branch.NameKey srcBranch) throws IOException {
logDebug("Calculating possible superprojects for " + srcBranch);
logDebug("Calculating possible superprojects for %s", srcBranch);
Collection<SubmoduleSubscription> ret = new ArrayList<>();
Project.NameKey srcProject = srcBranch.getParentKey();
for (SubscribeSection s : projectCache.get(srcProject).getSubscribeSections(srcBranch)) {
logDebug("Checking subscribe section " + s);
logDebug("Checking subscribe section %s", s);
Collection<Branch.NameKey> branches = getDestinationBranches(srcBranch, s);
for (Branch.NameKey targetBranch : branches) {
Project.NameKey targetProject = targetBranch.getParentKey();
@@ -336,11 +336,11 @@ public class SubmoduleOp {
OpenRepo or = orm.getRepo(targetProject);
ObjectId id = or.repo.resolve(targetBranch.get());
if (id == null) {
logDebug("The branch " + targetBranch + " doesn't exist.");
logDebug("The branch %s doesn't exist.", targetBranch);
continue;
}
} catch (NoSuchProjectException e) {
logDebug("The project " + targetProject + " doesn't exist");
logDebug("The project %s doesn't exist", targetProject);
continue;
}
@@ -352,7 +352,7 @@ public class SubmoduleOp {
ret.addAll(m.subscribedTo(srcBranch));
}
}
logDebug("Calculated superprojects for " + srcBranch + " are " + ret);
logDebug("Calculated superprojects for %s are %s", srcBranch, ret);
return ret;
}

View File

@@ -41,7 +41,7 @@ class TestHelperOp implements BatchUpdateOp {
public void updateRepo(RepoContext ctx) throws IOException {
Queue<Boolean> q = input.generateLockFailures;
if (q != null && !q.isEmpty() && q.remove()) {
logDebug("Adding bogus ref update to trigger lock failure, via change {}", changeId);
logDebug("Adding bogus ref update to trigger lock failure, via change %s", changeId);
ctx.addRefUpdate(
ObjectId.fromString("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"),
ObjectId.zeroId(),

View File

@@ -303,13 +303,13 @@ public class NoteDbBatchUpdate extends BatchUpdate {
private void executeUpdateRepo() throws UpdateException, RestApiException {
try {
logDebug("Executing updateRepo on {} ops", ops.size());
logDebug("Executing updateRepo on %d ops", ops.size());
RepoContextImpl ctx = new RepoContextImpl();
for (BatchUpdateOp op : ops.values()) {
op.updateRepo(ctx);
}
logDebug("Executing updateRepo on {} RepoOnlyOps", repoOnlyOps.size());
logDebug("Executing updateRepo on %d RepoOnlyOps", repoOnlyOps.size());
for (RepoOnlyOp op : repoOnlyOps) {
op.updateRepo(ctx);
}
@@ -358,7 +358,7 @@ public class NoteDbBatchUpdate extends BatchUpdate {
if (dryrun) {
return ImmutableList.of();
}
logDebug("Reindexing {} changes", results.size());
logDebug("Reindexing %d changes", results.size());
List<com.google.common.util.concurrent.CheckedFuture<?, IOException>> indexFutures =
new ArrayList<>(results.size());
for (Map.Entry<Change.Id, ChangeResult> e : results.entrySet()) {
@@ -405,7 +405,7 @@ public class NoteDbBatchUpdate extends BatchUpdate {
Change.Id id = e.getKey();
ChangeContextImpl ctx = newChangeContext(id);
boolean dirty = false;
logDebug("Applying {} ops for change {}", e.getValue().size(), id);
logDebug("Applying %d ops for change %s", e.getValue().size(), id);
for (BatchUpdateOp op : e.getValue()) {
dirty |= op.updateChange(ctx);
}
@@ -418,7 +418,7 @@ public class NoteDbBatchUpdate extends BatchUpdate {
handle.manager.add(u);
}
if (ctx.deleted) {
logDebug("Change {} was deleted", id);
logDebug("Change %s was deleted", id);
handle.manager.deleteChange(id);
handle.setResult(id, ChangeResult.DELETED);
} else {
@@ -429,7 +429,7 @@ public class NoteDbBatchUpdate extends BatchUpdate {
}
private ChangeContextImpl newChangeContext(Change.Id id) throws OrmException {
logDebug("Opening change {} for update", id);
logDebug("Opening change %s for update", id);
Change c = newChanges.get(id);
boolean isNew = c != null;
if (!isNew) {
@@ -438,7 +438,7 @@ public class NoteDbBatchUpdate extends BatchUpdate {
// TODO(dborowitz): This dance made more sense when using Reviewdb; consider a nicer way.
c = ChangeNotes.Factory.newNoteDbOnlyChange(project, id);
} else {
logDebug("Change {} is new", id);
logDebug("Change %s is new", id);
}
ChangeNotes notes = changeNotesFactory.createForBatchUpdate(c, !isNew);
return new ChangeContextImpl(notes);

View File

@@ -368,13 +368,13 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
private void executeUpdateRepo() throws UpdateException, RestApiException {
try {
logDebug("Executing updateRepo on {} ops", ops.size());
logDebug("Executing updateRepo on %d ops", ops.size());
RepoContextImpl ctx = new RepoContextImpl();
for (BatchUpdateOp op : ops.values()) {
op.updateRepo(ctx);
}
logDebug("Executing updateRepo on {} RepoOnlyOps", repoOnlyOps.size());
logDebug("Executing updateRepo on %d RepoOnlyOps", repoOnlyOps.size());
for (RepoOnlyOp op : repoOnlyOps) {
op.updateRepo(ctx);
}
@@ -416,7 +416,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
if (user.isIdentifiedUser()) {
batchRefUpdate.setRefLogIdent(user.asIdentifiedUser().newRefLogIdent(when, tz));
}
logDebug("Executing batch of {} ref updates", batchRefUpdate.getCommands().size());
logDebug("Executing batch of %d ref updates", batchRefUpdate.getCommands().size());
if (dryrun) {
return;
}
@@ -444,7 +444,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
boolean success = false;
Stopwatch sw = Stopwatch.createStarted();
try {
logDebug("Executing change ops (parallel? {})", parallel);
logDebug("Executing change ops (parallel? %s)", parallel);
ListeningExecutorService executor =
parallel ? changeUpdateExector : MoreExecutors.newDirectExecutorService();
@@ -468,13 +468,13 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
new ChangeTask(e.getKey(), e.getValue(), Thread.currentThread(), dryrun);
tasks.add(task);
if (!parallel) {
logDebug("Direct execution of task for ops: {}", ops);
logDebug("Direct execution of task for ops: %s", ops);
}
futures.add(executor.submit(task));
}
if (parallel) {
logDebug(
"Waiting on futures for {} ops spanning {} changes", ops.size(), ops.keySet().size());
"Waiting on futures for %d ops spanning %d changes", ops.size(), ops.keySet().size());
}
Futures.allAsList(futures).get();
@@ -520,7 +520,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
//
// See the comments in NoteDbUpdateManager#execute() for why we execute the
// updates on the change repo first.
logDebug("Executing NoteDb updates for {} changes", tasks.size());
logDebug("Executing NoteDb updates for %d changes", tasks.size());
try {
initRepository();
BatchRefUpdate changeRefUpdate = repoView.getRepository().getRefDatabase().newBatchUpdate();
@@ -529,7 +529,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
int objs = 0;
for (ChangeTask task : tasks) {
if (task.noteDbResult == null) {
logDebug("No-op update to {}", task.id);
logDebug("No-op update to %s", task.id);
continue;
}
for (ReceiveCommand cmd : task.noteDbResult.changeCommands()) {
@@ -542,9 +542,8 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
hasAllUsersCommands |= !task.noteDbResult.allUsersCommands().isEmpty();
}
logDebug(
"Collected {} objects and {} ref updates to change repo",
objs,
changeRefUpdate.getCommands().size());
"Collected %d objects and %d ref updates to change repo",
objs, changeRefUpdate.getCommands().size());
executeNoteDbUpdate(getRevWalk(), ins, changeRefUpdate);
}
@@ -563,9 +562,8 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
}
}
logDebug(
"Collected {} objects and {} ref updates to All-Users",
objs,
allUsersRefUpdate.getCommands().size());
"Collected %d objects and %d ref updates to All-Users",
objs, allUsersRefUpdate.getCommands().size());
executeNoteDbUpdate(allUsersRw, allUsersIns, allUsersRefUpdate);
}
} else {
@@ -669,7 +667,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
}
// Call updateChange on each op.
logDebug("Calling updateChange on {} ops", changeOps.size());
logDebug("Calling updateChange on %s ops", changeOps.size());
for (BatchUpdateOp op : changeOps) {
dirty |= op.updateChange(ctx);
}
@@ -707,7 +705,7 @@ public class ReviewDbBatchUpdate extends BatchUpdate {
db.commit();
}
} else {
logDebug("Skipping ReviewDb write since primary storage is {}", storage);
logDebug("Skipping ReviewDb write since primary storage is %s", storage);
}
} finally {
db.rollback();