12059 Commits

Author SHA1 Message Date
David Pursehouse
d85cafbafa Update replication plugin to latest version
- Remove unneeded 'throws NoSuchChangeException'
- Avoid throwing exception due to deleted change

Change-Id: I97b86245c97f869828ba4feadb9ab73821e5b1ed
2014-10-17 15:18:57 +09:00
Shawn Pearce
b1502efbbc Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Fix IncludingGroupMembership.containsAnyOf infinite loop
  Pass ChangeControl into CodeReviewCommit error instances
  Avoid CodeReviewCommit.error() whenever possible
  Update replication plugin to latest revision

Change-Id: Ib6fc0a85864fa407d6fecc027bb2577cd6bcec0c
2014-10-16 21:41:31 -07:00
Hugo Arès
16e38d5685 Fix IncludingGroupMembership.containsAnyOf infinite loop
This class is using a map to store the memberOf and can be accessed
by multiple threads concurrently. The map was not synchronized which was
causing an infinite loop under very specific sequence of events. Here is
a snippet of the thread dump when that problem happened:

"SSH gerrit review ..." prio=1 RUNNABLE
java.util.HashMap.getEntry(HashMap.java:446)
java.util.HashMap.get(HashMap.java:405)
com.google.gerrit.server.account.IncludingGroupMembership.containsAnyOf(IncludingGroupMembership.java:77)
com.google.gerrit.server.account.UniversalGroupBackend$UniversalGroupMembership.containsAnyOf(UniversalGroupBackend.java:152)
com.google.gerrit.server.account.IncludingGroupMembership.search(IncludingGroupMembership.java:115)
com.google.gerrit.server.account.IncludingGroupMembership.containsAnyOf(IncludingGroupMembership.java:93)
com.google.gerrit.server.account.IncludingGroupMembership.contains(IncludingGroupMembership.java:69)
com.google.gerrit.server.account.UniversalGroupBackend$UniversalGroupMembership.contains(UniversalGroupBackend.java:129)
com.google.gerrit.server.project.ProjectControl.match(ProjectControl.java:493)

Change the HashMap to a ConcurrentHashMap to handle concurrent access.

Change-Id: I36f654281b7a1d7126936d86d64e6827d8987577
2014-10-16 05:37:07 +00:00
Stefan Lay
036df27ba0 Fix using HTTP methods other than GET from plugins
Commit 3bde74c2797 introduced a bug in the REST API. Methods other
than GET could not be used anymore  from plugins. For example it was not
possible anymore to delete projects with the delete-plugin using DELETE.

Bug: issue 2949
Change-Id: If90247ec4e0dad03b02d0a9e21202455fece90a7
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
(cherry picked from commit 3d227bbadfa234bcac7400cf41030423bf183ff3)
2014-10-09 06:34:42 +00:00
Dave Borowitz
5766bc02d8 Pass ChangeControl into CodeReviewCommit error instances
Within MergeOp these are keyed by Change.Id, but some error handling
code only receives the CodeReviewCommit and not the ID. That code is
reasonable in assuming there is a change/notes/control available, so
ensure this is the case when creating error instances.

Bug: issue 2911
Change-Id: If65398652f0e5b1a2b10a2fadc9a3b74bce7d556
2014-10-01 21:41:05 +09:00
Dave Borowitz
002b9ee7b3 Avoid CodeReviewCommit.error() whenever possible
The instances returned by this static factory method are severely
limited, in that they are not tied to actual commit objects. In most
cases, we can tie them to commit objects, so do that whenever
possible. Limit the statuses that we can pass to this method by
making it private, and creating separate factories only for those
statuses where there is really no commit.

Change-Id: I0cb392f4f7f5134d4a7487a2a7bb7ac9d770f334
2014-10-01 21:39:08 +09:00
David Pursehouse
b35d0e1208 Update replication plugin to latest revision
- Avoid throwing exception due to deleted change

Change-Id: Ic053278a6145acc4f10b430d08a4c77c7c9c96f2
2014-10-01 11:17:13 +09:00
David Pursehouse
23e841476e Fix broken test compilation
Change-Id: Id4bd313626142f115357c747a47107025e233e8a
2014-09-11 17:02:17 +02:00
David Pursehouse
369b66857a Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Update 2.9.1 release notes again
  Update 2.9.1 release notes
  Fix: permission on user specific reference name cannot work

Change-Id: If55ca570970fb22ba0590dbf598b4fe342ffeb56
2014-09-11 16:47:42 +02:00
David Pursehouse
66665095ea Update 2.9.1 release notes again
Change-Id: I77bc7b8bde59fac06b5caaa3c9eca5fff9935f78
v2.9.1
2014-09-11 16:04:04 +02:00
David Pursehouse
ccba1e333d Update 2.9.1 release notes
Change-Id: If2689e3c80d3b5910f63e4be242cacdb4cf70e76
2014-09-11 16:01:03 +02:00
Bruce Zu
c56f72b09f Fix: permission on user specific reference name cannot work
In ExpandParameters.match() the parameter 'ref' may also contain
"${username}", e.g. in ProjectControl.canPerformOnAnyRef() the call
on controlForRef() puts in a access section name, in this case 'ref'
also need evaluation before doing next match, else it will not be
matched and that section is skipped in preparing RefControl.relevant,
as a result when a user has PUSH power *only* on that section, Gerrit
will reject any upload request from this user.

Fixed. evaluate any per-user ref in ExpandParameters.match().

Change-Id: I42c8e15d147eb4ad031b929cf51ccfc1e17a16e3
2014-09-11 12:41:18 +02:00
David Pursehouse
5afd5b8f00 Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Release notes for Gerrit 2.9.1
  Set version to 2.9.1
  Display parents for all changes, not only merge commits
  Fix JS plugin load when using non-root Gerrit URLs
  Don't require secondary index when running daemon in slave mode
  Remove fixed limit of results returned by secondary index query

Conflicts:
	VERSION
	gerrit-extension-api/pom.xml
	gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.java
	gerrit-plugin-api/pom.xml
	gerrit-plugin-archetype/pom.xml
	gerrit-plugin-gwt-archetype/pom.xml
	gerrit-plugin-gwtui/pom.xml
	gerrit-plugin-js-archetype/pom.xml
	gerrit-war/pom.xml

Change-Id: Id7a49d3792510653da4312e240924d47e8b52724
2014-09-10 11:35:00 +02:00
David Pursehouse
0b58982a17 Release notes for Gerrit 2.9.1
Change-Id: Ic5ed2f40af8f544e9f340695e8ce06e91ec08cd9
2014-09-09 15:31:44 +02:00
David Pursehouse
3a907b60de Set version to 2.9.1
Change-Id: I353ef649fc7066f6e1d0cc50beee3b617b1862f7
2014-09-09 15:29:08 +02:00
Orgad Shaneh
306ed3cb52 Display parents for all changes, not only merge commits
Bug: issue 2279
Change-Id: Iab4930b53e7968f2d6ae1e874b4b474004b4557b
2014-09-09 10:10:00 +00:00
Luca Milanesio
90bef32620 Fix JS plugin load when using non-root Gerrit URLs
When Gerrit is not on the root URL path the JS plugins
failed to load because of the exact matching required
on the request URL.

Current check is now more flexible by checking only 
the suffix of the JS plugin path.

NOTE: In theory this may recognise even different URLs
than the intended one (e.g. /gerrit/bla/bla/bla/plugins/...)
but however they would not land on the HttpPluginServlet
anyway. That's why "endsWith" is good enough for this check.

Change-Id: I299b244a9fcdc9b00175e2054a7ba7363620979b
2014-09-08 15:52:13 +00:00
David Pursehouse
85f97710d3 Don't require secondary index when running daemon in slave mode
Add a dummy index implementation and install it when the daemon is
started in slave mode.

Make the reindex program exit with an error if run on a server that
is configured to run in slave mode.

Disable the query ssh command when in slave mode.

Change-Id: Ia323d7dfc3b8f333857ba310072e41943878c11b
2014-09-08 17:41:44 +02:00
David Pursehouse
dcd2fd364e Remove fixed limit of results returned by secondary index query
The global query limit capability can be set to any value in the
project settings, however in the query implementation the limit
is hard coded to 1000.

Remove the hard-coded limit so that the limit specified in the
global capability is honoured.

Bug: Issue 2879
Change-Id: I9974f43da7cf9902b7e46607d44abc7383f77ecd
2014-09-08 15:23:51 +00:00
David Pursehouse
114845a9ab Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Fix NPE when ReviewInput's message is empty
  Fix NPE in /projects/{name}/children?recursive when a parent is missing
  Fix NPE when submitting review with inline comments via REST

Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java

Change-Id: Icfde6f0274f0ccc92773fd5a376e8c27099437ac
2014-09-06 00:03:55 +09:00
David Pursehouse
b8bb7c1109 Merge "Fix NPE in /projects/{name}/children?recursive when a parent is missing" into stable-2.9 2014-09-05 14:58:45 +00:00
Saša Živkov
b2a9b08aed Merge "Fix NPE when submitting review with inline comments via REST" into stable-2.9 2014-09-05 14:22:42 +00:00
Saša Živkov
28dd4f7b9b Merge "Fix NPE when ReviewInput's message is empty" into stable-2.9 2014-09-05 14:22:11 +00:00
David Pursehouse
b8eee7aae1 Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Add full names for options on list groups REST API
  Add full names for options on list projects REST API
  Make `-S` an alias of `--start` in changes query REST API
  Mention deprecation of sortkey parameters in 2.9 release notes
  Run change hooks and ref-updated events after indexing is done.
  Fix broken formatting in changes REST documentation
  Restrict the input of plugin_archetype_deploy.sh
  Gracefully handle `buck audit` failure
  Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit."

Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/change/PutTopic.java
	gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
	tools/pack_war.py

Change-Id: I89a9b42c049ec1365ef6dec53c73c7a10a41e888
2014-09-05 19:13:31 +09:00
David Pursehouse
538e87aaa6 Add full names for options on list groups REST API
Change-Id: I6663eda2adc00c493624438a16ecbf4818e740e1
2014-09-05 18:39:50 +09:00
David Pursehouse
4cdda6adae Add full names for options on list projects REST API
Change-Id: I1dd7a8b2e27b8172cd8f11c9047063070fa6e698
2014-09-05 18:39:50 +09:00
David Pursehouse
025ea3e560 Make -S an alias of --start in changes query REST API
The option had been added with the name `-S`.  Change the name
to `--start` with `-S` as an alias, making it consistent with the
naming in other REST APIs.

Add the option to the documentation.

Remove the documentation of `-P` and `-N`. These options only exist
to support online reindexing from clients with outdated JS, and are
deprecated. Keeping them in the documentation will potentially
cause confusion.

Bug: Issue 2878
Change-Id: I992acf4a3d1aeebb1ef40c6fed1afcb0fe26fa92
2014-09-05 18:39:50 +09:00
David Pursehouse
2b7f4c5060 Merge "Gracefully handle buck audit failure" into stable-2.9 2014-09-05 09:10:37 +00:00
David Pursehouse
7655df08fc Mention deprecation of sortkey parameters in 2.9 release notes
Bug: Issue 2878
Change-Id: Idd16d5c932b3237cbaeeb8fc8f31e3ebcbf45034
2014-09-05 09:21:49 +09:00
Saša Živkov
37da5858bb Set the version to 2.10-SNAPSHOT
Change-Id: I46d413a0e61b5356eb5702ee230785b8b1471ff1
2014-09-04 13:34:38 +02:00
David Pursehouse
685ef4c6d1 Merge "Run change hooks and ref-updated events after indexing is done." into stable-2.9 2014-09-04 01:06:20 +00:00
Saša Živkov
22e43cc823 Run change hooks and ref-updated events after indexing is done.
The change hooks and ref-updated events were run parallel to the
change (re)indexing. This meant that an event-stream sent events
to the clients before the change indexing was finished. If a client
queried for that change immediately after receiving the event it
happened that the response was not-found as the indexing wasn't yet
done.

Although we haven't had issues with a ref-updated event processors,
firing this event will also wait for the indexing task to finish
as we never know if a ref-updated event processor may trigger a
change query.

Change-Id: Iff17c5aeb9675f3991f938d31ef5048ef5b3b956
2014-09-03 12:27:32 -04:00
David Pursehouse
3ea6a6f12a Merge "Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit."" into stable-2.9 2014-09-03 08:39:21 +00:00
Luca Milanesio
b8b0a0171c Fix Guice module auto-discover for plugin providers
When a plugin provider was using the AbstractPreloadedPluginScanner
to automatically scan its contents, the Guice modules were incorrectly
detected and wrongly assigned:

- Modules not initialised to null at the beginning of the scan
- SshModule incorrectly assigned to SysModule and the other way around
- Inner modules were clashing with named Guice modules
  e.g. install(new Module() { })

This fix brings much more sanity to module detection for plugin
providers (e.g. Groovy, Scala or other pluggable plugin formats).

Change-Id: I4edddd29acd0ff81cd61841bef8d2356ea20e716
2014-09-02 09:32:42 +01:00
David Pursehouse
a14b38b3b0 Fix NPE when ReviewInput's message is empty
Bug: Issue 2877
Change-Id: I3d31af8cdcc26c2dc48c316542f55c402fd63832
2014-09-01 07:41:54 +00:00
David Pursehouse
778fefc8a8 Fix broken formatting in changes REST documentation
Change-Id: Ie17c25fb8f1f5956e79c750316b8086419406210
2014-09-01 07:41:32 +00:00
Bruce Zu
a4e85b2bcd Restrict the input of plugin_archetype_deploy.sh
Input mispelled option of plugin_archetype_deploy.sh
it starts to run. Restrict the input to avoid this error.
Add confirm before run.

Change-Id: I6fdc8b592679c45891210261a47285171b50e35f
2014-09-01 13:56:10 +08:00
David Pursehouse
67c263f877 Gracefully handle buck audit failure
Handle exception raised when invoking `buck audit` and exit
with an error message, instead of dumping a python Traceback.

Change-Id: I3786c4eddffa03117f4437314fc12ee68c689a85
2014-09-01 11:24:08 +09:00
Bruce Zu
6db280663f Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit."
This reverts commit b032a529f83892dfbdfb375c47a90d89756dd8ab. This
commit introduced an issue where tags were not replicated under certain
circumstances.

Bug: Issue 2500
Bug: Issue 1748
Change-Id: I9c902b99c7f656c7002cf3eab9e525f22a22fb85
2014-09-01 01:19:20 +00:00
Shawn Pearce
ccfc8eb70b Fix NPE in /projects/{name}/children?recursive when a parent is missing
If there is a broken edge in the parent graph treat it as having no
children instead of throwing NPE and failing the REST API call.

Change-Id: Ib72f76f04f5804d2b953f0951d3304fc1d6329a2
2014-08-30 22:19:44 +09:00
David Pursehouse
98684818a8 Fix NPE when submitting review with inline comments via REST
NPE occurs when submitting a review with inline comments in
the format:

  {
    "comments": {
      "test.txt": [
        {
          "line": 1,
          "message": "comment"
        },
      ]
    }
  }

The comma following the closing brace after the `"message": "comment"`
line seems to be causing an iterator with a null element to be
generated.

NPE does not occur when the comma is omitted.

To prevent the NPE remove the null element from the iterator.

Change-Id: I248739fce955522f7ee4a93441e48914342d3d7d
2014-08-30 22:11:34 +09:00
Shawn Pearce
7d81ceb96a Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Add missing @Nullabe for Account in SubmoduleOp
2014-08-29 12:01:56 -07:00
Hugo Arès
546d22f0e0 Add missing @Nullabe for Account in SubmoduleOp
Account can be null which was causing a 'Guice provision errors' and
preventing the Merge operation from completing. Add @Nullable for
account parameter in constructor.

Change-Id: I17103ede239190840eaffdd8aaae0bb71de3609c
2014-08-29 12:45:09 -04:00
Shawn Pearce
a7e995d406 Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Replace "line" with "end_line" when range is given in inline comment
  Add example of range comment in REST API documentation
2014-08-27 17:26:33 -07:00
Shawn Pearce
820e8ddc4a Merge topic 'comment-range' into stable-2.9
* changes:
  Replace "line" with "end_line" when range is given in inline comment
  Add example of range comment in REST API documentation
2014-08-28 00:25:56 +00:00
Shawn Pearce
9954c4e249 Merge branch 'stable-2.9' into stable-2.10
Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/git/SubmoduleOp.java
	gerrit-server/src/main/java/com/google/gerrit/server/git/strategy/RebaseIfNecessary.java
	gerrit-server/src/main/java/com/google/gerrit/server/git/strategy/SubmitStrategyFactory.java

Change-Id: Id716ae24401756b9cfbcb46489259c0d9660412a
2014-08-27 17:15:39 -07:00
Shawn Pearce
7a4cdcd5f8 Clarify the failing change in MergeabilityChecker
If an update check fails, it may be change specific. Record the
change as part of the logged message.

Change-Id: I33aba050572f919e150d8e0f1bd678f575301b72
2014-08-27 14:21:26 -07:00
Shawn Pearce
a7ef14229d Gracefully skip mergeability checking on broken changes
If a change is missing its current patch set the mergeablity check
will NPE. Skip the check and just return false, indicating there
was no update made to the change.

Change-Id: Ic82b2db1d2f7d27105a06c4082b51e7308f02b04
2014-08-27 14:21:26 -07:00
David Pursehouse
4a159a1edf Replace "line" with "end_line" when range is given in inline comment
When a range comment is given in the review, the caller must specify
the "range" entity with "start_line" and "end_line" values, and also
the "line" value.

The documentation simply says that the "line" value 'should equal the
end line of the range', but the implementation does not validate this.

If "line" is not specified, the comment is added as a file comment
regardless of what "start_line" and "end_line" values are given in
the range. This can be confusing for users.

Change it so that when a "range" is given, the "line" value is not
necessary, and if given at all will be overridden with the value from
the "range"

Bug: Issue 2861
Change-Id: I5d0d31c392937b1955572781375fc48982ea7664
2014-08-27 21:58:51 +09:00
David Pursehouse
b53c1f6748 Add example of range comment in REST API documentation
Bug: Issue 2861
Change-Id: Id9db8fd7a56178f469b1ed17d1cac14c78bfff79
2014-08-27 21:53:44 +09:00