Add checkbox to search for all the branches by commit message (#813)

and updating the vendor directory
This commit is contained in:
Zsombor 2017-02-05 15:43:28 +01:00 committed by Lunny Xiao
parent f35b20b042
commit e388db311b
9 changed files with 39 additions and 18 deletions

View file

@ -513,6 +513,7 @@ editor.upload_files_to_dir = Upload files to '%s'
commits.commits = Commits
commits.search = Search commits
commits.search_all = All
commits.find = Find
commits.author = Author
commits.message = Message

View file

@ -111,8 +111,9 @@ func SearchCommits(ctx *context.Context) {
ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName)
return
}
all := ctx.QueryBool("all")
commits, err := ctx.Repo.Commit.SearchCommits(keyword)
commits, err := ctx.Repo.Commit.SearchCommits(keyword, all)
if err != nil {
ctx.Handle(500, "SearchCommits", err)
return
@ -122,6 +123,9 @@ func SearchCommits(ctx *context.Context) {
ctx.Data["Commits"] = commits
ctx.Data["Keyword"] = keyword
if all {
ctx.Data["All"] = "checked"
}
ctx.Data["Username"] = ctx.Repo.Owner.Name
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
ctx.Data["CommitCount"] = commits.Len()

View file

@ -6,6 +6,7 @@
<div class="ui tiny search input">
<input name="q" placeholder="{{.i18n.Tr "repo.commits.search"}}" value="{{.Keyword}}" autofocus>
</div>
<input type="checkbox" name="all" id="all" value="true" {{.All}}><label for="all">{{.i18n.Tr "repo.commits.search_all"}}</label>
<button class="ui black tiny button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.commits.find"}}</button>
</form>
</div>

View file

@ -10,7 +10,7 @@ Please search the issues on the issue tracker with a variety of keywords to ensu
If unique, [open an issue](https://github.com/go-gitea/gitea/issues/new) and answer the questions so we can understand and reproduce the problematic behavior.
The burden is on you to convince us that it is actually a bug in Gitea. This is easiest to do when you write clear, concise instructions so we can reproduce the behavior (even if it seems obvious). The more detailed and specific you are, the faster we will be able to help you. Check out [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
To show us that the issue you are having is in Gitea itself, please write clear, concise instructions so we can reproduce the behavior (even if it seems obvious). The more detailed and specific you are, the faster we can fix the issue. Check out [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
Please be kind, remember that Gitea comes at no cost to you, and you're getting free help.
@ -24,17 +24,17 @@ This process gives everyone a chance to validate the design, helps prevent dupli
## Testing redux
Before sending code out for review, run all the tests for the whole tree to make sure the changes don't break other usage and keep the compatibility on upgrade. To make sure you are running the test suite exactly like we do you should install the CLI for [Drone CI](https://github.com/drone/drone), as we are using the server for continous testing, following [these instructions](http://readme.drone.io/0.5/install/cli/). After that you can simply call `drone exec` within your working directory and it will try to run the test suite locally.
Before sending code out for review, run all the tests for the whole tree to make sure the changes don't break other usage and keep the compatibility on upgrade. To make sure you are running the test suite exactly like we do, you should install the CLI for [Drone CI](https://github.com/drone/drone), as we are using the server for continous testing, following [these instructions](http://readme.drone.io/0.5/install/cli/). After that you can simply call `drone exec` within your working directory and it will try to run the test suite locally.
## Code review
Changes to Gitea must be reviewed before they are accepted, no matter who makes the change even if it is an owner or a maintainer. We use GitHub's pull request workflow to do that and we also use [LGTM](http://lgtm.co) to ensure every PR is reviewed by at least 2 maintainers.
Please try to make your pull request easy to review for us. Please read the "[How to get faster PR reviews](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md)" guide, it has lots of useful tips for any project you may want to contribute. Some of the key points:
Please try to make your pull request easy to review for us. Please read the "[How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/devel/faster_reviews.md)" guide, it has lots of useful tips for any project you may want to contribute. Some of the key points:
* Make small pull requests. The smaller, the faster to review and the more likely it will be merged soon.
* Don't make changes unrelated to your PR. Maybe there are typos on some comments, maybe refactoring would be welcome on a function... but if that is not related to your PR, please make *another* PR for that.
* Split big pull requests in multiple small ones. An incremental change will be faster to review than a huge PR.
* Split big pull requests into multiple small ones. An incremental change will be faster to review than a huge PR.
## Sign your work
@ -44,20 +44,20 @@ The sign-off is a simple line at the end of the explanation for the patch. Your
Signed-off-by: Joe Smith <joe.smith@email.com>
```
Please use your real name, we really dislike pseudonyms or anonymous contributions. We are in the opensource world without secrets. If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
Please use your real name, we really dislike pseudonyms or anonymous contributions. We are in the open-source world without secrets. If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
## Maintainers
To make sure every PR is checked, we got team maintainers. Every PR **MUST** be reviewed by at least two maintainers (or owners) before it can get merged. A maintainer should be a contributor of Gitea (or Gogs) and contributed at least 4 accepted PRs. A contributor should apply as a maintainer in the [Gitter develop channel](https://gitter.im/go-gitea/develop). The owners or the team maintainers may invite the contributor. A maintainer should spend some time on code reviews. If a maintainer has no time to do that, they should apply to leave the maintainers team and we will give them the honor of being a member of the advisors team. Of course, if an advisor has time to code review, we will gladly welcome them back to maintainers team. If someone has no time to code review and forgets to leave the maintainers team, the owners have the power to move him from maintainers team to advisors team.
To make sure every PR is checked, we have [team maintainers](https://github.com/orgs/go-gitea/teams/maintainers). Every PR **MUST** be reviewed by at least two maintainers (or owners) before it can get merged. A maintainer should be a contributor of Gitea (or Gogs) and contributed at least 4 accepted PRs. A contributor should apply as a maintainer in the [Gitter develop channel](https://gitter.im/go-gitea/develop). The owners or the team maintainers may invite the contributor. A maintainer should spend some time on code reviews. If a maintainer has no time to do that, they should apply to leave the maintainers team and we will give them the honor of being a member of the [advisors team](https://github.com/orgs/go-gitea/teams/advisors). Of course, if an advisor has time to code review, we will gladly welcome them back to the maintainers team. If a maintainer is inactive for more than 3 months and forgets to leave the maintainers team, the owners may move him or her from the maintainers team to the advisors team.
## Owners
Since Gitea is a pure community organization without any company support, to keep the development healthy we will elect the owners every year. Every time we will elect three owners. All the contributors may vote up to three people, one of which is the main owner, and the others are assistant owners. When the new owners have been elected, the old owners MUST move the power to the new ones. If an owner don't obey these rules, the others are allowed to revoke his owner status.
Since Gitea is a pure community organization without any company support, to keep the development healthy we will elect three owners every year. All contributors may vote to elect up to three candidates, one of which will be the main owner, and the other two the assistant owners. When the new owners have been elected, the old owners will give up ownership to the newly elected owners. If an owner is unable to do so, the other owners will assist in ceding ownership to the newly elected owners.
After the election, the new owners should say they agree with these rules on the [CONTRIBUTING](CONTRIBUTING.md) on the [Gitter main channel](https://gitter.im/go-gitea/gitea). Below are the words to speak:
After the election, the new owners should proactively agree with our [CONTRIBUTING](CONTRIBUTING.md) requirements on the [Gitter main channel](https://gitter.im/go-gitea/gitea). Below are the words to speak:
```
I'm glad to be an owner of Gitea, I agree with [CONTRIBUTING](CONTRIBUTING.md). I will spend part of my time on Gitea and lead the development of Gitea.
I'm honored to having been elected an owner of Gitea, I agree with [CONTRIBUTING](CONTRIBUTING.md). I will spend part of my time on Gitea and lead the development of Gitea.
```
To honor the past owners, here's the history of the owners and the time they served:
@ -78,7 +78,7 @@ Since the `master` branch is a tip version, if you wish to use Gitea in producti
Code that you contribute should use the standard copyright header:
```
// Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2017 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
```

View file

@ -1,6 +1,7 @@
Alexey Makhov <amakhov@avito.ru> (@makhov)
Andrey Nering <andrey.nering@gmail.com> (@andreynering)
Bo-Yi Wu <appleboy.tw@gmail.com> (@appleboy)
Ethan Koenig <ethantkoenig@gmail.com> (@ethantkoenig)
Kees de Vries <bouwko@gmail.com> (@Bwko)
Kim Carlbäcker <kim.carlbacker@gmail.com> (@bkcsoft)
LefsFlare <nobody@nobody.tld> (@LefsFlarey)

4
vendor/code.gitea.io/git/commit.go generated vendored
View file

@ -198,8 +198,8 @@ func (c *Commit) CommitsBeforeUntil(commitID string) (*list.List, error) {
}
// SearchCommits returns the commits match the keyword before current revision
func (c *Commit) SearchCommits(keyword string) (*list.List, error) {
return c.repo.searchCommits(c.ID, keyword)
func (c *Commit) SearchCommits(keyword string, all bool) (*list.List, error) {
return c.repo.searchCommits(c.ID, keyword, all)
}
// GetFilesChangedSinceCommit get all changed file names between pastCommit to current revision

View file

@ -102,6 +102,16 @@ func (repo *Repository) DeleteBranch(name string, opts DeleteBranchOptions) erro
return err
}
// CreateBranch create a new branch
func (repo *Repository) CreateBranch(branch, newBranch string) error {
cmd := NewCommand("branch")
cmd.AddArguments(branch, newBranch)
_, err := cmd.RunInDir(repo.Path)
return err
}
// AddRemote adds a new remote to repository.
func (repo *Repository) AddRemote(name, url string, fetch bool) error {
cmd := NewCommand("remote", "add")

View file

@ -196,8 +196,12 @@ func (repo *Repository) commitsByRange(id SHA1, page int) (*list.List, error) {
return repo.parsePrettyFormatLogToList(stdout)
}
func (repo *Repository) searchCommits(id SHA1, keyword string) (*list.List, error) {
stdout, err := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, prettyLogFormat).RunInDirBytes(repo.Path)
func (repo *Repository) searchCommits(id SHA1, keyword string, all bool) (*list.List, error) {
cmd := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, prettyLogFormat)
if all {
cmd.AddArguments("--all")
}
stdout, err := cmd.RunInDirBytes(repo.Path)
if err != nil {
return nil, err
}

6
vendor/vendor.json vendored
View file

@ -3,10 +3,10 @@
"ignore": "test",
"package": [
{
"checksumSHA1": "P2wIRW07gnEgqLZAcg7bz+Jw9Oc=",
"checksumSHA1": "km1AOUs34DCwgXT55fh6PrkPdiU=",
"path": "code.gitea.io/git",
"revision": "7477742b3c79d36d099baaf614864b6bbdfdecca",
"revisionTime": "2017-01-09T15:46:57Z"
"revision": "dd951bf625ebf5c16ef403f681aaec6c34324bca",
"revisionTime": "2017-02-05T02:50:57Z"
},
{
"checksumSHA1": "BKj0haFTDebzdC2nACpoGzp3s8A=",