git-codereview: explicitly include the codereview subcommand in suggested commands

If a user does not have the recommended aliases in their .gitconfig, the suggested
command will not work. Several suggestions have the codereview subcommand already;
this change updates all suggestions to include it.

Change-Id: I3613f24172c2d90a7038f263cad93cbdcddbbbca
Reviewed-on: https://go-review.googlesource.com/c/review/+/681176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
diff --git a/git-codereview/hook.go b/git-codereview/hook.go
index 162e4d1..be2b699 100644
--- a/git-codereview/hook.go
+++ b/git-codereview/hook.go
@@ -355,7 +355,7 @@
 		return
 	}
 
-	dief("gofmt needs to format these files (run 'git gofmt'):\n\t%s",
+	dief("gofmt needs to format these files (run 'git codereview gofmt'):\n\t%s",
 		strings.Join(files, "\n\t"))
 }
 
diff --git a/git-codereview/hook_test.go b/git-codereview/hook_test.go
index 218b425..0c1e5cb 100644
--- a/git-codereview/hook_test.go
+++ b/git-codereview/hook_test.go
@@ -239,13 +239,13 @@
 	trun(t, gt.client, "git", "add", ".")
 
 	testMainDied(t, "hook-invoke", "pre-commit")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):",
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):",
 		"bad.go", "!good.go", fromSlash("!test/bad"), fromSlash("test/bench/bad.go"))
 
 	write(t, gt.client+"/broken.go", brokenGo, 0644)
 	trun(t, gt.client, "git", "add", "broken.go")
 	testMainDied(t, "hook-invoke", "pre-commit")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):",
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):",
 		"bad.go", "!good.go", fromSlash("!test/bad"), fromSlash("test/bench/bad.go"),
 		"gofmt reported errors:", "broken.go")
 }
@@ -265,19 +265,19 @@
 
 	t.Logf("invoking commit hook explicitly")
 	testMainDied(t, "hook-invoke", "pre-commit")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go")
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go")
 
 	t.Logf("change without hook installed")
 	testCommitMsg = "foo: msg"
 	testMainDied(t, "change")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go", "!running: git")
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!running: git")
 
 	t.Logf("change with hook installed")
 	restore := testInstallHook(t, gt)
 	defer restore()
 	testCommitMsg = "foo: msg"
 	testMainDied(t, "change")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go", "!running: git")
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!running: git")
 }
 
 func TestHookPreCommitDetachedHead(t *testing.T) {
@@ -295,7 +295,7 @@
 	trun(t, gt.client, "git", "checkout", "HEAD^0")
 
 	testMainDied(t, "hook-invoke", "pre-commit")
-	testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go")
+	testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go")
 
 	/*
 		OLD TEST, back when we disabled gofmt in detached head,
diff --git a/git-codereview/submit.go b/git-codereview/submit.go
index fc02713..ce629c3 100644
--- a/git-codereview/submit.go
+++ b/git-codereview/submit.go
@@ -64,11 +64,11 @@
 	if len(cs) == 1 && len(b.Pending()) == 1 {
 		if err := runErr("git", "checkout", "-q", "-B", b.Name, g.CurrentRevision, "--"); err != nil {
 			dief("submit succeeded, but cannot sync local branch\n"+
-				"\trun 'git sync' to sync, or\n"+
-				"\trun 'git branch -D %s; git change master; git sync' to discard local branch", b.Name)
+				"\trun 'git codereview sync' to sync, or\n"+
+				"\trun 'git branch -D %s; git change master; git codereview sync' to discard local branch", b.Name)
 		}
 	} else {
-		printf("submit succeeded; run 'git sync' to sync")
+		printf("submit succeeded; run 'git codereview sync' to sync")
 	}
 
 	// Done! Change is submitted, branch is up to date, ready for new work.
@@ -171,7 +171,7 @@
 
 	case "MERGED":
 		// Can happen if moving between different clients.
-		return fmt.Errorf("change already submitted, run 'git sync'")
+		return fmt.Errorf("change already submitted, run 'git codereview sync'")
 
 	case "ABANDONED":
 		return fmt.Errorf("change abandoned")
diff --git a/git-codereview/submit_test.go b/git-codereview/submit_test.go
index 3e18fd8..657f6ba 100644
--- a/git-codereview/submit_test.go
+++ b/git-codereview/submit_test.go
@@ -71,7 +71,7 @@
 	srv.setJSON(id, `{"status": "MERGED"}`)
 	testMainDied(t, "submit")
 	testRan(t) // nothing
-	testPrintedStderr(t, "cannot submit: change already submitted, run 'git sync'")
+	testPrintedStderr(t, "cannot submit: change already submitted, run 'git codereview sync'")
 
 	t.Logf("> abandoned")
 	srv.setJSON(id, `{"status": "ABANDONED"}`)
diff --git a/git-codereview/sync.go b/git-codereview/sync.go
index c60d04c..7b8fe26 100644
--- a/git-codereview/sync.go
+++ b/git-codereview/sync.go
@@ -224,7 +224,7 @@
 		other := cmdOutput("git", "log", "--format=format:+ %cd %h %s", "--date=short", "origin/"+branch+"..origin/"+parent)
 		if other != "" {
 			dief("cannot sync-branch --merge-back-to-parent: parent has new commits.\n"+
-				"\trun 'git sync-branch' to bring them into this branch first:\n%s",
+				"\trun 'git codereview sync-branch' to bring them into this branch first:\n%s",
 				other)
 		}
 	}
@@ -293,7 +293,7 @@
 		dief("sync-branch: merge conflicts in:\n\t- %s\n\n"+
 			"Please fix them (use 'git status' to see the list again),\n"+
 			"then 'git add' or 'git rm' to resolve them,\n"+
-			"and then 'git sync-branch -continue' to continue.\n"+
+			"and then 'git codereview sync-branch -continue' to continue.\n"+
 			"Or run 'git merge --abort' to give up on this sync-branch.\n",
 			strings.Join(status.Conflicts, "\n\t- "))
 	}
@@ -374,7 +374,7 @@
 		if HasUnstagedChanges() {
 			dief("cannot sync-branch%s: unstaged changes (unresolved conflicts)\n"+
 				"\tUse 'git status' to see them, 'git add' or 'git rm' to resolve them,\n"+
-				"\tand then run 'git sync-branch -continue' again.\n", flag)
+				"\tand then run 'git codereview sync-branch -continue' again.\n", flag)
 		}
 
 		run("git", "commit", "-m", msg)
diff --git a/git-codereview/sync_test.go b/git-codereview/sync_test.go
index c073cbf..decb9a1 100644
--- a/git-codereview/sync_test.go
+++ b/git-codereview/sync_test.go
@@ -364,7 +364,7 @@
 		"	- file",
 		"Please fix them (use 'git status' to see the list again),",
 		"then 'git add' or 'git rm' to resolve them,",
-		"and then 'git sync-branch -continue' to continue.",
+		"and then 'git codereview sync-branch -continue' to continue.",
 		"Or run 'git merge --abort' to give up on this sync-branch.",
 	)