aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/pending_test.go
AgeCommit message (Collapse)Author
2025-02-06git-codereview: pending: add -g optionIan Lance Taylor
This is a convenient format for listing changes awaiting review, for pasting into an e-mail or chat. Change-Id: Ib31bf0307d34aaca3e4de4baf9be4c3b3ac60be7 Reviewed-on: https://go-review.googlesource.com/c/review/+/647096 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-01-25git-codereview: remove usage of io/ioutilv1.9.0Joshua Sing
io/ioutil is now deprecated. Use non-deprecated equivalents. Change-Id: Iad1cc9c14dbdad3a6f9ada25072bc194bace4081 Reviewed-on: https://go-review.googlesource.com/c/review/+/543615 Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-10-11all: update go directive to 1.18Dmitri Shuralyov
Done with: go get go@1.18 go mod tidy go fix ./... Using go1.21.3. While here, use testing.T.Helper directly and delete go19_test.go. For golang/go#60268. Change-Id: I924bb6d107180a04d1f879003b169c7f792d8dd4 Reviewed-on: https://go-review.googlesource.com/c/review/+/534198 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-23git-codereview: pending: show unresolved comment countRuss Cox
Also fix a potential crash parsing a commit with no parents. Change-Id: I1c289dde45230a3362f54037ea18023278b05ffd Reviewed-on: https://go-review.googlesource.com/c/review/+/294129 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-27git-codereview: avoid race in loadGerritOriginIan Lance Taylor
Use a mutex in loadGerritOrigin to avoid race when called in parallel by "git coderevew pending". Add a new initialized field so that the code knows when auth has been initialized. Adjust tests accordingly. The test is simply "go test -race". Fixes golang/go#43670 Change-Id: Ifb060fca6ed463f1d11a2959d03fca5e14e238c6 Reviewed-on: https://go-review.googlesource.com/c/review/+/287012 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-07git-codereview: allow work on main branchesRuss Cox
The only reason not to allow work on branches named for the origin branches is to preserve them for "git change main; git change new" to make a new branch tracking main. But we can still do that and allow commits on main - we just have to use the branchpoint as the root of the new branch. Now people can work on "main" (or "dev.regabi") if that suits them. In particular, if you're doing merges, it's nice to be on "dev.regabi" and know for sure that's the branch you're working on. Change-Id: I8e9458793c30857a5c00e6bfd4f1cb41adbbe637 Reviewed-on: https://go-review.googlesource.com/c/review/+/279874 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Austin Clements <austin@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>
2021-01-07git-codereview: update tests for "main" branch defaultRuss Cox
"git init ." leaves me on "main" now, not "master". Update tests to expect that, and update the "tracking" message too (otherwise the tests fail). Because not all gits agree about the initial branch name, set it explicitly too in the test. Fixes #42926. Change-Id: If3adb3bb53beba9efcd75cad0f081f59fba85fe7 Reviewed-on: https://go-review.googlesource.com/c/review/+/279873 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Austin Clements <austin@google.com>
2019-12-16git-codereview: write hooks with execute permission in testsBryan C. Mills
The 'write' helper function previously assumed file permission 0666. We don't actually need these files to be world-writable, but we do need specific ones — scripts executed as Git commit hooks — to be executable, at least on certain platforms. Also use t.Helper() to produce more useful log lines for failures. (That was added in order to diagnose TryBot failures.) Fixes golang/go#32836 Change-Id: I2d670563f42778ef8cf645445420756599c37ac6 Reviewed-on: https://go-review.googlesource.com/c/review/+/211477 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
2017-11-27git-codereview: fix test compilation error on Go 1.8Brad Fitzpatrick
These tests depended on Go 1.9's t.Helper. Change-Id: Ib8196e24f8508b4b2891cd1467dd9954bc5d8de5 Reviewed-on: https://go-review.googlesource.com/77932 Reviewed-by: Dominik Honnef <dominik@honnef.co>
2017-11-10git-codereview: batch GerritChange info fetches during pendingRuss Cox
This speeds pending a bit by reducing the number of round trips to the Gerrit server when you have a stack of CLs. Change-Id: I456e1a8739b9b6586f4e05c1a5442f402e440a79 Reviewed-on: https://go-review.googlesource.com/67571 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2016-06-15git-codereview: specify --no-track in TestPendingNoneBranchJosh Bleecher Snyder
This is a similar fix to CL 23969. Change-Id: Ief0fefd25e471d314234bd939150db8a9af74447 Reviewed-on: https://go-review.googlesource.com/24000 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-18git-codereview: disable Gerrit-specific hook behavior if Gerrit is not in useRuss Cox
Every time I accidentally type 'git pending' in a non-Gerrit repository, that command installs hooks, and then I have to zero the hook files to keep working. First, don't install the hooks if this looks like a non-Gerrit git repo. That seems like it will play well with others. But, people might also want to use the non-Gerrit parts of the tool, so if people do say 'git codereview hooks', let that install them. And then if the hooks are invoked in a non-Gerrit repo, selectively disable the Gerrit-specific parts. For example, if it's not a Gerrit repo we might still want to check and fix 'Fixes #N' lines if directed by the config, but we don't want to add Change-Id lines. Now that things are a bit better behaved, also leave the hooks on in detached head mode. I've found that it's quite frustrating not to have the hooks on when working midway through git rebase -i. If we find reasons that the hooks were off we can try to figure out how to split the difference. Fixes golang/go#12170. Change-Id: I69fa156ce4fd11c0c84416088cd972957ce1ce6d Reviewed-on: https://go-review.googlesource.com/19560 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Austin Clements <austin@google.com>
2015-12-14git-codereview: fix branch "behind" countAustin Clements
git-codereview pending's count of how far behind a branch is is currently wrong. It computes this from the length of the string printed by git log --format=format:x, but forgets that git log automatically adds new lines between each commit. As a result, given that the true count is n, git pending prints 2n-1. Fix this by counting the number of lines printed by git log, not the number of characters. Change-Id: I5702a833d34333099cad7d88c03837088ac4f9a8 Reviewed-on: https://go-review.googlesource.com/17771 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-12git-codereview: hide +0 scores and +0 labels except Code-ReviewRuss Cox
Otherwise the list of reviewers is repeated for every label. This is happening now that we have trybot labels. Change-Id: Ie1fe0369d5944319c67fc9182ff3afbfd366687c Reviewed-on: https://go-review.googlesource.com/4570 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-30git-codereview: revise pendingRuss Cox
- Use multiple commit output form always. We're going to start suggesting the use of multiple commits, and it is confusing to flip between the two displays based on the number of commits. - Document pending -c option (current branch only). - Add pending -s option (short form). While doing this, I got my client into a state where I had a tag and a branch with the same name. Make things work in that mode too. Change-Id: I4a3d73ce88be78b04d5bc4e56f1e3bed435cfde7 Reviewed-on: https://go-review.googlesource.com/3621 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Rob Pike <r@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>
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-22git-codereview: add test for pendingRuss Cox
Fixes #9352 Change-Id: I9714c58ead93d8ec91a09e40a04b1a4e2f075c54 Reviewed-on: https://go-review.googlesource.com/1961 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>