Merge "Bazel: Remove version suffix from servlet-api-3_1 rule" into stable-3.0
diff --git a/Documentation/error-no-new-changes.txt b/Documentation/error-no-new-changes.txt
index 17422ad..45586c3 100644
--- a/Documentation/error-no-new-changes.txt
+++ b/Documentation/error-no-new-changes.txt
@@ -22,8 +22,8 @@
 this simply paste the commit ID in the Gerrit Web UI into the search
 field. Details about how to search in Gerrit are explained link:user-search.html[here].
 
-Please note that each commit can really be pushed only once. This
-means:
+Please note that generally it only makes sense for each commit to
+be pushed only once. This means:
 
 . you cannot push a commit again even if the change for which the
   commit was pushed before was abandoned (but you may restore the
@@ -31,14 +31,18 @@
 . you cannot reset a change to an old patch set by pushing the old
   commit for this change again
 . if a commit was pushed to one branch you cannot push this commit
-  to another branch in project scope.
+  to another branch in project scope (see link:user-upload.html#base[exception]).
 . if a commit was pushed directly to a branch (without going through
   code review) you cannot push this commit once again for code
   review (please note that in this case searching by the commit ID
-  in the Gerrit Web UI will not find any change)
+  in the Gerrit Web UI will not find any change), see
+  link:user-upload.html#base[exception].
 
 If you need to re-push a commit you may rewrite this commit by
-link:http://www.kernel.org/pub/software/scm/git/docs/git-commit.html[amending] it or doing an interactive link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[git rebase]. By rewriting the
+link:http://www.kernel.org/pub/software/scm/git/docs/git-commit.html[amending]
+it or doing an interactive
+link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[git
+rebase], or see link:user-upload.html#base[exception]. By rewriting the
 commit you actually create a new commit (with a new commit ID in
 project scope) which can then be pushed to Gerrit.
 
@@ -46,6 +50,13 @@
 the old commit (case 1 above), you also need to replace it with a new
 Change-Id, otherwise the push will fail with another error message.
 
+Sometimes a change no longer makes sense to be destined for a specific
+branch, and instead of trying to re-push the commit for a different
+branch, it makes more sense to move the change to the preferred branch
+(where it will now likely need a rebase). Moving the change instead of
+pushing a rebased commit to the preferred branch helps to retain code
+review comments and any previous patchsets on the original change.
+
 == Fast-forward merges
 
 You will also encounter this error if you did a Fast-forward merge
diff --git a/java/com/google/gerrit/server/notedb/IntBlob.java b/java/com/google/gerrit/server/notedb/IntBlob.java
index 6305a54..cbc933c 100644
--- a/java/com/google/gerrit/server/notedb/IntBlob.java
+++ b/java/com/google/gerrit/server/notedb/IntBlob.java
@@ -20,6 +20,7 @@
 import com.google.auto.value.AutoValue;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.CharMatcher;
+import com.google.common.flogger.FluentLogger;
 import com.google.common.primitives.Ints;
 import com.google.gerrit.common.Nullable;
 import com.google.gerrit.exceptions.StorageException;
@@ -41,6 +42,8 @@
 
 @AutoValue
 public abstract class IntBlob {
+  private static final FluentLogger logger = FluentLogger.forEnclosingClass();
+
   public static Optional<IntBlob> parse(Repository repo, String refName) throws IOException {
     try (ObjectReader or = repo.newObjectReader()) {
       return parse(repo, refName, or);
@@ -84,8 +87,13 @@
       throws IOException {
     ObjectId newId;
     try (ObjectInserter ins = repo.newObjectInserter()) {
+      logger.atFine().log(
+          "storing value %d on %s in %s (oldId: %s)",
+          val, refName, projectName, oldId == null ? "null" : oldId.name());
       newId = ins.insert(OBJ_BLOB, Integer.toString(val).getBytes(UTF_8));
       ins.flush();
+      logger.atFine().log(
+          "successfully stored %d on %s as %s in %s", val, refName, newId.name(), projectName);
     }
     RefUpdate ru = repo.updateRef(refName);
     if (oldId != null) {
diff --git a/java/com/google/gerrit/server/notedb/RepoSequence.java b/java/com/google/gerrit/server/notedb/RepoSequence.java
index d85380f..68b2b95 100644
--- a/java/com/google/gerrit/server/notedb/RepoSequence.java
+++ b/java/com/google/gerrit/server/notedb/RepoSequence.java
@@ -227,6 +227,7 @@
   private void acquire(int count) {
     try (Repository repo = repoManager.openRepository(projectName);
         RevWalk rw = new RevWalk(repo)) {
+      logger.atFine().log("acquire %d ids on %s in %s", count, refName, projectName);
       TryAcquire attempt = new TryAcquire(repo, rw, count);
       RefUpdateUtil.checkResult(retryer.call(attempt));
       counter = attempt.next;