MCPcopy Create free account
hub / github.com/KDE/kdevelop / update

Method update

plugins/patchreview/localpatchsource.cpp:42–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void LocalPatchSource::update()
43{
44 if( !m_command.isEmpty() ) {
45 QTemporaryFile temp(QDir::tempPath() + QLatin1String("/patchreview_XXXXXX.diff"));
46 if( temp.open() ) {
47 temp.setAutoRemove( false );
48 QString filename = temp.fileName();
49 qCDebug(PLUGIN_PATCHREVIEW) << "temp file: " << filename;
50 temp.close();
51 KProcess proc;
52 proc.setWorkingDirectory( m_baseDir.toLocalFile() );
53 proc.setOutputChannelMode( KProcess::OnlyStdoutChannel );
54 proc.setStandardOutputFile( filename );
55 ///Try to apply, if it works, the patch is not applied
56 proc << KShell::splitArgs( m_command );
57
58 qCDebug(PLUGIN_PATCHREVIEW) << "calling " << m_command;
59
60 if ( proc.execute() ) {
61 qCWarning(PLUGIN_PATCHREVIEW) << "returned with bad exit code";
62 return;
63 }
64 if ( !m_filename.isEmpty() ) {
65 QFile::remove( m_filename.toLocalFile() );
66 }
67 m_filename = QUrl::fromLocalFile( filename );
68 qCDebug(PLUGIN_PATCHREVIEW) << "success, diff: " << m_filename;
69 }else{
70 qCWarning(PLUGIN_PATCHREVIEW) << "PROBLEM";
71 }
72 }
73 if (m_widget) {
74 m_widget->updatePatchFromEdit();
75 }
76 emit patchChanged();
77}
78
79void LocalPatchSource::createWidget()
80{

Callers 1

forceUpdateMethod · 0.45

Calls 8

toLocalFileMethod · 0.80
updatePatchFromEditMethod · 0.80
isEmptyMethod · 0.45
openMethod · 0.45
fileNameMethod · 0.45
closeMethod · 0.45
setWorkingDirectoryMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected