Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a3271dd4
Commit
a3271dd4
authored
Nov 02, 2021
by
Eduardo Bonet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding log messages for ipynbdiff
parent
1631b270
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
app/presenters/blob_presenter.rb
app/presenters/blob_presenter.rb
+14
-1
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+15
-5
No files found.
app/presenters/blob_presenter.rb
View file @
a3271dd4
...
...
@@ -121,6 +121,19 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
end
def
transformed_blob_data
@transformed_blob
||=
(
blob
.
path
.
ends_with?
(
'.ipynb'
)
&&
IpynbDiff
.
transform
(
blob
.
data
,
options:
{
include_metadata:
false
,
cell_decorator: :percent
})
)
||
blob
.
data
@transformed_blob
||=
if
blob
.
path
.
ends_with?
(
'.ipynb'
)
begin
new_blob
=
IpynbDiff
.
transform
(
blob
.
data
,
raise_errors:
true
,
options:
{
include_metadata:
false
,
cell_decorator: :percent
})
rescue
IpynbDiff
::
InvalidNotebookError
=>
e
Gitlab
::
ErrorTracking
.
track_and_raise_for_dev_exception
(
e
,
issue_url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/344676'
)
return
blob
.
data
end
return
Gitlab
::
AppLogger
.
info
(
'IPYNBDIFF_BLOB_NIL'
)
&&
blob
.
data
unless
new_blob
Gitlab
::
AppLogger
.
info
(
'IPYNBDIFF_BLOB_GENERATED'
)
&&
new_blob
end
end
end
lib/gitlab/diff/file.rb
View file @
a3271dd4
...
...
@@ -456,11 +456,21 @@ module Gitlab
from
=
old_blob_lazy
&
.
data
to
=
new_blob_lazy
&
.
data
new_diff
=
IpynbDiff
.
diff
(
from
,
to
,
diff_opts:
{
context:
5
,
include_diff_info:
true
},
transform_options:
{
cell_decorator: :percent
}
)
diff
.
diff
=
new_diff
.
scan
(
/.*\n/
)[
2
..-
1
].
join
(
''
)
if
new_diff
begin
new_diff
=
IpynbDiff
.
diff
(
from
,
to
,
diff_opts:
{
context:
5
,
include_diff_info:
true
},
transform_options:
{
cell_decorator: :percent
},
raise_if_invalid_notebook:
true
)
if
new_diff
diff
.
diff
=
new_diff
.
scan
(
/.*\n/
)[
2
..-
1
].
join
(
''
)
Gitlab
::
AppLogger
.
info
(
"IPYNB_DIFF_GENERATED"
)
else
Gitlab
::
AppLogger
.
info
(
"IPYNB_DIFF_NIL"
)
end
rescue
IpynbDiff
::
InvalidNotebookError
=>
e
Gitlab
::
ErrorTracking
.
track_and_raise_for_dev_exception
(
e
,
issue_url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/344676'
)
end
end
def
alternate_viewer_class
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment