3025 Commits

Author SHA1 Message Date
David Pursehouse
f232d755b5 Remove unused FormatUtil class
Change-Id: I5f19dd7582355fcc9465d1bc1d479b7d3f5bb500
2019-01-23 20:11:02 +09:00
David Pursehouse
96f3624015 HostPageData: move to c.g.g.httpd and rename to XsrfConstants
The only place this class is referenced from is the httpd package, and
the only things it contains are XSRF constants.

Move it to the same package, and rename it to a more appropriate name.

Change-Id: Ia9cb3c8c66ed1db3aeb69419d5187a5aa5bb8936
2019-01-23 20:08:30 +09:00
David Pursehouse
2195719e49 Remove unused SignInRequired class
Change-Id: I3d28e6237ee07b649afdd04ccf075ba507c5af70
2019-01-23 20:03:34 +09:00
Changcheng Xiao
ff19856567 Move default AllProjects configs to a utility class for tests
This would allow us to reuse those methods for internal tests.

Change-Id: I95c012ed4d39c4eaad77e3336ffb14812b0e7937
2019-01-23 11:17:11 +01:00
Patrick Hiesel
a9c11a72be Only consider non-Gerrit refs when computing tag reachability
Historically, Gerrit was generous when computing tag reachability and
fed all refs into the computation. For Gerrit instances that have a lot
of changes, this is extremely expensive.

This commit changes that behavior and documents it. The motivation is
that every ref that Gerrit manages (changes, meta refs, etc.) is
Gerrit's domain and there is no use case for users to add tags.

For now, orphaned tags are still served to users who have READ on refs/*
and no block rules configured, but that might as well change in the
future.

Change-Id: I4820ea69fc4c90127a9a5615ae63fabb7dd32175
2019-01-23 09:19:28 +01:00
David Pursehouse
136b3d6e3e Remove unused SshHostKey class
Change-Id: I86259b546d82a6277a3e61c55e29169c7f0cba6a
2019-01-23 16:55:10 +09:00
Patrick Hiesel
4cf34d95de Don't filter tags separately for internal reachability check
In all callers we are providing a set of refs that we care about. This
is either refs/heads/* and refs/tags/* or all refs minus change refs.

In both cases filtering tags separately (that means separately obtaining
all refs that are visible to the user irrespective of the provided
prefix and using these for reachability) is superfluous.

Change-Id: I3151528ada71abdc62721a0d3daa62884036ee1f
2019-01-23 08:50:36 +01:00
David Pursehouse
d33ba879f0 Remove unused ProjectAccessUtil
Change-Id: I12f589c4f7bc316198ea87ea9f92daa8b1cbf588
2019-01-23 16:50:16 +09:00
Patrick Hiesel
6b7c8ab89a Exclude change refs from reachability check if changes already checked
For some operations in Gerrit we perform a reachability check. The
majority of checks is fine with just checking if the commit is reachable
from refs/heads/* or refs/tags/* but CommitsCollection requires some
more places to be included like refs/meta/dashboards or refs/users/*.

However, it does not require refs/changes/* to be included in the check
because we have already checked if the commit is reachable by a change
(= is the commit of a change). This check also covers stacked changes as
we have one change per commit in the stack.

There is no case where the parent of a change is neither another change
nor part of a ref that can be reached through refs/heads/* or
refs/tags/*. Therfore we spare reevaluating change refs where possible.

Change-Id: Icba91f7c770863d34c920320e944e8f2e86783e1
2019-01-23 08:50:10 +01:00
Changcheng Xiao
856cbb39f1 Delete unused ProjectAccess class
Change-Id: I41f509699c5ec677af70b489bf691e42a05af50e
2019-01-23 16:49:39 +09:00
David Pursehouse
3307aed7b1 Merge "ListProjects: Remove parent candidates option" 2019-01-22 23:56:30 +00:00
Paladox
ede7366156 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Set version to 2.15.9
  ListProjects: Refactor to avoid excessive heap usage
  ListProjectsIT: Add test for parent candidates option

Change-Id: If133e258196163e0ce4c58fc9bcf38ef84485bb5
2019-01-22 23:20:05 +00:00
David Ostrovsky
f7479fda63 ListProjects: Remove parent candidates option
After removal of GWT UI this feature is not used and this can be
removed.

Create project SSH command is offering a similar --suggest-parents
but this is implemented using a dedicated: SuggestParentCandidates
class.

PolyGerrit UI doesn't offer the list of parent candidates to select
from in create repository dialog.

Change-Id: Iaaa687f4df373bc945632367be49941c939f8b9b
2019-01-22 20:43:35 +01:00
Alice Kober-Sotzek
27ad9180f3 Improve mapping for AuthException on Git layer
Client errors (like an authentication issue) shouldn't be prefixed by
"internal server error: " when Gerrit rejects a commit upload. We
already have special handling for BadRequestException and
UnprocessableEntityException, which we now extend to AuthException.

Change-Id: I126d89dd8d296d20a3cf0b0fbe73d337b2e35320
2019-01-22 11:32:35 +01:00
David Pursehouse
aa89f78aee Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Fix support for deleting branches (if you have can_delete)
  FileApi: Add a method to set a file's "reviewed" flag

Change-Id: I72b3ece539223452a8cd446825d20eacbb82f153
2019-01-22 13:17:39 +09:00
Changcheng Xiao
08035c435e AllProjectsCreator: allow to initialize with only project description
With d4fdc9323d8, we're able to read default "project.config" for
All-Projects from the "etc" folder, which makes it possible for us to
provide default configs from the "etc" folder rather than All-Projects.

This commit makes sure we're able to create an All-Projects with just
a project description initialized.

Change-Id: Ia07a818c9897a0bdb8a3f603923b607d74570b6e
2019-01-21 09:37:14 +01:00
Changcheng Xiao
3d3e22c45a AllProjectsCreator: add an 'initDefaultAcls' boolean field
With this boolean field, we can control whether initializing
default access sections in the All-Projects.

Change-Id: Ia5dfa6a2a265f2887a21c246de0a8da433db5b2c
2019-01-21 09:36:59 +01:00
Changcheng Xiao
545328b45c AllProjectsCreator: move ACL initialization into separate methods
With these separate methods, it's easier to understand what ACLs
are initialized by default when an All-Projects is created.

Change-Id: Ie2ecf50f0eae3778520abb283d5fe82fe0835ce8
2019-01-21 09:36:59 +01:00
Changcheng Xiao
7f59bd3537 Provide 'projectDescription' and 'booleanProjectConfig' in 'AllProjectsInput'
Change-Id: Id85b4ab30870387414a4258883e0e00e1f27fcc5
2019-01-21 09:36:59 +01:00
Changcheng Xiao
25a6c0cedc Define 'AllProjectsInput' for 'AllProjectsCreator'
This allows us to have better control over what is going to be initialized
when an All-Projects is created. As a start, this commit just defines this
@Auto_Value class with several simple properties.

Change-Id: I3facd009434ee387e1799c9ef7b2b49353134379
2019-01-21 09:36:59 +01:00
David Pursehouse
7b325695ab Merge branch 'stable-2.16'
* stable-2.16:
  Consume JGit artifacts from Maven Central
  Consume JGit artifacts from Maven Central
  gr-related-changes: Don't show "Same topic" for only one change
  RelatedChanges: Don't show "Same Topic" for only one change
  ChangeEditApi: Allow to set options on change edit detail request
  JS API: Expose invalidateReposCache method
  restAPI.invalidateGroupsCache: Remove unused parameters
  restAPI.invalidateReposCache: Remove unused parameters
  Add Javadoc to clarify behavior of {Accounts|Changes|Groups}#withOptions
  Update highlight.js to master branch
  Docs: Add use-case for Private changes
  OnlineNoteDbMigrationIT: improve readability of some tests
  Update git submodules
  migrate-to-note-db: add --skip-project option
  OnlineNoteDbMigrationIT: Reuse existing constant
  Do not crash if permitted labels array is empty
  Fix '/' getting typed in search bar when pressed
  Encode project name in download commands
  ProjectResetter: Avoid Repository#getAllRefs
  AbstractDaemonTest: Avoid Repository#getAllRefs
  ChangeUtil: Remove javadoc references to deprecated JGit methods
  Set version to 2.16.4-SNAPSHOT
  AccountManagerIT: Fix failing authentication tests
  ChangeEditApiImpl: Access non-Singleton change edit classes via Provider
  ListChangesOption: Add missing word in Javadoc
  Update git submodules
  Update git submodules
  Fix broken links in gr-icons.html
  Add release notes for Gerrit v2.10.8
  AccountIT#updateDisplayName: Rewrite to work with updated account manager
  Add release notes for Gerrit v2.9.5
  AccountApiImpl: Fix message in exception
  RelatedChangeAndCommitInfo: Use default CommitInfo#toString
  Support Get Related in extension API
  CommitInfo: Use ToStringHelper
  CommitInfo: Handle root commits in toString()
  Implement equals/hashCode/toString in CommitInfo and friends
  Set version to 2.15.9-SNAPSHOT
  AccountIT: Disable failing updateDisplayName test
  Set version to 2.16.3
  Set version to 2.13.12
  Set version to 2.12.9
  Set version to 2.11.12
  Set version to 2.10.8
  Upgrade JGit to 5.1.5.201812261915-r
  Set version to 2.15.8
  Upgrade JGit to 4.9.8.201812241815-r
  Set version to 2.9.5
  Set version to 2.14.18
  Revert "Fix the missing DB entry in Gerrit DB"
  Upgrade JGit to 4.7.7.201812240805-r
  maven_jar: Add repo.eclipse.org to supported repositories
  Update git submodules
  ChangeApi: Add method to list change reviewers
  Bazel: Automatically fix lint errors with buildifier 0.20.0
  Revert "Temp fix for projects list ordering in PolyGerrit"
  Do not center the "By User" column in the Group Audit Log table
  Bazel: Fix more buildifier warnings
  Bazel: Automatically fix lint errors with buildifier 0.20.0
  Fix typo in documentation of edit preferences
  Add MIME type for favicons to list of allowed image types.
  Bazel: Automatically fix lint errors with buildifier
  Mail: Use correct patch set when reading line from file
  Upgrade JGit to 4.5.5.201812240535-r

Change-Id: I15dd15a2e3a1171ddfb792a3f17c43861d434421
2019-01-21 14:53:00 +09:00
Jonathan Nieder
5ac0d6df9c Merge "Remove @VisibleForTesting annotation on ChangeKindCacheImpl#NoCache" 2019-01-20 04:51:15 +00:00
Jonathan Nieder
fbd60a46ec Remove @VisibleForTesting annotation on ChangeKindCacheImpl#NoCache
It is not used in any tests.  It is useful when using Gerrit as a
library, so let's make this helper an ordinary public class.

Noticed via an error-prone warning about a Google-internal caller.

Change-Id: I6fe9f8a792b7fa9328f95aa97893bcec78db367a
2019-01-19 19:32:17 -08:00
David Pursehouse
ec26f04606 Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Consume JGit artifacts from Maven Central
  Consume JGit artifacts from Maven Central
  gr-related-changes: Don't show "Same topic" for only one change
  RelatedChanges: Don't show "Same Topic" for only one change
  ChangeEditApi: Allow to set options on change edit detail request
  Add Javadoc to clarify behavior of {Accounts|Changes|Groups}#withOptions
  OnlineNoteDbMigrationIT: improve readability of some tests
  Update git submodules
  Add release notes for Gerrit v2.10.8
  Add release notes for Gerrit v2.9.5
  Set version to 2.13.12
  Set version to 2.12.9
  Set version to 2.11.12
  Set version to 2.10.8
  Set version to 2.9.5

Change-Id: Id02a8afc6e4e8d42b759ed2ea28a0926411ff2e8
2019-01-18 21:47:17 +09:00
David Pursehouse
cc63830227 Merge "Consistently don't import Id/Key/NameKey/Entry types" 2019-01-18 10:13:12 +00:00
Dave Borowitz
fbe4dfdca7 Account: Use Guava for Id#tryParse
This was hand-rolled when this needed to compile under GWT; no longer.

Change-Id: I40233232b966d31850558108b3981e5f2dcf0821
2019-01-17 14:03:51 -08:00
Martin Fick
b186cd759f Add a --no-limit option to the ssh and rest query commands
This option will return all possible results and overrides the default
limit and any limit specified using "limit" query operator. This is
useful for applications that need the entire result set with a single
query. Getting data with a single query improves the accuracy since
there is less chance of the data being modified between calls.

Change-Id: Idc4dd5799195110c580c7e6d88c0a6e8c6734d6c
2019-01-17 13:12:46 -08:00
David Pursehouse
09bc73fe78 Merge "If submit fails due to dependency on non-visible change include calling user into message" 2019-01-16 23:35:56 +00:00
Dave Borowitz
2571e34292 Remove unused UpdateParentFailedException
Change-Id: I1aae574a9262411e47a1cd37ed51c2c5bcdd3702
2019-01-16 12:22:26 -08:00
Dave Borowitz
84845478be SiteProgram: Remove DB-specific error handling
Change-Id: If44075be88bb5c0e54c1f84c37b3c3fdbbf415b2
2019-01-16 12:22:26 -08:00
Edwin Kempin
6a3d8c818b If submit fails due to dependency on non-visible change include calling user into message
Submitting a change can fail if the commit that should be merged depends
on a commit that belongs to change that is not visible to the calling
user. In this case the following message is returned as part of the 409
response for the submit request:

  Change <change-number>: Depends on change that was not submitted.
  Commit <sha1-commit-1> depends on commit <sha1-commit-2> which cannot
  be merged.  Is the change of this commit not visible or was it
  deleted?

With this message alone it’s difficult to investigate the problem
because it doesn’t include the calling user, the user for which the
change is not visible. Change it to

  Change <change-number>: Depends on change that was not submitted.
  Commit <sha1-commit-1> depends on commit <sha1-commit-2> which cannot
  be merged.  Is the change of this commit not visible to <calling-user>
  or was it deleted?

Dry-run submits are executed in the background and hence there is no
current user available. This doesn’t matter since for dry-run submits
the message is anyway ignored.

Change-Id: I8ff1ad7041c9632b3fdbfdba19d83c984a776a01
Signed-off-by: Edwin Kempin <ekempin@google.com>
2019-01-16 16:00:32 +01:00
David Pursehouse
dd55d5eeca Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  Update git submodules
  migrate-to-note-db: add --skip-project option
  OnlineNoteDbMigrationIT: Reuse existing constant
  Fix '/' getting typed in search bar when pressed
  Encode project name in download commands
  ChangeEditApiImpl: Access non-Singleton change edit classes via Provider

Change-Id: I4bc088e0f43919b8fea1fface333247fb1a4b786
2019-01-16 15:27:58 +09:00
Dave Borowitz
db47370011 Consistently don't import Id/Key/NameKey/Entry types
These are often ambiguous without their containing class, not to mention
used inconsistently within single class files. Implement a consistent
policy.

After this change there are exactly two remaining:

$ find . -name \*.java | sort | xargs pcregrep '^import.*\.[A-Z][^.]*\.(NameKey|Key|Id|Entry);'
./java/com/google/gerrit/httpd/CacheBasedWebSession.java:import com.google.gerrit.httpd.WebSessionManager.Key;
./javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java:import com.google.gerrit.server.change.ChangeKindCacheImpl.Key;

These are corner cases of a specific cache implementation where the Key
type is less ambiguous, and the full name is long.

Change-Id: I1d2e9eb6c7dec0d09ca42b41dc252786d2024a5a
2019-01-15 13:57:43 -08:00
Dave Borowitz
024e5aa31d Merge "Move Sequences to notedb package" 2019-01-15 21:55:12 +00:00
Dave Borowitz
3b13b3ba08 Move Sequences to notedb package
Remove the explicit binding from GerritGlobalModule; a just-in-time
binding is good enough.

Change-Id: I1b16e0717e5c15da3a97ad84dab9e0b3792e825b
2019-01-15 07:34:03 -08:00
Patrick Hiesel
ace3dc9f0a Revert "Rework SearchingChangeCacheImpl"
This reverts commit f5c89c1a6f01aee6295717fb785a4bfbacb8ce86.

Reason for revert:

Bootstrapping doesn't work because the index doesn't give us
all changes. In addition, we would have to filter way more
refs with this cache because the index-backed cache limitted
the ref filtering by recency (= you can't fetch a change from
say 2015) which is another performance bottleneck.

Change-Id: I447eaeb652e530ed560f31de15bb012912e14fff
2019-01-15 15:22:37 +01:00
Dave Borowitz
7b8b18289c ProjectResetter: Avoid Repository#getAllRefs
Change-Id: I8714e0bda17a2fa0f7f439b6eb68b4c82c383b4a
2019-01-15 14:51:42 +09:00
David Pursehouse
df7dda58df AbstractDaemonTest: Avoid Repository#getAllRefs
Change-Id: I42a8db041c7763bd03284194ff2cb052309ff66b
2019-01-15 14:47:07 +09:00
David Pursehouse
7b78caf742 AbstractDaemonTest: Use exactRef instead of getRefs
Change-Id: I4468985c6cce39c31da8bf4ae043f9cc18f056d1
2019-01-15 14:45:32 +09:00
Dave Borowitz
49b5276607 ChangeUtil: Remove javadoc references to deprecated JGit methods
The descriptions are detailed and accurate enough without this
historical note.

Change-Id: If942039c703e3fbd83a16875d083dc3513f50ccc
2019-01-15 14:25:19 +09:00
David Pursehouse
f4b7be549a Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
  ListChangesOption: Add missing word in Javadoc
  Update git submodules
  AccountIT#updateDisplayName: Rewrite to work with updated account manager
  AccountApiImpl: Fix message in exception
  RelatedChangeAndCommitInfo: Use default CommitInfo#toString
  Support Get Related in extension API
  CommitInfo: Use ToStringHelper
  CommitInfo: Handle root commits in toString()
  Implement equals/hashCode/toString in CommitInfo and friends
  Set version to 2.15.9-SNAPSHOT
  AccountIT: Disable failing updateDisplayName test

Change-Id: Id2c1ad86a3f5ebb62a932b02d315330ae7a11102
2019-01-15 14:15:02 +09:00
David Pursehouse
152096b13e Merge changes I76319392,I72a86254
* changes:
  Support searching changes by file extension
  AbstractQueryChangesTest: Factor out a method for adding files
2019-01-14 23:28:10 +00:00
Dave Borowitz
e93969399a Support searching changes by file extension
Change-Id: I76319392dfa91e18ad4be6d9673951d03aa68a00
2019-01-14 08:57:13 -08:00
Patrick Hiesel
02ea60c561 Merge "Test for null values in DefaultRefFilter" 2019-01-14 16:24:50 +00:00
Patrick Hiesel
fd367f661d Test for null values in DefaultRefFilter
If JGit can't find the ref, it will return null. There is no guarantee
that we have a change meta ref for each change so we want to log these
instances instead of failing the entire operation.

Change-Id: I2e33d05e77bb80c2e1db6b5ee0067dfefa25cce2
2019-01-14 15:30:14 +01:00
Patrick Hiesel
9a87c23c98 Use Lambdas for disabled indices in tests
Change-Id: I59638ab02833b1694037050cee129560c6763b4b
2019-01-14 14:52:10 +01:00
Patrick Hiesel
30fd103963 Make disableDb return AutoCloseable
Change-Id: I18308dcd4c24ede3d8fb4328cfc7b5664dc9426d
2019-01-14 14:52:09 +01:00
Matthias Sohn
e64b2a9b2e Fix warnings "Javadoc: Invalid member type qualification"
Change-Id: I9286651e8311cc277b430da6f3074c6dbbdcff48
2019-01-13 23:31:13 +01:00
Dave Borowitz
5c4bea21ef AbstractDaemonTest: Remove deprecated setApiUser methods
Change-Id: I4de86d030afde4ee09de1afa4217d98f33da1db2
2019-01-11 08:10:56 -08:00
Patrick Hiesel
90fa2ceb4b Merge changes Icdf4293f,I5eda9d41
* changes:
  Remove unused logger instance
  Rework SearchingChangeCacheImpl
2019-01-11 12:16:10 +00:00