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
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
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
Sean McGivern
bb226a294b
Ensure that we never assume old_blob or new_blob are nil
...
These can be a `BatchLoader` which is proxying a nil, while not being concrete
nils themselves.
2018-03-16 18:19:33 +00:00
Sean McGivern
528b5eeb76
Fix error when viewing diffs without blobs
...
Old merge requests can have diffs without corresponding blobs. (This also may be
possible for commit diffs in corrupt repositories.)
We can't use the `&.` operator on the blobs, because the blob objects are never
nil, but `BatchLoader` instances that delegate to `Blob`. We can't use
`Object#try`, because `Blob` doesn't inherit from `Object`.
`BatchLoader` provides a `__sync` method that returns the delegated object, but
using `itself` also works because it's forwarded, and will work for
non-`BatchLoader` instances too. So the simplest solution is to just use that
with the `&.` operator.
2018-01-04 14:33:12 +00:00
Douwe Maan
771bf9527f
Improve performance of DiffDiscussion#truncated_diff_lines and DiffNote#diff_line by removing expensive diff position calculation and comparison
2017-12-22 18:07:15 +01:00
Zeger-Jan van de Weg
f9565e3039
Batchload blobs for diff generation
...
After installing a new gem, batch-loader, a construct can be used to
queue data to be fetched in bulk. The gem was also introduced in both
gitlab-org/gitlab-ce!14680 and gitlab-org/gitlab-ce!14846 , but those mrs
are not merged yet.
For the generation of diffs, both the old blob and the new blob need to
be loaded. This for every file in the diff, too. Now we collect all
these so we do 1 fetch. Three `.allow_n_plus_1_calls` have been removed,
which I expect to be valid, but this needs to be confirmed by a full CI
run.
Possibly closes:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37445
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37599
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37431
2017-11-21 13:53:26 +01:00
Alejandro Rodríguez
9fdde3693b
Move line code generation into Gitlab::Git
...
Having a distinct class just for that was a bit overkill
2017-10-12 22:13:05 -03:00
Alejandro Rodríguez
faa9bd402d
Create a Gitlab::Git submodule for conlict-related files
...
Rename classes to (hopefully) clearer names while we're doing that.
2017-10-12 22:03:15 -03:00
Alejandro Rodríguez
f72598b659
Move Gitlab::Diff::LineCode to module Gitlab::Git
2017-10-12 21:45:16 -03:00
Felipe Artur
b54203f0ad
Commenting on image diffs
2017-10-07 04:25:17 +00:00
Ahmad Sherif
eb36fa17a6
Migrate Gitlab::Git::Repository#diff to Gitaly
...
Closes gitaly#524
2017-09-21 11:05:06 +02:00
Sean McGivern
e8525e107d
Show un-highlighted diffs when blobs are the same
...
For some old merge requests, we don't have enough information to figure out the
old blob and the new blob for the file. This means that we can't highlight the
diff correctly, but we can still display it without highlighting.
2017-08-24 11:11:18 +01:00
Sean McGivern
b0f09406f5
Always return a simple diff viewer
...
We didn't have a fallback case before, because we believed the conditions were
exhaustive. They weren't, so we can always fallback to not previewing.
2017-08-22 14:04:54 +01:00
Jacob Vosmaer
7b18c42464
Remove unused (?) code
2017-07-31 17:19:25 +02:00
Douwe Maan
7944254563
Implement diff viewers
2017-06-14 10:12:21 -05:00
Douwe Maan
ffbbd4112e
Move diffable? method from Repository to Diff::File
2017-06-08 09:32:57 -05:00
Douwe Maan
7c479d88a9
Pass fallback_diff_refs to Diff::File instead of using view helpers
2017-05-23 15:37:05 -05:00
Douwe Maan
db40c668de
Rename Diff::File {old,new}_ref to {old,new}_sha
2017-05-23 15:37:04 -05:00
Douwe Maan
d9a0188d2f
Add question mark to Gitlab::Diff::File predicate methods
2017-05-23 15:37:04 -05:00
Stan Hu
0f61bb2dc5
Fix Error 500 when creating a merge request that contains an image that was deleted and added
...
Steps to reproduce:
1. Start with a repo with an image
2. Add a commit to delete the image
3. Add another commit to replace the image with another image
In a diff comparison, we really just compare about what the image was before the diff, not
the direct parent of the last commit. This MR fixes that.
Closes #3893 , gitlab-org/gitlab-ee#678
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-14 15:57:01 +01:00
Adam Niedzielski
3fa265d195
Fix expanding a collapsed diff when converting a symlink to a regular file
...
In this case comparing old_path and new_path is not enough because there
are two entires that match.
2016-11-10 18:24:12 +01:00
Adam Niedzielski
317e48193f
Fix the diff in the merge request view when converting a symlink to a regular file.
...
In this specific case using file_path as a cache key is not enough,
because there are two entries with the same path.
Closes #21610 .
2016-10-17 18:09:34 +02:00
Paco Guzman
8f359ea917
Move to Gitlab::Diff::FileCollection
...
Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
2016-08-03 07:00:20 +02:00
Paco Guzman
cd7c2cb6dd
Cache highlighted diff lines for merge requests
...
Introducing the concept of SafeDiffs which relates
diffs with UI highlighting.
2016-08-03 07:00:19 +02:00
Paco Guzman
a404ab380d
Collapsed diffs lines/size don't accumulate to overflow diffs.
2016-07-18 14:43:28 -06:00
Sean McGivern
b6b26692ea
Collapse large diffs by default
...
When rendering a list of diff files, skip those where the diff is over
10 KB and provide an endpoint to render individually instead.
2016-07-08 10:56:55 +01:00
Douwe Maan
ac26b23712
Remove duplication, unused methods, and some other style things
2016-07-06 19:29:41 -04:00
Douwe Maan
9abcc0a98f
Add Gitlab::Git::Position
2016-07-06 18:50:59 -04:00
Douwe Maan
a27462a5c6
Extract parts of LegacyDiffNote into DiffOnNote concern and move part of responsibility to other classes
2016-07-06 18:50:59 -04:00
Douwe Maan
375193455a
Style diff and blob file headers the same way
2016-07-06 18:50:59 -04:00
Douwe Maan
9fc0e11e0d
Add DiffFile#blob and #old_blob
2016-07-06 18:50:58 -04:00
Douwe Maan
a9fa45f09e
Represent DiffRefs as proper class instead of tuple array
2016-07-06 18:50:58 -04:00
Yorick Peterse
3f0d780c19
Show a notice for diffs that are too large
...
This builds on the changes introduced in
https://gitlab.com/gitlab-org/gitlab_git/merge_requests/72 and results
in merge requests with large diffs (e.g. due to them containing minified
CSS) loading much faster.
2016-03-18 12:30:46 +01:00
Jacob Vosmaer
1764e1b7cb
Use Gitlab::Git::DiffCollections
2016-03-03 18:38:44 +01:00
Douwe Maan
577f2fb47a
Save and use actual diff base commit for MR diff highlighting
2016-01-20 18:44:27 +01:00
Douwe Maan
701513dcc7
Move parallel diff logic to separate class
2016-01-20 14:53:20 +01:00
Rubén Dávila
6b9c730e91
More refactoring from last code review. #3945
...
* Use commit objects instead of IDs when generating diffs
* Use proper references when generating MR's source and target
* Update broken specs
2016-01-14 16:47:55 -05:00
Douwe Maan
8dfad143d4
Add inline diff markers in highlighted diffs.
2016-01-14 22:28:07 +01:00
Rubén Dávila
21b602c60a
Change strategy to highlight diffs. #3945
...
Now we apply syntax highlighting to the whole old and new files.
This basically help us to highlight adequately multiline content.
2016-01-07 22:37:01 -05:00
Rubén Dávila
8b079315d9
A bit of refactoring. #3945
2015-12-30 21:23:50 -05:00
Rubén Dávila
bb96d63153
New implementation for highlighting diff files. #3945
...
* It is more performant given now we process all the diff file instead
of processing line by line.
* Multiline comments are highlighted correctly.
2015-12-30 00:52:50 -05:00
Gabriel Mazetto
b5291f9599
Fixed Rubocop offenses
2015-12-15 00:53:52 -02:00
Dmitriy Zaporozhets
0d967bce57
Show additions/deletions stats on merge request diff
...
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-10-01 13:52:08 +02:00
Dmitriy Zaporozhets
53f2130e63
Use new version of gitlab_git with extended rugged usage
2014-09-24 13:26:53 +03:00