693 Commits

Author SHA1 Message Date
Changcheng Xiao
442fa55f30 Remove old RPC backend for MyIdentitiesScreen
MyIdentitiesScreen has been migrated to REST API by [1]. The old RPC
backend will not be used anymore and thus can be removed.

[1] https://gerrit-review.googlesource.com/#/c/95952/

Change-Id: I7d2b255b1ea7df455656cb8a4410cb0f279416d2
2017-02-15 09:26:08 +01:00
Dave Borowitz
292fa154c1 Format all Java files with google-java-format
Having a standard tool for formatting saves reviewers' valuable time.
google-java-format is Google's standard formatter and is somewhat
inspired by gofmt[1]. This commit formats everything using
google-java-format version 1.2.

The downside of this one-off formatting is breaking blame. This can be
somewhat hacked around with a tool like git-hyper-blame[2], but it's
definitely not optimal until/unless this kind of feature makes its way
to git core.

Not in this change:
* Tool support, e.g. Eclipse. The command must be run manually [3].
* Documentation of best practice, e.g. new 100-column default.

[1] https://talks.golang.org/2015/gofmt-en.slide#3
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
[3] git ls-files | grep java$ | xargs google-java-format -i

Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
2017-02-07 10:04:39 +09:00
Edwin Kempin
d9071f45a7 CommentDetail: Rewrite switch statement in include method with if + else
Change-Id: Ice480cab292327d1982afe2f81c167723e8e8363
Signed-off-by: Edwin Kempin <ekempin@google.com>
2017-02-06 14:59:14 +01:00
Edwin Kempin
dde9fe9f64 CommentDetail/PatchScriptFactory: Remove unused AccountInfoCache
AccountInfoCache was populated but nobody used it.

This was the last usage of AccountInfoCache, hence it can be removed
now.

Change-Id: I429e3e10bcd3b0148a272ec45d62c3babc80be1f
Signed-off-by: Edwin Kempin <ekempin@google.com>
2017-02-06 14:46:13 +01:00
Edwin Kempin
151235f0e3 GroupDetail: Remove unused fields
Change-Id: I7cfa0291fad1c7ec516a96948d440c97a91118e4
Signed-off-by: Edwin Kempin <ekempin@google.com>
2017-02-06 13:58:55 +01:00
Edwin Kempin
717214f46c Remove unused AccountInfoCache from GroupDetail
Change-Id: I212e9a4a26d21512e9b6a6a8a4766764e53bd0e5
Signed-off-by: Edwin Kempin <ekempin@google.com>
2017-02-06 11:03:18 +01:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
David Pursehouse
34321931e8 Merge "Remove test prefix from test methods"
* submodules:
* Update plugins/replication from branch 'master'
  - Remove test prefix from test methods in replication plugin
    
    We previously used 'test' to prefix tests but have decided to stop this.
    This change removes the prefix from all test code.
    
    Change-Id: I42e6191ece7872f4647e425e3ca0acf8c6452412
2016-12-07 12:48:37 +00:00
David Ostrovsky
fa18907d7f Bazel: Reformat build files
Reformat the Bazel build files with the buildifier tool [1].

The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.

[1] https://github.com/bazelbuild/buildifier

Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
2016-12-07 11:33:07 +00:00
Patrick Hiesel
a02a5c01e9 Remove test prefix from test methods
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.

Change-Id: I229a36751adc6a87fbae8d6f373671e141529496
2016-12-06 10:36:42 +01:00
David Pursehouse
1bb226ea4a Merge "Bazel: Re-enable auto value tests" 2016-12-06 04:48:43 +00:00
David Ostrovsky
9f43aadee3 Bazel: Re-enable auto value tests
Now, that: [1] is fixed and 0.4.1 is released that includes the fix we
can re-enable the auto_value tests again.

* [1] https://github.com/bazelbuild/bazel/issues/2044

Change-Id: I19cd699148290ac51d96035dd8c70562ef96ff76
2016-11-30 12:59:19 +00:00
ekempin
ee2a6ffc74 Merge "Support negative-only labels" 2016-11-25 13:08:18 +00:00
Dave Borowitz
20d71e58ad Support disallowing voting on labels after submission
For common labels like Code-Review and Verified, it still makes sense
to allow voting after submission, so keep the default as true. For
others, such as a label to trigger CI, it doesn't.

Bug: Issue 4942
Change-Id: I01a6281c11ee13bec9a6c8a2568b18ddd4eaccf4
2016-11-15 18:38:25 -08:00
David Ostrovsky
1f0b418ad3 Bazel: Temporarily disable auto-value tests
Due to Bazel 0.4.0 incompatibility with auto-value 1.4-rc1, that was
recently upgraded to overcome integer overflow bug in hashCode()
method reported by Bazel 0.4.0, temporarily disable auto-value test.

Consider to enable it again, when this bug was fixed and new Bazel
version is released.

[1] https://github.com/bazelbuild/bazel/issues/2044

Change-Id: Id3d59908a2721031688645d2a3b039e227e54eca
2016-11-05 20:30:48 +01:00
Edwin Kempin
d33c50067a Support negative-only labels
For negative-only labels such as [1] editing access rights failed with
a TypeError in the GWT UI. This was because the max value was returned
as null, rather than the actual max value.

[1]
[label "Code-Review-Details"]
  function = NoOp
  value = -3 Bad technique choice
  value = -2 Implementation problem
  value = -1 Need to rebase
  value =  0 No details
  defaultValue = 0

Bug: Issue 4814
Change-Id: Iefa854ac3675a1592802e8ecbe20641ff8b79a3e
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-10-27 10:33:28 +02:00
David Ostrovsky
bc1062f2b6 Bazel: Fix test for //gerrit-common:client_tests
Change-Id: If8b17ec69348970d5b73b24057f3358626ab68b1
2016-10-26 07:45:09 +02:00
David Pursehouse
567063ad65 FilenameComparator: Remove redundant specification of type
Change-Id: Ia5139ae7765b9e96b08b7847b4604158929129b5
2016-10-26 05:19:48 +00:00
Wyatt Allen
6964572185 Sort email comment groups
In changes involving C++, *.h files should appear before their
corresponding *.cc file, although their lexicographic order is the
reverse. With this change, the relative order of *.h and *.cpp file
pairs in file groups of change comment emails is corrected.

Bug: Issue 4586
Change-Id: Ic9618a07167bde570bdfeb0ea54721c763034863
2016-10-25 11:10:58 -07:00
Dave Borowitz
6453fcef85 Store SubmitRecords in index
We can quickly evaluate labels and the submittable bit in ChangeJson
if we store the full submit records in the index. We would also like
to be able to search for submittable changes, i.e. changes that pass
the submit rule evaluator. Support this with a triumvirate of new
fields.

We now support `is:submittable` and `submit:STATUS` operators, as well
as a new flavor of `label:` that takes a submit record label status
rather than a numeric vote. These allow for more precise queries than
some of the heuristics that were previously documented in the search
docs.

Change-Id: Ie8a185a7cdae998be168900186fb64905246e7cf
2016-10-18 10:23:41 -04:00
Gustaf Lundh
9c0ab72946 Show and highlight assignees in change table
Change-Id: If8ec1b7f2506a9183b5af89b92eafbcb2ef26566
2016-09-23 09:39:24 +02:00
Edwin Kempin
10ba6179cb Extract RevisionNote.Comment and use it instead of PatchLineComment
There are 3 classes that represent an inline comment:
- CommentInfo represents an inline comment in the REST API
- PatchLineComment represents an inline comment in ReviewDb
- RevisionNote.Comment represents an inline comment in NoteDb

To support robot comments CommentInfo and RevisionNote.Comment must be
extended so that the additional fields that are specific for robot
comments can be supported. PatchLineComment should not be touched
since robot comments will only be supported with NoteDb, but not with
ReviewDb.

At the moment PatchLineComment is also used to represent inline
comments in all middle layers and in all utility classes that deal
with inline comments. This means if NoteDb is used, inline comments
come in over REST as CommentInfo, then they are converted into
PatchLineComment and for storing them in NoteDb they are converted to
RevisionNote.Comment. The intermediate transformation to
PatchLineComment is bad for implementing robot comments, since this
class should stay unchanged.

To fix this RevisionNote.Comment is extracted into an own Comment
class and then Comment is used instead of PatchLineComment in the
middle layer. This means when NoteDb is used, inline comments are only
converted once, from CommentInfo to Comment. Both types will have
extensions for robot comments (by subtypes).

For storing inline comments in ReviewDb inline comments are converted
from CommentInfo to Comment to PatchLineComment. This is better than
having the double-conversion for NoteDb, because ReviewDb will be
removed in favour of NoteDb. This means when ReviewDb is removed
PatchLineComment can then easily be deleted, as it's no longer used
all over the codebase, but only in the ReviewDb layer.

Change-Id: I53481e8231e04aeca5b924e409e97b0f1d53f516
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-09-22 11:45:19 +02:00
David Pursehouse
893182c30d Merge changes I7cbc950c,I9b675535
* changes:
  Edit Assignee Permissions
  Read/Write Assignee field in ChangeNotes
2016-09-20 14:57:21 +00:00
Sven Selberg
a3ca604a6c Edit Assignee Permissions
Permission deciding who is able to edit the assignee of a change.
Besides the users with edit assignee permission change owner, ref owner, and
the currently assigned user are allowed to change the assignee of a change.

Change-Id: I7cbc950c66b3d5f1e931d5f8d985d8112682971f
2016-09-20 15:57:43 +02:00
David Ostrovsky
0b774c478e Update Buck to latest version
This version fixed a major issue: [1] that was a reason of frustration
of many plugin developers: Not cache sources files under symbolic link.
Now for all such source files, the warning is issued:

"
Disabling caching for target //plugins/wip:wip__plugin, because one or
more input files are under a symbolic link
({plugins/wip=/home/davido/projects/wip}). This will severely impact
performance! To resolve this, use separate rules and declare
dependencies instead of using symbolic links.
"

To suppress this warning we add project.allow_symlink option. This
doesn't have any impact for gerrit core but silences the warning above
when plugins are built in gerrit tree mode.

As pointed out in this issue: [2], we are using some artifacts as source
to the java_library() rule as well as binary_jar for prebuilt_ja rule.
To avoid the warning, we rename sources to have "-sources.jar" suffix
and we rename *.zip to end with .jar in other places.

"
Assuming edit.src.zip is a JAR and renaming to edit.src.jar in
//gerrit-patch-jgit:edit_src. Change the extension of the binary_jar to
'.jar' to remove this warning.
"

source_under_test attribute was removed from java_test() rule.
Replication and cookbook-plugin are updated as well.

local.properties support was removed, but we use it only for download
process customization in our own python script, so that we can keep it
usage and not need to move it to .buckconfig.local.

[1] https://github.com/facebook/buck/issues/341
[2] https://github.com/facebook/buck/issues/855

Change-Id: Idf76cc71c21df43e808179b645f9175767b322a8
2016-09-20 13:19:15 +02:00
David Pursehouse
48ef83e016 Merge "Rename 'Push Annotated/Signed Tag' permission to 'Create Annotated/Signed Tag'" 2016-09-09 06:18:46 +00:00
Andrew Bonventre
9f35969c6d Style: labelIndex and labelAsIndex should be CONSTANT_CASE
Change-Id: Iff175a4fea5a5c0e6b114f2d76bc8cf2e4577c9b
2016-09-08 11:06:24 -04:00
Edwin Kempin
62c156857e Rename 'Push Annotated/Signed Tag' permission to 'Create Annotated/Signed Tag'
Each tag type requires a special permission for the tag creation:
- Lightweight tags require 'Create Reference'
- Annontated tags require 'Push Annotated Tag'
- Signed tags require 'Push Signed Tag'

This naming is inconsistent and may be confusing. E.g. whether tags
can be updated is controlled by the 'Push' permission on 'refs/tags/*'
and not by the 'Push Annotated/Signed Tag' permission, as some users
might expect.

This change includes a schema migration that renames the permissions
for creating annotated/signed tags.

Permission rules in project.config that use the old names are still
respected. They are automatically converted when the project config is
saved the next time. This is needed so that multi-master sites can do
a multi-step-migration:

1. First upgrade all hosts to the new binary:
   Projects may still contain permissions with the old names,
   new permissions are saved with the new names.
2. Run a background job on all hosts that migrates the permissions for
   all projects to the new names:
   Projects do not contain permissions with the old names,
   new permissions are saved with the new names.
3. Upgrade all hosts to a binary that doesn't respect the old names
   anymore.

The migration for schema 130 is rewritten because ProjectConfig no
longer allows to change the force flag for 'pushTag' without
converting it to 'createTag'.

Change-Id: I839be24f82a908b5184f15e746f3588a0d397b7e
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-09-08 13:50:04 +09:00
Edwin Kempin
4666bd958d Add separate 'Delete Reference' permission
This new permission allows users to delete branches and tags, without
allowing them to push branches and tags for new commits and thus
bypass code review, as it would be possible when force push would be
granted.

Bug: Issue 2179
Change-Id: I678650570ed2ce14fc1784fc7766b8ddbe7f9729
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-09-07 13:40:28 +02:00
David Pursehouse
f801131ab2 SystemInfoService{Impl}: Remove unused contributorAgreements method
Change-Id: Ib999603a21788ab48afe4a7d0d4a44196b4bef68
2016-08-23 21:42:28 +09:00
David Pursehouse
58240208ac Remove no longer used AccountService{Impl}
Change-Id: Ib08ef0fc71e035ccb3b402c909c758a9ffd8fff3
2016-08-22 21:01:14 +09:00
David Pursehouse
b8fe7ffe1c AccountSecurity: Remove unused enterAgreement method
Change-Id: I4741f039bde46030179c850d00e78c586f8e6a64
2016-08-22 08:10:07 +00:00
David Pursehouse
8539921636 AccountSecurity: Remove unused updateContact method
All UI screens now use the REST API.

Change-Id: Ia5934d58e1173e3e47f595fc2a468832f3960099
Signed-off-by: Edwin Kempin <ekempin@google.com>
2016-08-19 16:22:01 +02:00
Dariusz Luksza
7a046da6f5 Conditionally allow Gerrit to load in IFrame
Introduce new configuration option (gerrit.canLoadInIFrame) to allow
loading Gerrit in IFrame. By default it is set to 'false' to keep
current behavior.

Change-Id: Ie13b6141a9dfb8a18348fc778fb5f6083f95bd14
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2016-08-11 16:09:58 +00:00
Stefan Beller
bb444175a6 SubmoduleOp: Allow all branches to be subscribed
This eases the way of handling many different branches for the
superproject subscription. As the superproject subscriptions
are not yet in a release, we can still play around with them.

When a user sees "refs = refs/heads/*:refs/heads/*" they cannot tell
whether this is 1:1 matching or any match to any match without
consulting the documentation. Differentiate the matching
strategy by keys, such that we have "all = <refspec>" as well
as "matching = <refspec>".

The "all" key implies there is no interaction between the
wildcards on the left and right side, e.g.

  all=refs/heads/*:refs/heads*

indicates that any branch can be subscribed to any other branch
in the given superproject.

"matching" however substitutes the wildcard on the right
with the captured value on the left.

  matching=refs/heads/*:refs/heads*

allows a subscription of refs/heads/foo in the submodule to the
refs/heads/foo in the superproject.

Change-Id: I84d3a72c00f76570798880adf54ce56f974466ff
2016-08-04 16:13:11 -07:00
Edwin Kempin
b644ff8fcf Merge "Implement Bazel build" 2016-06-24 10:51:33 +00:00
Stefan Beller
e945e54c7b Changescreen: correct topic search query
There are two problems with the current code:
1) the OR operator must be in capital letters
2) the OR operator is not a prefix operator, but an infix operator.

Change-Id: Icf91285096bd65753948c55578f86d9e80a4d13b
Signed-off-by: Stefan Beller <sbeller@google.com>
2016-06-22 09:58:38 -07:00
Stefan Beller
b4b9b54767 Changescreen: topic link to exclude abandoned changes
This change makes the topic link behavior similar to the behavior
branch link, which only shows the same status of changes for the
target branch. However when querying for new changes, it is also
useful to see what has already been done in the given topic. When
looking searching for changes of the same topic from a merged change
it is also useful to see what is still pending.

So in case of {NEW, MERGED} changes we search for both states.

Change-Id: I86f091d6afefbb4bef8bd24245edb64bb9a16f53
2016-06-16 09:55:15 -07:00
Edwin Kempin
db2a61d182 Merge "Add ADD_PATCH_SET permission to lock patch sets" 2016-06-16 14:25:08 +00:00
Patrick Hiesel
7eaa3254ce Add ADD_PATCH_SET permission to lock patch sets
This is an atomic change that can be imported prior to a schema
migration. The change 78779 depends on this.

Change-Id: Ibba941ef54104a29d0e12b8307f74b7c0b385b93
2016-06-16 14:28:50 +02:00
David Ostrovsky
b81b4f75ae Implement Bazel build
To run the tests:

  bazel test //...

To build the Gerrit plugin API, run:

  bazel build gerrit-plugin-api:plugin-api_deploy.jar

To build the Gerrit extension API, run:

  bazel build gerrit-extension-api:extension-api_deploy.jar

TODOs:

Licenses
Reduce visibility (all public for now)
Generate HTML Documentation
Core plugins
gerrit_plugin() rule to build plugins in tree and standalone modes
GWT UI (only gwt_module() skylark rule is provided, no gwt_binary())
PolyGerrit UI
WAR
Publish artifacts to Maven Central
Ask Bazel team to add Gerrit to their CI on ci.bazel.io

Contributed-By: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I9a86e670882a44a5c966579cdeb8ed79b1590de3
2016-06-14 21:12:02 +02:00
Saša Živkov
4693626108 Merge changes I4fad66f5,I6ddb8258
* changes:
  Settings screen for OAuth tokens
  REST API for retrieving OAuth access tokens
2016-06-14 14:33:51 +00:00
Shawn Pearce
c4a90512d5 Replace gitweb glue with WebLink extensions
Keep the gitweb configuration section, but bind the URLs through the
WebLink extension points instead of specific support in the web UI.
This simplifies the server and UI implementations a bit by using
only code paths that other plugins like the gitiles plugin use.

Change-Id: I8508dcaf3a4405b3ce3a47f2f717472a46e5a8ca
2016-06-08 22:02:23 -07:00
Michael Ochmann
f698212ed0 Settings screen for OAuth tokens
The new screen is visible if authentication type OAUTH is enabled
for Git over HTTP communication (auth.gitBasicAuth = true).
It shows the value of the access token that is assigned to the
current web session, the expiration date of the token, and the
corresponding entries for the .netrc and .gitcookies files.

Change-Id: I4fad66f53ba8cc872de8f8a2120239c83624e9d9
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
2016-06-03 11:02:44 +02:00
David Pursehouse
323247227d Enable and fix 'Statement unnecessarily nested within else clause' warnings
Change-Id: Ida6df4593fc2ab3c11581309b2b4a638229ea093
2016-06-02 10:20:37 +09:00
Patrick Hiesel
96918cce97 Removing all RPC calls for watching projects
This change migrates the GWT UI towards using the new REST endpoints for
all requests related to watching projects. This will remove unnecessary
RPC requests.

Change-Id: Ib59fe170dcd6c22aceab9ccb6434f065319a31f7
2016-05-31 10:58:01 +02:00
Stefan Beller
198e97a5b6 submodule subscriptions: be more verbose in debug log
Change-Id: I1046367139c45377b9e6b93c9d653ee23cddd556
2016-05-25 10:09:35 -07:00
Dave Borowitz
95194373df Merge "Added POST REST Endpoint for /project/name/access" 2016-05-20 17:49:24 +00:00
Patrick Hiesel
21816f1d7c Added POST REST Endpoint for /project/name/access
I have implemented a new format of changing permissions.
At this REST endpoint, clients can specify deductions
(aka deletions) and additions they want to apply to the
permission schema along with a commit message. Deductions
will be applied before additions, such that changes to
an existing rule can be applied using one rest
request.

In addition the parent can be changed (by admins).

Change-Id: I746da17a078da9f13ea41ea670634ecf8f3202eb
2016-05-16 17:48:11 -07:00
David Pursehouse
472378fa0c Remove unused InactiveAccountException class
InactiveAccountException is not thrown anywhere. Remove it and the
only place where it's caught/handled.

Change-Id: I12c918bd2c8ef5dc28c27fc0c50f731f3b0b0cec
2016-05-12 15:12:29 +09:00