Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
0670bc0b
Commit
0670bc0b
authored
7 years ago
by
Ximin Luo
Browse files
Options
Downloads
Patches
Plain Diff
presenters/formats: allow non-text formats to output an empty diff
parent
e5dc438f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diffoscope/presenters/formats.py
+9
-11
9 additions, 11 deletions
diffoscope/presenters/formats.py
with
9 additions
and
11 deletions
diffoscope/presenters/formats.py
+
9
−
11
View file @
0670bc0b
...
...
@@ -85,23 +85,21 @@ class PresenterManager(object):
)
def
output
(
self
,
difference
,
parsed_args
,
has_differences
):
# As a special case, write an empty file instead of an empty diff.
if
not
has_differences
:
try
:
target
=
self
.
config
[
'
text
'
][
'
target
'
]
if
target
!=
'
-
'
:
open
(
target
,
'
w
'
).
close
()
except
KeyError
:
pass
return
if
difference
is
None
:
return
for
name
,
data
in
self
.
config
.
items
():
logger
.
debug
(
"
Generating %r output at %r
"
,
name
,
data
[
'
target
'
])
# As a special case for text format, write an empty file instead of
# an empty diff (with headers including the path). This lets people
# test if the file is empty.
if
not
has_differences
and
name
==
'
text
'
:
target
=
data
[
'
target
'
]
if
target
!=
'
-
'
:
open
(
target
,
'
w
'
).
close
()
continue
with
profile
(
'
output
'
,
name
):
data
[
'
klass
'
].
run
(
data
,
difference
,
parsed_args
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment