Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KDevelop
KDevelop
Commits
0d9af123
Commit
0d9af123
authored
Feb 17, 2010
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show empty differences when the user asks for a VCS comparison.
Instead show an ugly message box.
parent
76ab0d66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
vcs/vcsdiff.cpp
vcs/vcsdiff.cpp
+6
-0
vcs/vcsdiff.h
vcs/vcsdiff.h
+3
-0
vcs/vcspluginhelper.cpp
vcs/vcspluginhelper.cpp
+17
-1
No files found.
vcs/vcsdiff.cpp
View file @
0d9af123
...
...
@@ -63,6 +63,12 @@ VcsDiff::VcsDiff( const VcsDiff& rhs )
d
->
baseDiff
=
rhs
.
d
->
baseDiff
;
}
bool
VcsDiff
::
isEmpty
()
const
{
return
d
->
diff
.
isEmpty
()
&&
d
->
leftBinaries
.
isEmpty
()
&&
d
->
rightBinaries
.
isEmpty
()
&&
d
->
leftTexts
.
isEmpty
()
&&
d
->
rightTexts
.
isEmpty
();
}
VcsDiff
::
Type
VcsDiff
::
type
()
const
{
return
d
->
type
;
...
...
vcs/vcsdiff.h
View file @
0d9af123
...
...
@@ -121,6 +121,9 @@ public:
void
setType
(
Type
);
void
setContentType
(
Content
);
VcsDiff
&
operator
=
(
const
VcsDiff
&
rhs
);
/** @returns whether there are not changes on the diff */
bool
isEmpty
()
const
;
private:
class
VcsDiffPrivate
*
const
d
;
};
...
...
vcs/vcspluginhelper.cpp
View file @
0d9af123
...
...
@@ -255,6 +255,15 @@ void VcsPluginHelper::diffToHead()
d
->
plugin
->
core
()
->
runController
()
->
registerJob
(
job
);
}
QStringList
locationListToString
(
const
QList
<
VcsLocation
>&
locations
)
{
QStringList
ret
;
foreach
(
const
VcsLocation
&
loc
,
locations
)
{
ret
.
append
(
loc
.
localUrl
().
prettyUrl
());
}
return
ret
;
}
void
VcsPluginHelper
::
diffJobFinished
(
KJob
*
job
)
{
KDevelop
::
VcsJob
*
vcsjob
=
dynamic_cast
<
KDevelop
::
VcsJob
*>
(
job
);
...
...
@@ -263,7 +272,14 @@ void VcsPluginHelper::diffJobFinished(KJob* job)
if
(
vcsjob
)
{
if
(
vcsjob
->
status
()
==
KDevelop
::
VcsJob
::
JobSucceeded
)
{
KDevelop
::
VcsDiff
d
=
vcsjob
->
fetchResults
().
value
<
KDevelop
::
VcsDiff
>
();
showVcsDiff
(
new
VCSDiffPatchSource
(
d
));
if
(
d
.
isEmpty
())
KMessageBox
::
error
(
ICore
::
self
()
->
uiController
()
->
activeMainWindow
(),
i18n
(
"Cannot show the difference because there were none."
),
i18n
(
"VCS support"
));
else
{
VCSDiffPatchSource
*
patch
=
new
VCSDiffPatchSource
(
d
);
showVcsDiff
(
patch
);
}
}
else
{
KMessageBox
::
error
(
ICore
::
self
()
->
uiController
()
->
activeMainWindow
(),
vcsjob
->
errorString
(),
i18n
(
"Unable to get difference."
));
}
...
...
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