398 Commits

Author SHA1 Message Date
David Pursehouse
394e6345ab Merge branch 'stable-2.12'
* stable-2.12:
  Update cookbook submodule
  MergeValidationListener: Expose the caller in onPreMerge() method
  Correctly detect symlinked log directory on startup
  RebaseIfNecessary: Use submitter identity as the committer
  Fix schema migration (115) when updating from Gerrit < 2.11
  Hide avatar image when there are no avatars available
  Add back ListChangesOption.DRAFT_COMMENTS

Change-Id: Ibaf1264332fdc30db0f0f548121db728f78927ae
2016-01-13 17:40:16 +09:00
Luca Milanesio
56b945d42b Get project,ref,changekey without calling supplier
Instead of calling the Supplier<ChangeAttribute>.get for retrieving
the change key and its project and ref, we can store the attributes
when the event is created and avoid a lot of DB calls afterwards.

Change-Id: I901fc67eef51967722e18443b72a88b475c112d5
2016-01-13 16:47:06 +09:00
Orgad Shaneh
97d4da6586 Update cookbook submodule
Change-Id: Ibe83998ea13a91392dd50aa7e72d23995367948d
2016-01-07 08:59:04 +02:00
Dave Borowitz
f83c424b4b Fix deprecation warnings from latest JGit update
- FS is no longer required for LockFile constructor.
 - TestRepository#getClock was renamed getDate.
 - Replace usages of RefDatabase#getRef with either exactRef, when we
   know we can bypass the full lookup path, or findRef, where the
   input is user-provided and we might need to add an implicit prefix.

Change-Id: I6309b91ccf99ffaa724be273ddae0d9857b825f9
2016-01-06 10:50:28 -05:00
Dave Borowitz
63d6c82515 MergeValidationException: Allow arbitrary string messages
The purpose of these exceptions is to be thrown by merge validation
listeners, which may come from plugins. It doesn't make sense to force
plugins to choose a status message from a list of messages in
CommitMergeStatus that is a hard-coded enum in core.

This restriction on MergeValidationException is how we ended up with a
bunch of very specific error messages tightly coupled to the
ProjectConfigValidator.

Instead, allow arbitrary string messages, which we are now able to
effectively report from MergeOp. We don't even need to set the status
on the CodeReviewCommit when handling this exception from within
MergeOp, since failFast causes the process to abort before we ever
inspect the CodeReviewCommits.

Change-Id: Iaef3e0a5080522b9812e4709217955c877809567
2015-12-24 10:08:47 -08:00
David Pursehouse
55a35ca60a Merge branch 'stable-2.12'
* stable-2.12:
  Fix sending of inline comments on commit message for initial change
  AbstractQueryChangesTest: Add test for query by draft status
  Fix schema 115: Create a new MetaDataUpdate instance for each update
  Add the --strict-labels option to SSH review command
  Allow to add custom core plugins in release build
  Maven: Split Maven repository settings out to a separate def file

Change-Id: I6025858f08214056c288823fe1ce79685800182a
2015-12-18 11:02:48 +09:00
David Pursehouse
1164e53283 Allow to add custom core plugins in release build
Add a new CUSTOM list in the plugins BUCK config, which is by
default empty. This allows a cleaner patch when adding custom
plugins to be included as 'core' in the release build of a
forked Gerrit.

Change-Id: I12783a8222550983e65bf3bbcd8aef08cdcc9bed
2015-12-14 19:25:49 +09:00
David Pursehouse
43050f6cde plugins: rename 'filter' method in BUCK file
The name 'filter' overrides a python built-in method.

Change-Id: I187d4d34a9c757d76d76d7707156c7482ea59fb4
2015-12-09 15:08:15 +09:00
David Pursehouse
10d85f593c plugins: rename 'filter' method in BUCK file
The name 'filter' overrides a python built-in method.

Change-Id: I187d4d34a9c757d76d76d7707156c7482ea59fb4
2015-12-09 14:45:42 +09:00
Marco Miller
cc2660aaa9 Bump cookbook-plugin to latest subproject commits
* Add revision http(d) test to CookbookIT for further example purposes
* Buck: Don't depend transitively on dropwizard library
* Add dropwizard lib to fix buck standalone mode
* Fix indentation

Change-Id: I810f058adc8e89254278cc60fb6bd226000e5d89
2015-11-24 14:14:24 -05:00
Edwin Kempin
72304440b2 Update download-commands plugin
* Consider allowReachableSHA1InWant for using object IDs

Change-Id: I68b94976ffb6d33d3604e9c848abadd77993fec3
Signed-off-by: Edwin Kempin <ekempin@google.com>
2015-11-19 13:40:07 +09:00
David Pursehouse
982c80de15 Merge "Add TimerContext to wrap timer metrics" 2015-11-18 13:17:34 +00:00
Edwin Kempin
88709bfe5c Update download-commands plugin
* Consider allowReachableSHA1InWant for using object IDs

Change-Id: I68b94976ffb6d33d3604e9c848abadd77993fec3
Signed-off-by: Edwin Kempin <ekempin@google.com>
2015-11-17 16:56:14 -08:00
David Pursehouse
d45f092579 Add TimerContext to wrap timer metrics
TimerContext wraps the context used in Timer{0|1|2|3} and allows to
get the start time and elapsed time.

Update the replication plugin to use it.

Change-Id: I194b9a7bd6a00bc2841ac37ca8654f0b4a2dda00
2015-11-13 18:20:23 -08:00
David Pursehouse
69e6523ae1 Update replication plugin to latest revision
- Change metric to replication_latency

Change-Id: I7b0a4d3a14d598075cf4414971294406b300dc5e
2015-11-13 09:59:12 -08:00
David Pursehouse
d483f7d7c4 Update cookbook plugin to correct revision
The last two changes merged on the cookbook plugin resulted in
merge commits, so the revisions specified on core were not the
latest on the head.

Set it to the correct revision of the latest commit on the head.

Change-Id: I0c1bd42bd94bedfdcc8b24319af7745b352f0859
2015-11-13 00:28:23 -08:00
David Pursehouse
c146887717 Update replication plugin with merges from stable-2.12
Change-Id: I0c7544f46b8365b11eb2d6281fe5bd9dab8ed39e
2015-11-12 19:18:57 -08:00
David Pursehouse
291fcd26f0 Update replication plugin with merge from stable-2.11
Change-Id: I158b4f5b7f82a5e1bdeee64aec78c25d01478829
2015-11-12 17:53:46 -08:00
Martin Fick
5f6222910e Allow plugins to define change search operators.
Create a DynamicBuilder interface in the QueryBuilder class along with
supporting methods and enhancements to support defining dynamic search
operators that can be altered for each query build.  Despite allowing
for dynamic modifications, the QueryBuilder class was kept generic.  No
imports or dependencies on other Gerrit frameworks such as plugin logic
were added to the QueryBuilder.

Enhance the ChangeQueryBuilder to use a DynamicSet to define
DynamicBuilders so that plugins can define search operators.  Plugins
can define DynamicBuilders and bind them to the DynamicSet on load.
Plugin search operators are defined similarly to the way
ChangeQueryBuilder operators are defined, by annotating methods in the
DynamicBuilder with @Operator.  The name of the annotated method
determines the name of the search operator.

Change-Id: I11daed482562b82cb4dce1d8abd846f06784eb3a
2015-11-12 14:52:50 -07:00
Edwin Kempin
6318d4dd0a Merge "Removed outdated text in plugins/README" 2015-11-11 23:04:35 +00:00
Gustaf Lundh
4634328f04 Removed outdated text in plugins/README
Change-Id: Idef3b18c0d43d522c030bdd1817f5947c3e3863a
2015-11-11 22:49:12 +00:00
David Pursehouse
2630f923ec Update cookbook plugin to latest revision
- Introduce example of plugin specific configs
- Introduce example of how to connect to the MetricsRegistry

Change-Id: I85405b1fd431ded07f90ed846a74eba716e41ef6
2015-11-11 14:24:39 -08:00
David Pursehouse
849f8bc585 Update replication plugin to latest revision
- Send replication time metric to Gerrit's MetricsRegitry

Change-Id: I6e1b14517040c8c0015e48d1ea3a06230eddd93d
2015-11-11 12:02:20 -08:00
David Pursehouse
dc53a1665b Update cookbook plugin revision
- Merge stable-2.11

Change-Id: I4ab9e6018eea0390e73d558c92a4765e561097fa
2015-10-30 12:01:27 +09:00
David Pursehouse
0fa032ea2c Update cookbook plugin to latest revision
- Update Guava to 19.0-RC2 to match Guava version in Gerrit core

Change-Id: Ifd021268dadcbf5b169b49c773a59ee9920c67ae
2015-10-22 09:37:18 +09:00
Dave Borowitz
85f0487714 Rename getCurrentUser to getUser
It is never ambiguous to say "User" instead of "CurrentUser". Save
some typing.

Change-Id: I03a051f1fd3758ba63749cded20a7c135b6cf58a
2015-10-19 11:49:06 -04:00
David Pursehouse
970f7f8be9 Update replication plugin to latest revision
Change-Id: Iaa1e34c6332c3d61aa2ef5b7e27f33f26dc0c7ab
2015-10-16 14:23:20 +09:00
David Pursehouse
1acb946b48 Merge branch 'stable-2.11'
* stable-2.11:
  PatchListLoader: Synchronize MyersDiff and HistogramDiff invocations
  Update singleusergroup to latest revision
  ListTags: Fix ref in TagInfo for signed/annotated tags
  Fix review labels with AnyWithBlock function
  Fix NullPointerException in ls-project command with --has-acl-for option

Change-Id: Id758eada94c051b4137e6ffaefba1ef9093d30cc
2015-10-09 16:07:35 +09:00
Hugo Arès
f0151ab079 Update singleusergroup to latest revision
Change-Id: Iac3c220389d86e09c9db2896bd10170e2c679985
2015-10-08 10:56:36 -04:00
Dave Borowitz
0d9f089856 Revert accidental submodule change from 70166683
Change-Id: I00332bd394355a8dd9096f795d342d840f8c4e4c
2015-10-08 10:44:55 -04:00
Dave Borowitz
70166683ff PatchSetInserter: Remove broken, unused factory method
The only remaining constructor always sets the repository, so we no
longer need to initialize it in init(). As a result, the repo field
and related fields can be made final as well.

Even better, we no longer need to distinguish between the
execute/don't execute cases in insert().

Change-Id: I39af53f954e746eee6b0e8034ccf9f68bb5549ff
2015-10-08 10:17:37 -04:00
David Pursehouse
7b9f5910fb PatchSet: Change isRef to isChangeRef
The name isChangeRef is clearer.

Update the replication plugin to use the new method name.

For backwards compatibility for other plugins, keep the isRef method
and mark it as deprecated.

Change-Id: I99c6b2daeaf6c3a5e5d948ae32e0751f3ffedf31
2015-10-08 20:40:28 +09:00
David Pursehouse
60b386ec58 Update replication plugin
- Include remote-ref-status in replication events

Change-Id: I0d1ae0f5ae6d8977176ca2258aeb9b0a49119146
2015-09-29 13:04:23 +09:00
David Pursehouse
d3e0807bb9 Merge "Remove duplicated code to create a log file from a plugin" 2015-09-29 02:59:28 +00:00
David Ostrovsky
947b5e53ac Expose acceptance test framework as new plugin artifact
Split the current gerrit-acceptance-tests in two parts:

* framework + some needed deps, that is exposed as additional plugin
artifact
* rest of the gerrit-acceptance-test project

To implement the split and not to pull in too many dependencies, some
refactoring was needed. Particularly, gerrit-server:testutil depends
on gerrit-server:server, that depends on almost everything. Similar
problem was with gerrit-pgm:pgm, that is needed for AbstractDaemonTest
to work. Split the rules in gerrit-pgm to break transitive dependency
chain. We shouldn't ship artifacts twice, in plugin-api and in
acceptance-framework.

This change also partially reverts Ie9e63de622, where
//gerrit-acceptance-tests:lib with all its transitive dependencies was
included in plugin-api artifact.

Expose gerrit-acceptance-framework as new plugin artifact. This allows
us to support unit tests in plugins in three different build modes:

* Buck in tree build mode
* Buck standalone build mode
* Maven build

To install gerrit-acceptance-framework locally, the following command
is used:

  buck build api_install

To deploy gerrit-acceptance-framework to Maven Central, the following
command is used:

  buck build api_deploy

To support unit tests in tree build mode, the following Buck variable
is exposed: GERRIT_TESTS and can be used, e.g.:

  java_test(
    name = 'cookbook_tests',
    srcs = glob(['src/test/java/**/*IT.java']),
    labels = ['cookbook-plugin'],
    source_under_test = [':cookbook-plugin__plugin'],
    deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
      ':cookbook-plugin__plugin',
    ],
  )

To support unit tests in standalone build mode, acceptance-framework
maven jar is defined in lib/gerrit/BUCK file:

  maven_jar(
    name = 'acceptance-framework',
    id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
    license = 'Apache2.0',
    attach_source = False,
    repository = REPO,
  )

bucklets/gerrit_plugin.bucklet is extended with the same variable
that points to the new maven_jar artifact, so that the same Buck
java_test() rule can be used in both modes.

Test plan:

1. run tests in gerrit tree
2. apply corresponding change to cookbook-plugin and run tests in
gerrit tree mode
3. apply corresponding change to bucklets, and run tests for
cookbook-plugin in standalone build mode

Change-Id: I4cadf6616de36ca24712f8b07d282b7a50911105
2015-09-25 14:46:10 -04:00
Hugo Arès
9344a47d08 Remove duplicated code to create a log file from a plugin
Plugins having their own log file is a common case but the code for
creating it was duplicated. See, e.g. replication, delete-project and
importer plugins.

Move duplicated code into a class named PluginLogFile that plugins can
extend to have their own log file.

Change-Id: I7d7fc137e9dced27338c3bc4e19ab9d61a7b6ba6
2015-09-25 11:20:30 -04:00
Dave Borowitz
77a5a051e3 Update download-commands plugin
Change-Id: I16fa781a0d4141330c63c884cef5e4b1c4a7a5ac
2015-09-09 11:34:08 -04:00
Dave Borowitz
1912561ec1 Merge changes from topic 'arbitrary-download-schemes'
* changes:
  Sort download schemes and command names
  SetPreferences: Enforce download scheme is registered
  Describe allowed values for download_scheme field
  DownloadUrlLink: Kill KnownScheme enum
  Store preferred download scheme as arbitrary strings
  DownloadConfig: Make set methods return ImmutableSet
  Remove DEFAULT_SCHEMES and DEFAULT_COMMANDS
2015-09-09 15:00:57 +00:00
David Pursehouse
a5250ae1ba Update cookbook-plugin revision
- Add acceptance IT test example for (based on) new PluginDaemonTest class

Change-Id: I5a7620020710ab65f01803a44df8fc262620ed99
2015-09-08 12:08:19 -04:00
Dave Borowitz
0a741dd21c Store preferred download scheme as arbitrary strings
Although plugins can register download schemes with arbitrary names,
the getter/setter in AccountGeneralPreferences were allowing only a
specific enum type corresponding to the core download schemes. Get rid
of that enum type, and store arbitrary strings in the database. To
avoid a schema upgrade (which would be an annoying multi-step process
for a zero-downtime upgrade), convert to/from the old enum-string
values in AccountGeneralPreferences. Everywhere else, use the key from
the scheme map, e.g. "anonymous http" instead of "ANON_HTTP". This
eliminates the special-case code when sending RPCs from the client,
and avoids weird undocumented behavior in the set preferences REST API
call.

Change-Id: I3e2397d8dfa15d20329cc83e1e3fe069c8e021c4
2015-09-08 08:44:55 -04:00
Dave Borowitz
f01551975f Remove DEFAULT_SCHEMES and DEFAULT_COMMANDS
Using these sentinels complicated the implementation of the core
download-commands plugin, and inadvertently allowed for undocumented
enum values when reading from the config. Simplify callers by
prepopulating the sets with the proper default values when nothing is
specified in the config.

Change-Id: Ib1cb8a255110adec241608bf62d5331fd706794e
2015-09-08 08:39:56 -04:00
David Pursehouse
cd63bcaff5 Use try-with-resource when opening stream
Change-Id: Ie83c3f5ef629b49bec5984c1c7f47433673fb4df
2015-08-27 18:40:14 +09:00
David Pursehouse
1eb09cb980 Open Repository and RevWalk in try-with-resource
Change-Id: I551159e81afe9615be207fadf4f961762b1f6ad2
2015-08-27 18:40:14 +09:00
David Pursehouse
4b8516b3a0 Open review DB in try-with-resource where appropriate
Try with resource can't be used for instances that are got
through a provider. Suppress the warning in those cases.

Change-Id: I7670151d8f179238bd3e887cc1597902b6f28a91
2015-08-27 18:40:08 +09:00
Dave Borowitz
cb2845b4f8 Move FactoryModule to gerrit-extension-api
Change-Id: Iabbc26d43f5ee8327d7facb1dadc1a66527268b8
2015-08-26 12:39:08 -04:00
Sven Selberg
21c8686867 Add WebLink extension point for file history
Change-Id: Ib70f1beeb03dfbf7ebb0ccef0b6f46157b9fac3a
2015-08-25 08:47:55 +02:00
David Pursehouse
f707c8a98d Fix plugin revisions
The plugin revisions were updated in [1] to the sha1s in changes [2]
and [3].

However [2] and [3] were not based on the latest head of the branch,
so when they were submitted merges commit was made by Gerrit and thus
the revisions set in [1] are not the actual latest revisions on the
head of the branch.

Update them to the correct revisions.

[1] I814628e73c862d2b85b9278836a59166f5be587a
[2] Ifa47174d7c11ef5d86b2e1be2536b330b9725948
[3] I7e3f1c39076826cc515bcb7256d26937f05fea6d

Change-Id: I3dfb73598ec9045d1657649c524a817946c3b13d
2015-08-25 00:46:22 +00:00
Dave Borowitz
05b50b4223 Update core plugins to organize imports
Change-Id: I814628e73c862d2b85b9278836a59166f5be587a
2015-08-24 10:28:45 -04:00
Edwin Kempin
b1e6a3a69c Add support for user-specific URL aliases
User-specific URL aliases overwrite global URL aliases.

Plugins may use user-specific URL aliases to replace certain screens
for certain users. The cookbook plugin was adapted to demonstrate
this.

Change-Id: I9b4d89e9b0fcedbeceb7298b91506167d464a070
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2015-08-21 08:26:23 +02:00
David Pursehouse
b507b46d37 Update replication plugin to latest revision
- Fix broken formatting in documentation

Change-Id: Ifb489fac38c83569c5d0a2b4bfa0630a3532ed74
2015-08-21 10:46:08 +09:00