aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/pending.go
AgeCommit message (Collapse)Author
6 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-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>
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-13git-codereview: clean up detached HEAD modeRuss Cox
Long ago I decided to return origin/HEAD from b.OriginBranch in detached HEAD mode, thinking it would cause obvious failures. But the joke was on me - origin/HEAD is a real thing in git, and HEAD tracking origin/HEAD is not the right answer on dev branches. Now that each branch's codereview.cfg typically has the branch info we need, we can use that in detached HEAD mode to be able to provide useful displays in commands like "git pending". And we can be careful not to do that when we don't know the actual branch. This commit cleans all that up. Change-Id: I0e59bcb6f9b61e0cdce7a27299b7f29fef8e7048 Reviewed-on: https://go-review.googlesource.com/c/review/+/282616 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@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: 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>
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>
2017-11-10git-codereview: overlap 'git fetch -q' with Gerrit queries in pendingRuss Cox
Right now 'git fetch -q' takes about one second because of Gerrit advertising far too many refs. Overlap the fetch with all the other work, to at least reduce the overall time for 'git pending'. The Gerrit team is aware of the refs advertisement problem and a fix is planned for the next few months. That fix will speed things up even further. Change-Id: Iad57da9f1af1c6eae144fe28e5f96f79234bf3cd Reviewed-on: https://go-review.googlesource.com/67572 Reviewed-by: Austin Clements <austin@google.com>
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-11-05x/review/git-codereview: pending should mention abandoned CLsJaana Burcu Dogan
Fixes #golang/go#13622. Change-Id: I3e16293dd272adbf06ef039f047cefa98ac1352d Reviewed-on: https://go-review.googlesource.com/32676 Reviewed-by: Russ Cox <rsc@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-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-11-11git-codereview: factor pending commit formattingAustin Clements
This lifts the code to format a commit for the pending subcommand in to its own function in preparation for using it to format lines in git submit -i scripts. Change-Id: I2522256b4e290a7a2f39b28918f7a27ddd1dbc6b Reviewed-on: https://go-review.googlesource.com/16675 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-17git-codereview: wait longer for GerritRuss Cox
5 seconds turns out to be far too optimistic. I am seeing 15 seconds regularly today. Change-Id: Ia258d340f04e294a2bf40d0119170e8083b9fb6b Reviewed-on: https://go-review.googlesource.com/11192 Reviewed-by: Andrew Gerrand <adg@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: 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-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-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>
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-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>
2014-12-21git-codereview: fix print directivesEmil Hessman
Change-Id: Ib95d197ecb32805ef80d9ec00ec8fa50a1b1ca51 Reviewed-on: https://go-review.googlesource.com/1893 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
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>