Commit Graph
552 Commits
Author SHA1 Message Date
Rémy Coutable 3d3ac87af9 Redirect /import to project page if no importing at all and repo exists
Fixes #13367.
2016-02-17 15:05:44 +01:00
Douwe Maan bbbfdba0b9 Merge branch 'bugagazavr/gitlab-ce-extend-hooks' into 'master'
Add new data to project in push, issue, merge-request and note webhooks data

_Originally opened at !2738 by @bugagazavr._

- - -

**What does this MR do?**

Adds more data to hooks, makes repository data in all hook more dry ( use one hook_attrs method for repository data in all hooks )

**Are there points in the code the reviewer needs to double check?**

1. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/project.rb#L738
2. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/concerns/issuable.rb#L132
3. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/push_data_builder.rb#L52
4. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/note_data_builder.rb#L56

**Why was this MR needed?**

More information about user for push events, and more data about repositiry ( project )

**What are the relevant issue numbers?**

No

**Screenshots (if relevant)**

No

See merge request !2788
2016-02-16 13:08:36 +00:00
Yorick Peterse f253f72529 Cleaned up Repository#initialize
The "default_branch" argument is never used and the "project" argument
isn't optional.
2016-02-16 12:13:13 +01:00
Kirill ZaitsevandRémy Coutable b123171d3d Add new data to project in push, issue, merge-request and note webhooks data
- Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`,
  `path_with_namespace` and `default_branch` in `project` in push, issue,
  merge-request and note webhooks data
- Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in
  favor of `git_http_url` in `project` for push, issue, merge-request and
  note webhooks data
- Deprecate the `repository` key in push, issue, merge-request and
  note webhooks data, use `project` instead
2016-02-11 17:22:11 +01:00
Yorick Peterse 9a99d8e49d Cache various Repository Git operations
This caches the output of the following methods:

* Repository#empty?
* Repository#has_visible_content?
* Repository#root_ref

The cache for Repository#has_visible_content? is flushed whenever a
commit is pushed to a new branch or an existing branch is removed.
The cache for Repository#root_ref is only flushed whenever a user
changes the default branch of a project. The cache for Repository#empty?
is never explicitly flushed as there's no need for it.
2016-02-08 15:40:19 +01:00
Josh Frye 91b9cbff8d First pass at deleting projects in the background. 2016-01-29 09:14:16 -05:00
Douwe Maan 30b0d06e9f Fix specs 2016-01-28 15:10:48 +01:00
Douwe Maan 5cce1278ad Correctly determine MR diff base when MR has merge conflicts 2016-01-27 17:23:59 +01:00
Valery Sizov be7bc9d9b0 Backport some changes from EE 2016-01-22 11:24:44 +02:00
Dmitriy Zaporozhets 20cc4bc475 Merge branch 'add-public-param-to-project-api' into 'master'
Add public params to GET /projects api. Closes #3788



See merge request !2409
2016-01-19 18:51:38 +00:00
Josh Frye ae6080c791 Add specs. Adjust filter. 2016-01-19 09:57:00 -05:00
Josh Frye 11797df1af Change 'public' flag to more robust 'visibility' query. 2016-01-19 09:57:00 -05:00
Yorick Peterse b4ee6f57b9 Greatly improve external_issue_tracker performance
This greatly improves the performance of Project#external_issue_tracker
by moving most of the fields queried in Ruby to the database and letting
the database handle all logic. Prior to this change the process of
finding an external issue tracker was along the lines of the following:

1. Load all project services into memory.
2. Reduce the list to only services where "issue_tracker?" returns true
3. Reduce the list from step 2 to service where "default?" returns false
4. Find the first service where "activated?" returns true

This has to two big problems:

1. Loading all services into memory only to reduce the list down to a
   single item later on is a waste of memory (and slow timing wise).
2. Calling Array#select followed by Array#reject followed by Array#find
   allocates extra objects when this really isn't needed.

To work around this the following service fields have been moved to the
database (instead of being hardcoded):

* category
* default

This in turn means we can get the external issue tracker using the
following query:

    SELECT *
    FROM services
    WHERE active IS TRUE
    AND default IS FALSE
    AND category = 'issue_tracker'
    AND project_id = XXX
    LIMIT 1

This coupled with memoizing the result (just as before this commit)
greatly reduces the time it takes for Project#external_issue_tracker to
complete. The exact reduction depends on one's environment, but locally
the execution time is reduced from roughly 230 ms to only 2 ms (= a
reduction of almost 180x).

Fixes gitlab-org/gitlab-ce#10771
2016-01-19 14:03:20 +01:00
DJ Mountney d11ca78cdc Fix the undefinded variable error in Project's safe_import_url method 2016-01-13 17:01:05 -08:00
Stan Hu b7aa13a0cf Before project save ensure that a runners_token exists 2016-01-10 18:12:47 -08:00
Stan Hu 4b4fdf58c7 Fix Error 500 when visiting build page of project with nil runners_token
Properly ensure that the token exists and add defensively check for a
non-nil value.

Closes #4294
2016-01-10 18:12:47 -08:00
Stan Hu 79c0e7212a Annotate models 2016-01-06 13:09:55 +00:00
Douwe Maan 07c39c9976 Merge branch 'brunsa2/gitlab-ce-diverging-branch-graphs' into 'master'
Add graphs of commits ahead/behind default branch (by @brunsa2)

Replaces https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1716

See merge request !2301
2016-01-05 15:44:22 +00:00
Steve Norman 79ec7f2897 Added system hooks messages for renaming and transferring a project 2016-01-04 13:48:00 +00:00
Stan Hu 59533d47dd Fix project transfer e-mail sending incorrect paths in e-mail notification
The introduction of ActiveJob and `deliver_now` in 7f214cee7 caused a race
condition where the mailer would be invoked before the project was committed
to the database, causing the transfer e-mail notification to show the old
path instead of the new one.

Closes #4670
2015-12-29 13:49:44 -08:00
Douwe Maan 84e75ebd4c Merge branch 'fix/visibility-level-setting-in-forked-projects' into 'master'
Fix/visibility level setting in forked projects

Fixes #3136

/cc @DouweM 

See merge request !1744
2015-12-24 12:09:38 +00:00
Tomasz Maczukin 3cfd892f38 Merge branch 'master' into fix/visibility-level-setting-in-forked-projects
* master: (723 commits)
  Bump Rack Attack to v4.3.1 for security fix
  Remove duplicate entry in the changelog
  Remove extra spaces after branchname
  Fix merge-request-reopen button title
  Add branch and tag operation to tree dropdown
  Use gitlab-shell 2.6.9
  Clarify Windows shell executor artifact upload support
  Fix feature specs: we always show the build status if ci_commit is present
  Do not display project group/name when issue and MR are in same project
  Don't create CI status for refs that doesn't have .gitlab-ci.yml, even if the builds are enabled
  Use gitlab-workhorse 0.5.1
  Fix ci_projects migration by using the value only from latest row [ci skip]
  Revert sidebar position for issue and merge request
  Add info on using private Docker registries in CI [ci skip]
  Upgrade Poltergeist to 1.8.1. #4131
  Fix ux issue with "This issue will be closed automatically" message
  Move MR Builds tab next to Commits
  Api support for requesting starred projects for user
  Fix Rubocop complain.
  Fix merge widget JS for buttons
  ...

Conflicts:
	app/models/project.rb
2015-12-21 13:27:34 +01:00
Drew Blessing f177aaa5fa Backport JIRA service 2015-12-18 14:19:48 -06:00
Stan Hu 02f5673171 Fix bad merge 2015-12-16 08:02:28 -08:00
Dmitriy Zaporozhets b8570576e8 Merge branch 'add-open-issues-count-to-api' of https://gitlab.com/stanhu/gitlab-ce
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-12-16 16:08:35 +01:00
Gabriel Mazetto b5291f9599 Fixed Rubocop offenses 2015-12-15 00:53:52 -02:00
Stan Hu 3efae53bd7 Add open_issues_count to project API
This is needed to support Huboard and a generally useful value.
2015-12-11 23:17:36 -08:00
Kamil Trzcinski dd8102f2d1 Fix specs 2015-12-11 18:02:10 +01:00
Kamil Trzcinski 64bfd9d71a Remove ci_ prefix from all ci related things 2015-12-11 18:02:09 +01:00
Kamil Trzcinski 8cdd54cc06 Add runners token 2015-12-11 18:02:09 +01:00
Kamil Trzcinski e80e3f5372 Migrate CI::Project to Project 2015-12-11 18:02:09 +01:00
Kamil Trzcinski 2988e1fbf5 Migrate CI::Services and CI::WebHooks to Services and WebHooks 2015-12-10 16:04:08 +01:00
Douwe Maan 10387f6b8a Merge branch 'master' into tmp-reference-pipeline-and-caching
# Conflicts:
#	spec/lib/gitlab/markdown/autolink_filter_spec.rb
#	spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/commit_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/cross_project_reference_spec.rb
#	spec/lib/gitlab/markdown/emoji_filter_spec.rb
#	spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/external_link_filter_spec.rb
#	spec/lib/gitlab/markdown/issue_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/label_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/merge_request_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/redactor_filter_spec.rb
#	spec/lib/gitlab/markdown/reference_gatherer_filter_spec.rb
#	spec/lib/gitlab/markdown/relative_link_filter_spec.rb
#	spec/lib/gitlab/markdown/sanitization_filter_spec.rb
#	spec/lib/gitlab/markdown/snippet_reference_filter_spec.rb
#	spec/lib/gitlab/markdown/syntax_highlight_filter_spec.rb
#	spec/lib/gitlab/markdown/table_of_contents_filter_spec.rb
#	spec/lib/gitlab/markdown/task_list_filter_spec.rb
#	spec/lib/gitlab/markdown/upload_link_filter_spec.rb
#	spec/lib/gitlab/markdown/user_reference_filter_spec.rb
2015-12-10 14:04:34 +01:00
Stan Hu 9dbc768db8 Update annotations 2015-12-08 21:00:01 -08:00
Douwe Maan 926c3bef9f Merge branch 'master' into reference-pipeline-and-caching 2015-12-08 13:40:32 +01:00
Robert Speicher d5ea93469b Add custom UrlValidator 2015-12-07 16:57:26 -05:00
Jeff Stubler 932a7fd96f Merge branch 'master' into diverging-branch-graphs 2015-12-03 21:53:06 -06:00
Douwe Maan 2955ca613b Merge branch 'master' into reference-pipeline-and-caching 2015-12-02 11:20:51 +01:00
Robert Speicher 5f0d1f30b0 Remove enumerize gem 2015-11-25 17:06:04 -05:00
Tomasz Maczukin 85ad95be74 Merge branch 'master' into fix/visibility-level-setting-in-forked-projects
* master: (296 commits)
  fox tests
  Don't rescue Exception, but StandardError
  adressing comments
  Update gitlab-shell documentation [ci skip]
  Align hash literals in IssuesFinder spec
  Fix tests
  Fix 'Attach a file' link in new tag form
  Add link to git-lfs client  [ci skip]
  Do not limit workhorse POST/PUT size in NGINX
  added specs
  added spinach tests
  Since GitLab CI is enabled by default, remove enabling it by pushing .gitlab-ci.yml
  Fix tests
  Commits without .gitlab-ci.yml are marked as skipped
  Changelog entry for finding issues performance
  Use a JOIN in IssuableFinder#by_project
  Memoize IssuableFinder#projects
  Removed trailing whitespace from IssuableFinder
  Added benchmark for IssuesFinder
  Updated DB schema with new issues/projects indexes
  ...

Conflicts:
	app/models/project.rb
2015-11-20 00:29:04 +01:00
Tomasz Maczukin 1144b70ab6 Change update_forks_visibility_level into after_update hook in Project model 2015-11-20 00:13:56 +01:00
Douwe Maan f5a630111f Merge branch 'master' into reference-pipeline-and-caching 2015-11-19 15:46:04 +01:00
Yorick Peterse a42d469ab2 Merge branch 'atom-feed-latest-update' into 'master'
Improve performance of user profiles, finding groups, and finding projects

This MR improves the following:

* Rendering of profile pages and Atom feeds
* Finding groups (using GroupsFinder & friends)
* Finding projects (using ProjectsFinder & friends)

Initially this MR was intended to only improve rendering of Atom feeds, but over time other fixes were introduced as well as the same code was the cause of all these problems.

See merge request !1790
2015-11-19 10:05:53 +00:00
Tomasz Maczukin 6f41e3d9ca Change forks method to has_many relation 2015-11-18 22:11:15 +01:00
Yorick Peterse a4fc8112df Added Project.visible_to_user
This method can be used to filter projects to those visible to a given
user.
2015-11-18 13:05:45 +01:00
Douwe Maan 40470975e8 Add Project#safe_import_url helper. 2015-11-18 12:00:56 +01:00
Douwe Maan 841a7c6897 Store and show reason why import failed. 2015-11-18 12:00:56 +01:00
Douwe Maan ecb83afabc Refactor ability changes 2015-11-17 15:49:37 +01:00
Douwe Maan e849b51cae Merge branch 'master' into james11/gitlab-ce-removable-group-owner 2015-11-17 15:40:54 +01:00
Marin Jankovski 14032d8eb1 Add support for git lfs. 2015-11-16 12:39:13 +01:00