-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First implementation of git appraise #733
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost it's great!
@@ -0,0 +1,103 @@ | |||
// Copyright 2014 The Gogs Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017 The Gitea
} | ||
|
||
// Review struct to Issue representation | ||
type Review struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not based on Issue
like Pull
, so that we can list all issues/pulls/reviews of one milestone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but I need that index field will be string, because appraise doesn't have unique in index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index's unique could be changed to index I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but it is int. In appraise that all we have is string
Revision: b9f1a3d0a1081a5f159ed90a3d413320890e0986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added IsReview flag on Issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you can ignore index field and add revision in Reivew struct.
UpdatedUnix int64 | ||
IsClosed bool | ||
IsRead bool | ||
IsPull bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsPull needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this may be removed, thank you
"strings" | ||
"time" | ||
|
||
"github.com/google/git-appraise/repository" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local imports (e.g. code.gitea.io/gitea/foo/bar
) should come before non-stdlib external packages (e.g. github.com/foo/bar
).
import (
"strconv"
"strings"
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"github.com/google/git-appraise/repository"
"github.com/google/git-appraise/review"
)
Reworked template for using IsReview
|
||
ctx.Data["Title"] = ctx.Tr("repo.reviews") | ||
ctx.Data["PageIsReviewList"] = true | ||
// ctx.Data["Page"] = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed to add the commented code to repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I upload PR to other contributors and maintainers check my code for right implementation to exist code base. I will clear all commented lines on last commit.
Maybe needs to insert or update one record to issue table when a review request pushed to git? |
Add commits list Add comments list Add GetIndex to models.Issue to return Revision/Index
ctx.Data["Username"] = ctx.Repo.Owner.Name | ||
ctx.Data["Reponame"] = ctx.Repo.Repository.Name | ||
|
||
reviewCommits, err := repo.ListCommitsBetween(reviewDetails.Request.TargetRef, reviewDetails.Request.ReviewRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for getting the commits in a review is a little more complicated than this because there are multiple states a review can be in (open, submitted, abandoned, etc).
I have a PR to git-appraise to make this a first-class part of the review API: google/git-appraise#70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ojarjur thank you, I change usage of this function as soon as it was merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sokolovstas That change has been merged into git-appraise now.
How can I test this ? I've a repository in which |
I've just tested this out and it is a good start. Since we don't have line-annotations (#124) (like github does) perhaps just display line/file of a comment when it is present. Also rejection/acceptation is nice to have. Now it is just depicted as a regular comment. Good work already, good to see the appraise comments in gitea already! |
@rikvdh as I could not see those comments instead, could you upload a screenshot ? |
@strk, running 'git push --all' only pushes the branches, not the notes.
To push just the notes with review information, run 'git appraise push gitea-remote'
To mirror the entire repo, run 'git push --mirror'
|
How would this work if a read-only user wants to use
Note: I'm very much against implementing something that only some people can use, if we go with My 2 cents 😉 |
I would say |
I assume you mean how does this work if someone who does not have write access to a repo wants to use the git-appraise command line tool rather than the gitea UI. The answer is that user would be able to pull reviews from the repository, but not push them to it. They could always push the review to their fork, but not to the upstream repository. The git-appraise command-line tool uses the same auth mechanisms as git itself, so a user who cannot push directly to the repo also cannot directly push reviews. One of the reasons for this design is that tools like gitea already define a way for outside contributors to authenticate and participate in a review, so git-appraise doesn't try to invent its own. Instead, whatever tool is responsible for auth (e.g. gitea) is also responsible for writing the review metadata to the repository. So what I would expect is that the outside contributor creates their reviews and comments on them via the gitea UI, and the gitea server then writes them to the git-appraise formats.
The important thing about git-appraise isn't the command-line tool but rather the storage formats. Even if no one performs code reviews via the command line, having the review metadata stored directly in git is valuable. |
@ojarjur ok now I see the "Reviews" tab (I just didn't notice before). |
@ojarjur would it not be possible to accept push to the git appraise reference by anyone that has read access to the repo ? |
conflicted |
@roblabla It should be possible to achieve what you want, but I would recommend a different implementation than that. Reviews in git-appraise are just git objects the same way that commits are, and there is a well-established way for read-only contributors to push their own git objects. Specifically, they create a fork of the repository and then push to that fork. Those objects can then be mirrored into the upstream repository in a controlled way (e.g. like GitHub's 'refs/pull/...' refs). The earlier question from @bkcsoft caused me to start thinking that we could build in a corresponding workflow for git-appraise, and I've created an issue for that here. Please add comments to that issue if the workflow described there doesn't match what you are looking for. |
I'd love to see this completed too @sokolovstas -- any chance ? |
@sokolovstas if you have no time for this, maybe you can allow maintainers or others to continue the work so that you can check |
@lunny This check box is already checked. For now I have very busy on main project and don't have free time. But will be very glad if someone can continue this work! |
@lunny are you going to give this a try ?
|
Maybe but I have to finish my PR first. |
I've read through the comments and would love to help out with this and get it ready to be merged. Could someone make a list of exact things that need to be changed / added? |
Stuart I think you'll need to have an active role in this as there's
no great consensus about what the design should be. Personally I agree
about the UI using git repository itself for storage, rather than database
(as it makes federation much easier).
I guess your best first step would be using the proper UnitType and
rebasing / fixing conflicts.
|
Any movement on this one? I don't know GO, but I could help with testing and feedback. |
@KangoV it's not finished and no one continue with this now. |
I could probably work on this as I need it myself :) |
@lafriks great news, please go ahead. |
@lafriks you are very welcome ! |
This PR is in the wrong milestone, should be 1.3.0 (or 1.4.0, depending on @lafriks estimate) |
please disregard my previous comment, 1.x.x is clearly undefined but in the 1.x branch... |
@strk It's on my todo list just after more advanced branch protection and PR approval system :) |
@lafriks Is theire any further news about this PR or is it replaced by another PR-approval system in future? |
I started to work on this but I did not like it how it is currently implemented. I think it should be rewritten to be integrated with PRs |
@lafriks I think rewrite is a better idea. |
Closing this due to PR approval/comment/review system in place via other PR. |
Issue #189
This is first implementation of appraise review. I opened gitea code only this morning and to end of day I completed showing review list.
Dear maintainers please see the code and tell me if I started implementation properly. I can continue to implement this tomorrow.