aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/mail.go
AgeCommit message (Collapse)Author
5 daysgit-codereview: support remote other than "origin"HEADmainShulhan
For the git-codereview commands to works on any Go's repositories, the remote name for "origin" must be pointed to the Go original repository URL (in most cases the one with go.googlesource.com domain). The problem is when the "origin" is from the fork, all of the git-codereview commands then will not works. For example, in computer X, I clone the this repository from "https://go.googlesource.com/review" (the origin) and then push my changes on "git@git.sr.ht:~shulhan/go-x-review" (the fork). In another computer Y, I then clone from the fork to continue my works. The fork become origin. One of the solution is to rename the remote names manually each time we clone the fork. The only cons using this solution is every time new branch created we need to remember to pass "--set-upstream" during git push. This changes introduce "remote" configuration in codereview.cfg. When one first working on fork of Go repository, they set the "remote" key, commit it, and push it. When they cloned the fork, they did not needs to changes anything except adding new remote using the pre-defined name. Change-Id: I335d08fd8b7efe17ba07b3c0a3794f9ccf59b339
2025-11-07git-codereview: add matloob@google.com to the mail shortOptOut listv1.18.0matloob@golang.org
So that matloob@golang.org is preferred for git codereview mail -r matloob. Change-Id: I6a6a69643230e022605905c88334a9f865f5ba13 Reviewed-on: https://go-review.googlesource.com/c/review/+/718240 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-08-28git-codereview: change default -trybot flag to use LUCIv1.6.0Dmitri Shuralyov
For when it's time. Change-Id: Ife6df8eed0a02d9a47ffca141be083aaf3b09d28 Reviewed-on: https://go-review.googlesource.com/c/review/+/523115 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-08-25git-codereview: add GIT_CODEREVIEW_TRYBOT env var to control CI systemDmitri Shuralyov
The mail command has a -trybot flag, useful to start TryBots on the CL being mailed. The new LUCI trybots are almost ready, and we'll soon be asking contributors to consider them the new default. Prepare for that by adding a temporary GIT_CODEREVIEW_TRYBOT environment variable which will make it possible to override the CI system invoked by the -trybot flag. This CL keeps the default as the old CI system (farmer.golang.org), and the next CL switches it to the new one (ci.chromium.org/p/golang). The environment variable will eventually be removed once it has no use. Change-Id: Ia20bb0cad1fee387b2d94a8438e8a3be3ec87e6b Reviewed-on: https://go-review.googlesource.com/c/review/+/523095 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-22git-codereview: fix mail lookup for dmitshur short nameDmitri Shuralyov
CL 2111 introduced a simple algorithm for expanding short user names that works locally and generally doesn't need any extra configuration to do the right thing. It's been serving for almost a decade. Unfortunately I'm running into an edge where I see no good option but to add a special case. Gerrit inserts "Reviewed-by" footers both for Code-Review +2 and +1 votes without any way to distinguish between them, and my @google.com account unavoidably gets more hits since I use it for the go.dev/s/needs-review process, whenever I leave a normal +2, and on my own CLs. The simplest fix seems to be to exclude it from short matches and let the existing algorithm do the rest. Change-Id: I92da69f1cd87b4c89816547015cffbed3eaaeaf6 Reviewed-on: https://go-review.googlesource.com/c/review/+/494175 Reviewed-by: MKaslann1 <mkaslann1@outlook.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2022-10-03git-codereview: add -autosubmitv1.1.0Heschi Kreinick
Add a flag to set the Auto-Submit label. For golang/go#48021. Change-Id: If704e8b5e9e0e2521eed78fe28af10d3c31ec3a0 Reviewed-on: https://go-review.googlesource.com/c/review/+/431375 Auto-Submit: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Heschi Kreinick <heschi@google.com>
2022-04-12git-codereview: remove -trustRuss Cox
We don't use that label anymore. Change-Id: Ic31841efaea5d9d9ae38077d8c3a3b6c548fee88 Reviewed-on: https://go-review.googlesource.com/c/review/+/399117 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31git-codereview: add mail --no-verify optionDamien Neil
This adds a flag to set git push --no-verify, disabling pre-push hooks. Change-Id: I9ef686bd3ec742901d0138fc9028d65efde83e87 Reviewed-on: https://go-review.googlesource.com/c/review/+/222922 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-03git-codereview: don't sign git tagsTobias Klauser
For users who set tag.gpgSign=true in their git configuration, git-codereview mail currently fails to create the .mailed git tag because a signed git tag always requires a message: fatal: no tag message? (running: git tag -f foobar.mailed cf87726ac456) /home/tklauser/go/bin/git-codereview: exit status 128 Fix this by overriding the tag.gpgSign configuration using git tag --no-sign. There is no point in having these tags signed as they should never leave the local system. Change-Id: I8b7ddf3aa7709e6ea06e4d5add6cd581e9ec2e37 Reviewed-on: https://go-review.googlesource.com/c/review/+/369194 Trust: Tobias Klauser <tobias.klauser@gmail.com> Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2021-01-13git-codereview: add reword commandRuss Cox
Quoting the new docs: The reword command edits pending commit messages. git codereview reword [commit...] Reword opens the editor on the commit message for each named commit in turn. When all the editing is finished, it applies the changes to the pending commits. If no commit is listed, reword applies to the most recent pending commit. Reword is similar in effect to running “git codereview rebase-work” and changing the script action for the named commits to “reword”, or (with no arguments) to “git commit --amend”, but it only affects the commit messages, not the state of the git staged index, nor any checked-out files. This more careful implementation makes it safe to use when there are local changes or, for example, when tests are running that would be broken by temporary changes to the checked-out tree, as would happen during “git codereview rebase-work”. Change-Id: I38ac939b8530bf237c6cafb911f2b17d22eaca60 Reviewed-on: https://go-review.googlesource.com/c/review/+/279718 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-01-13git-codereview: new sync-branch and related fixesRuss Cox
This CL adds a new command, "git codereview sync-branch", which does the appropriate git merge for the current branch. This CL also fixes a bug in "git codereview branchpoint", and therefore also commands like "git codereview pending", which was getting the branchpoint wrong for merges, with the effect that a merge showed too many pending CLs. This CL also fixes a bug in "git codereview change", which was formerly willing to run "git checkout" with a pending merge, which had the effect of flattening the merge mysteriously. Now it detects the merge and refuses to run. All of this should make merges easier and less error-prone as we use dev branches more often. With the earlier CL in this stack that allows working directly on local branches, this is now a great way to run a merge updating dev.regabi: git change dev.regabi git sync-branch (with appropriate aliases to avoid typing "codereview"). Fixes golang/go#26201. Change-Id: Ic24603123ca5135a72004309f5bb208ff149c9eb Reviewed-on: https://go-review.googlesource.com/c/review/+/279772 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-01-07git-codereview: add a few more testsRuss Cox
Change-Id: I17ad065e8b4c1eb00cdd2f17af82be76bae4fc09 Reviewed-on: https://go-review.googlesource.com/c/review/+/279717 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-22git-codereview: clean up usage message, docsRuss Cox
Change-Id: I634a9d47401c1000bcb38e9dd7e84296a3de00e6 Reviewed-on: https://go-review.googlesource.com/c/review/+/254746 Trust: Russ Cox <rsc@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-09-11git-codereview: add mail -trust to set Trust+1 voteRuss Cox
The expectation is that approvers will change their .gitconfig to define mail as codereview mail -trust. For golang/go#40699. Change-Id: I2a1040bf3f1c7248e9c361e1f2a83c17870b1df5 Reviewed-on: https://go-review.googlesource.com/c/review/+/254421 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-05-15git-codereview: add -wip flag to mail commandPaul Jolly
Add a -wip flag to the mail command to set the status of a change to work-in-progress. Per: https://gerrit-review.googlesource.com/Documentation/intro-user.html#wip Fixes golang/go#20991 Change-Id: I227beccb55570949e9b0f487d5394855611a118a Reviewed-on: https://go-review.googlesource.com/c/review/+/233237 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-01-15git-codereview: add mail -nokeycheck optionBrad Fitzpatrick
This adds a flag to set git push -o nokeycheck. This is an alternative to CL 163158 (to always do it) and CL 81937 (which adds a broader flag without much in the way of guidance of how to use it) Change-Id: I42b1c047ac92aeaea98c0838738e265ffdca0108 Reviewed-on: https://go-review.googlesource.com/c/review/+/214918 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2019-05-08git-codereview: add a hint about mailing the whole chain of changesYury Smolsky
"mail HEAD" will mail every commit between HEAD and branching point. Fixes golang/go#16034 Change-Id: If95aece584f2a324f866c64770f7361ddb3e7636 Reviewed-on: https://go-review.googlesource.com/c/review/+/148137 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2018-07-02git-codereview: add -hashtag flag to the mail commandJesús Espino
It is now possible to mail a CL with any number of hashtags. Fixes golang/go#26149 Change-Id: I231826f95ec357bd448de12a9a5aa30e581c3bb3 Reviewed-on: https://go-review.googlesource.com/121798 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-30git-codereview: forbid mailing editor temp filesYury Smolsky
"mail" command rejects *~, #*# and .#* filenames. Also it should reject commit messages with non-printable characters, because these are impossible to spot in the review. For golang/go#24139 Change-Id: I3544e3c34c5ac9f55a7808264de4535bc455bd0a Reviewed-on: https://go-review.googlesource.com/101755 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-11-16git-codereview: add support for DΟ NΟT MAILRuss Cox
Also create a local DΟ NΟT SUBMIT check, although the Gerrit server is also taking care of that. While we're here, make fixup! and squash! commits non-mailable as well. (In the all caps text above the big Os are really Omicrons. Otherwise the CL would not be mailable or submittable.) Change-Id: Id1a9806b0d395d1a0bfc50ed7d7d22c64a48a2f1 Reviewed-on: https://go-review.googlesource.com/76877 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-28git-codereview: make change fail with multiple pending changesCaio Marcelo de Oliveira Filho
When using 'git change' to amend the current change, it will fail if there are multiple pending changes. The previous behavior (amending the latest) wasn't always what the user intended. $ git change git-codereview: cannot amend change: multiple changes pending: fc60fd5 test: dummy change 6440cdc git-codereview: make change fail with multiple pending changes $ Unlike mail and submit, change doesn't support explicitly telling which commit to work on. Either 'git commit --amend' (for updating the topmost change) or a combination of 'git commit' and 'git rebase' must be used. Fixes golang/go#10443. Change-Id: I2f6ea1b0e302b66b627761d72d031a3b6aa0fba2 Reviewed-on: https://go-review.googlesource.com/20049 Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Andrew Gerrand <adg@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02git-codereview: limit reviewer search to last 1000 commitsJosh Bleecher Snyder
The vast majority of reviewers are consistently active, so limiting the search to the last 1000 commits won't lose many folks. And not loading every commit for a git mail helps with speed and avoids thrashing the disk cache, which is a pain point on my slow, spinning platter. Before, with a warm cache: $ time git log --format=format:%B | wc -l 301515 real 0m0.860s user 0m0.398s sys 0m0.164s After, with a warm cache: $ time git log --format=format:%B -n 1000 | wc -l 16765 real 0m0.036s user 0m0.021s sys 0m0.021s Change-Id: Ia56245e6ea05e4ce844d57a6ee96d19453192967 Reviewed-on: https://go-review.googlesource.com/22707 Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-26git-codereview: reject empty commits in mailCaio Marcelo de Oliveira Filho
Fixes golang/go#10753. Change-Id: I224a411177b3d198576a06bc69da9894b7b67c34 Reviewed-on: https://go-review.googlesource.com/19799 Run-TryBot: Andrew Gerrand <adg@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-05git-codereview: accept any commit spelling for mail and submitAustin Clements
Currently the mail and submit subcommands only accept commit hashes. This makes them inconsistent with other git commands (git is hard enough without having to remember another convention) and makes working with multi-commit branches cumbersome. Change mail and submit to accept any standard commit spelling. In particular, this makes it possible to use HEAD-relative names: "git mail HEAD" sends the whole current branch. We still require that the named commit be pending on the current branch to avoid accidentally naming a completely unrelated commit. Change-Id: If84d315e0fc32118a5283adfbca7a3b56f3c098c Reviewed-on: https://go-review.googlesource.com/19271 Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-19git-codereview: add mail -trybot flagAustin Clements
This flag sets the Run-TryBot+1 label when uploading a CL. Change-Id: I46d14733e0d23c8f40198b0bf670c266ef05db16 Reviewed-on: https://go-review.googlesource.com/17053 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-20git-codereview: set x.mailed tag to mailed commit instead of HEADAustin Clements
Currently, git codereview mail sets the <branch>.mailed tag to the current HEAD, even if mail was given a different hash on the command line. Fix this to set the <branch>.mailed tag to the commit hash that was sent to Gerrit. Change-Id: Ie0aa1512610121ba508b6668f21b50a0ca1c70f8 Reviewed-on: https://go-review.googlesource.com/7731 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20git-codereview: add mail -topic supportAustin Clements
This adds a "-topic" flag to the mail subcommand that sets the Gerrit topic for the pushed changes. Gerrit topics make it easier to group related changes such as in a multi-change review. Note that, like reviewers, the topic is sticky, so it is only necessary to use mail -topic once for a given change. Change-Id: I30cf9a88092cc9270b4643d432dec7e5f967b922 Reviewed-on: https://go-review.googlesource.com/5301 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-30git-codereview: use cmd prefix on command implementation funcsRuss Cox
The name space is getting a bit crowded. These words are too easy to use for other variables or functions. Change-Id: Iedbccb82f85627fe422a029a6b45ad39a2e18dd0 Reviewed-on: https://go-review.googlesource.com/3627 Reviewed-by: Rob Pike <r@golang.org>
2015-01-19git-codereview: refactor getOutput/getLines into cmdOutput, trim, lines, ↵Russ Cox
nonBlankLines This CL separates the "run the command and gather output" from the "process output" operations. Doing so makes the desired processing clearer, makes the processing available for use on other text sources. Also, add cmdOutputDir, for running a command in a different directory. This is needed by the gofmt command to work around a bug in Git, and it's made much easier by the above separation. Change-Id: I2addd8b79dab2d4aa8a24c94a8d7b3a16a8e3484 Reviewed-on: https://go-review.googlesource.com/2906 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-06git-codereview: begin to handle multiple-change branchesRuss Cox
Gerrit supports multiple-change branches, and we'd like to make git-codereview useful for people using this mode of work. This CL is the first step. - remove error message on detecting a multiple-change branch - require 'git submit hash' in multiple-change branch - make git submit, git sync cleanup safe for multiple-change branch - adjust git pending output to show full information about multiple-change branch - add pending -c to show only current branch, since output is getting long We're not advertising or supporting this mode yet. For now the only way to enter it is to run 'git commit' to create the second commit. Perhaps eventually we will support something like 'git change -new'. Change-Id: I8284a7c230503061d3e6d7cce0be7d8d05c9b2a3 Reviewed-on: https://go-review.googlesource.com/2110 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2015-01-06git-codereview: allow short user names in git mailRuss Cox
In Mercurial, hg mail expanded Rietveld user names. There are no Gerrit user names. There are GitHub user names, but then I'd have to type randall77,griesemer,robpike,ianlancetaylor instead of khr,gri,r,iant. The algorithm for expanding short user names is as follows: Look at the git commit log for the current repository, extracting all the email addresses in Reviewed-By lines and sorting by how many times each address appears. For each short user name, walk the list, most common address first, and use the first address found that has the short user name on the left side of the @. This is a purely local operation, it adjusts automatically as new reviewers come on board, it avoids a separate database, it adjusts to repo-specific reviewer patterns, and it resolves potential ambiguity in favor of the most common reviewers. (For example, r@golang.org will beat any other r@mail.com in the main repo.) Change-Id: I53afea2a86ba4cfa8fd7f31d56b90a3e12cc2b48 Reviewed-on: https://go-review.googlesource.com/2111 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-05git-codereview: update outdated error messageDave Cheney
Replace the word "review" with os.Args[0] for consistency with change.go. Change-Id: Id69d64e4275f4fdb39fc72e17ad3fb6daadd61da Reviewed-on: https://go-review.googlesource.com/2303 Reviewed-by: Minux Ma <minux@golang.org>
2014-12-30git-codereview: guard against ambiguous revision parametersAnthony Martin
Change-Id: I3afcf06e1eab28bfdb2c6ace7aaf774070084900 Reviewed-on: https://go-review.googlesource.com/1783 Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-23git-codereview: fix a few corner case failuresRuss Cox
- make it clearer what the random git command at the end of failures means - avoid some problems with detached HEAD mode in hooks run during git rebase - redirect all stdout/stderr into test buffers Change-Id: I102f22fc870f69c884728eaa46ecc95792d5b795 Reviewed-on: https://go-review.googlesource.com/2011 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2014-12-18git-codereview: rename from 'git-review' to 'git-codereview'Andrew Gerrand
Mostly trivial search and replace, except for hooks.go which includes a special case to remove the old git-review hooks. Change-Id: Ic0792bb3e26607e5e0ead88958e46c3ac08288cd Reviewed-on: https://go-review.googlesource.com/1741 Reviewed-by: Russ Cox <rsc@golang.org>