Commit Graph

215 Commits

Author SHA1 Message Date
Igor db68003e8b Memoize old_blob and new_blob to improve performance 2019-03-28 12:11:37 +00:00
Oswaldo Ferreira 03e0604d5d Prepare suggestion implementation for multi-line
Adds the groundwork needed in order to persist multi-line suggestions,
while providing the parsing strategy which will be reused for the
**Preview** as well.
2019-03-27 12:26:53 -03:00
Douwe Maan 7d3c5d882c Merge branch '59147-duplicate-match-line' into 'master'
Fix duplicated bottom match line

Closes #59147

See merge request gitlab-org/gitlab-ce!26402
2019-03-21 16:43:54 +00:00
Mark Chao 8723f29255 Fix diff bottom expand button appears twice
This is a quick fix by only append match line once
when calling diff_lines_for_serializer multiple time.

Also enable feature by default
2019-03-21 23:08:29 +08:00
Oswaldo Ferreira 53a5960496 Implement multi-line suggestions filtering
Implements the filtering logic for
`suggestion:-x+y` syntax.
2019-03-20 11:30:24 -03:00
Oswaldo Ferreira 08f789736e Implement suggestion diff lines parser 2019-03-18 13:21:13 -03:00
Douwe Maan 6cfa5ee536 Merge branch 'expand-diff-to-full-file' into 'master'
Expand diff to entire file

Closes #19054

See merge request gitlab-org/gitlab-ce!24406
2019-03-07 11:33:15 +00:00
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02:00
Phil Hughes b14de8e1f5 Add option to expand diff to full file
The user can also toggle between the diff changes and
the full file diff.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/19054
2019-03-06 15:51:44 +08:00
Natalia Tepluhina bf8f32da7f Replaced part of diff file properties with diff viewer
- replaced file.too_large
- replaced file.text
- replaced file.collapsed
2019-02-15 17:56:50 +00:00
Oswaldo Ferreira 8303eb8a9e Adjusts duplicated line when commenting on unfolded diff lines 2019-01-08 12:45:19 -02:00
Francisco Javier López 5a3e6fdff9
Fixing image lfs bug and also displaying text lfs
This commit, introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23812,
fixes a problem creating a displaying image diff notes when the image
is stored in LFS. The main problem was that `Gitlab::Diff::File` was
returning an invalid valid in `text?` for this kind of files.

It also fixes a rendering problem with other LFS files, like text
ones. They LFS pointer shouldn't be shown when LFS is enabled
for the project, but they were.
2018-12-27 16:51:07 +01:00
Oswaldo Ferreira 7cf4947792 Cache diff highlight in discussions
This commit handles note diffs caching, which considerably improves
the performance on merge requests with lots of comments.
Important to note that the caching approach taken here is different
from `Gitlab::Diff::HighlightCache`. We do not reset the whole cache
when a new push is sent or anything else. That's because discussions
diffs are persisted and do not change.
2018-12-21 16:59:21 -02:00
Nick Thomas 8d2e1b724b Merge branch '54786-mr-empty-file-display' into 'master'
Display empty files properly on MR diffs

Closes #54786

See merge request gitlab-org/gitlab-ce!23671
2018-12-15 12:21:54 +00:00
Oswaldo Ferreira ed3034bbb7 Allow suggesting single line changes in diffs 2018-12-13 19:17:19 +00:00
Sean Nichols 05dcb2dd76 Display empty files properly on MR diffs 2018-12-11 23:49:04 -05:00
Oswaldo Ferreira 89a676019c Avoid 500's when serializing legacy diff notes 2018-12-04 13:13:22 -02:00
Douwe Maan 4b7e9eaacd
Treat Repository instances with the same disk path as the same hash key 2018-11-26 11:15:18 +01:00
Douwe Maan 56834e6bb2 Merge branch 'osw-comment-on-any-line-on-diffs-w-feature-flag' into 'master'
Comment on any expanded diff line on MRs (with feature-flag)

Closes #13950

See merge request gitlab-org/gitlab-ce!22914
2018-11-12 15:36:48 +00:00
Oswaldo Ferreira f9b4130bb7 Comment on any expanded diff line on MRs 2018-11-09 16:56:48 -02:00
Oswaldo Ferreira 198402b38b Revert "Merge branch 'osw-comment-on-any-line-on-diffs' into 'master'"
This reverts commit a82a595728, reversing
changes made to e7df959b8f.
2018-11-07 19:57:26 -02:00
Douwe Maan a82a595728 Merge branch 'osw-comment-on-any-line-on-diffs' into 'master'
Comment on any expanded diff line on MRs

See merge request gitlab-org/gitlab-ce!22398
2018-11-07 11:56:46 +00:00
gfyoung 7e6f6e1603 Enable even more frozen string in lib/gitlab
Enables frozens string for the following:

* lib/gitlab/conflict/**/*.rb
* lib/gitlab/cross_project_access/**/*.rb
* lib/gitlab/cycle_analytics/**/*.rb
* lib/gitlab/data_builder/**/*.rb
* lib/gitlab/database/**/*.rb
* lib/gitlab/dependency_linker/**/*.rb
* lib/gitlab/diff/**/*.rb
* lib/gitlab/downtime_check/**/*.rb
* lib/gitlab/email/**/*.rb
* lib/gitlab/etag_caching/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-06 22:47:32 -08:00
Oswaldo Ferreira 1bc0e9e3c5 Apply additional guard-clauses for unfold_required? 2018-11-06 17:59:09 -02:00
Oswaldo Ferreira ec66ef1b74 Comment on any expanded diff line on MRs 2018-11-06 17:39:31 -02:00
Sean McGivern c0d30fad97 Merge branch 'sh-optimize-reload-diffs-service' into 'master'
Significantly cut memory and SQL queries when reloading diffs

See merge request gitlab-org/gitlab-ce!22725
2018-11-02 10:09:50 +00:00
Stan Hu de1db4972c Avoidp loading merge request diff files when not needed 2018-11-01 07:50:39 -07:00
Achilleas Pipinellis 7f47e13218 Merge branch 'gt-update-typos-in-comments-and-specs' into 'master'
Fix typos in comments and specs

See merge request gitlab-org/gitlab-ce!22683
2018-11-01 10:34:23 +00:00
George Tsiolis 733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
Mark Chao 39ae9a59a5 Make Highlight accept language param
This replaces the repository param.
This allows more flexiblity as sometimes we have highlight content
not related to repository. Sometimes we know ahead of time the language
of the content. Lastly language determination seems better fit as a
logic in the Blob class.
`repository` param is only used to determine the language, which seems
to be the responsiblity of Blob.
2018-10-30 15:44:55 +08:00
Phil Hughes 14ed916cf2 Merge branch '51958-fix-mr-discussion-loading' into 'master'
Fix MR discussion not loaded issue

Closes #51958

See merge request gitlab-org/gitlab-ce!21982
2018-10-04 07:37:24 +00:00
Francisco Javier López c40400ceae [master] Stored XSS in Gitlab Merge Request from imported repository 2018-10-01 16:44:30 +00:00
Mark Chao f09303b00a Fix MR discussion not loaded issue
Display `formatter` as the sole content of `position` object.
This means `diff_file` data is not referenced, which is the
caseu of "IOError: not opened for reading".
2018-10-01 22:37:43 +08:00
Michael Kozono f107bc69e3 Simplify by using Gitlab::SafeRequestStore
These are clear wins.
2018-09-24 12:11:26 -07:00
Oswaldo Ferreira 5dce096cf8 Use standalone diff stats RPC on every comparison view 2018-09-19 12:26:28 +00:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Oswaldo Ferreira cd1d5b2440 Cache diff highlighting upon Merge Request creation (refactors diff caching) 2018-09-07 10:07:18 -03:00
Felipe Artur 5bc54ca425 Use a serializer to render diff lines 2018-08-31 15:32:48 -03:00
Sean McGivern 0d01ac5141 Include rich_text in diff cache keys
Previously, this wasn't needed: text was normally set to the highlighted
contents anyway. Now, it is: we store different things in text and rich_text.

This caused https://gitlab.com/gitlab-com/production/issues/439.
2018-08-28 15:28:47 +01:00
Chantal Rollison 81a403f05f Escaped html characters 2018-08-21 07:37:33 -07:00
Lin Jen-Shin 3bfe306624 Resolve Naming/UncommunicativeMethod 2018-07-09 21:13:08 +08:00
Sean McGivern fe695ebd24 Merge branch 'issue_48474' into 'master'
Fix discussion entity for legacy diff notes

Closes #48474

See merge request gitlab-org/gitlab-ce!20214
2018-07-05 10:18:53 +00:00
Felipe Artur 6d41df5071 Render LegacyDiffNote when diff_file blob is nil 2018-07-04 12:34:41 -03:00
Jan Provaznik dc551581d0 Use serialize_keys as part of highlight diff cache
This assures that old cache is not used if we change format of
cached data.
2018-07-04 11:34:35 +02:00
Jan Provaznik 26a8472d6d Don't add bottom 'match' line for deleted files
If a file is deleted, its new_pos is 0 (less than
total_blob_lines), but there is no reason to add the
bottom 'match' line in this case because there is not
extra content which could be expanded.
2018-06-28 22:53:35 +02:00
Felipe Artur 3e66795ef1 Changes tab VUE refactoring 2018-06-21 12:22:40 +00:00
Oswaldo Ferreira f46739191a Adjust insufficient diff hunks being persisted on NoteDiffFile
This currently causes 500's errors when loading the MR page
(Discussion) in a few scenarios.

We were not considering detailed diff headers such as
"--- a/doc/update/mysql_to_postgresql.md\n+++ b/doc/update/mysql_to_postgresql.md"
to crop the diff. In order to address it, we're now using
Gitlab::Diff::Parser, clean the diffs and builds Gitlab::Diff::Line objects
we can iterate and filter on.
2018-06-05 01:02:30 -03:00
Oswaldo Ferreira bb8f2520b4 Persist truncated note diffs on a new table
We request Gitaly in a N+1 manner to build discussion diffs. Once the diffs are from different revisions, it's hard to make a single request to the service in order to build the whole response.
With this change we solve this problem and simplify a lot fetching this piece of info.
2018-05-24 15:34:43 -03:00
Douwe Maan 202c100d5a Merge branch 'osw-use-cached-highlighted-content-for-discussions' into 'master'
Use persisted diff data instead fetching Git on discussions

Closes #44052

See merge request gitlab-org/gitlab-ce!18657
2018-05-01 15:11:21 +00:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00