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

Method diff

plugins/subversion/svnclient.cpp:69–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69QString SvnClient::diff( const svn::Path& src, const svn::Revision& srcRev,
70 const svn::Path& dst, const svn::Revision& dstRev,
71 const bool recurse, const bool ignoreAncestry,
72 const bool noDiffDeleted, const bool ignoreContentType )
73{
74 svn::Pool pool;
75 // null options
76 apr_array_header_t *options = svn_cstring_split( "", "\t\r\n", false, pool );
77
78 svn_error_t* error;
79
80 const char* outfileName = nullptr;
81 apr_file_t* outfile = nullptr;
82 const char* errfileName = nullptr;
83 apr_file_t* errfile = nullptr;
84
85 QByteArray ba = QString(QStandardPaths::writableLocation(QStandardPaths::TempLocation)+QLatin1String("/kdevelop_svn_diff")).toUtf8();
86
87 error = svn_io_open_unique_file( &outfile, &outfileName, ba.data(), ".tmp", false, pool );
88
89 if( error != nullptr )
90 {
91 ::cleanup( outfile, outfileName, errfile, errfileName, pool );
92 throw svn::ClientException( error );
93 }
94
95 error = svn_io_open_unique_file( &errfile, &errfileName, ba.data(), ".tmp", false, pool );
96
97 if( error != nullptr )
98 {
99 ::cleanup( outfile, outfileName, errfile, errfileName, pool );
100 throw svn::ClientException( error );
101 }
102
103 error = svn_client_diff3( options,
104 src.c_str(), srcRev.revision(),
105 dst.c_str(), dstRev.revision(),
106 recurse, ignoreAncestry, noDiffDeleted,
107 ignoreContentType, "UTF-8",
108 outfile, errfile, m_ctxt->ctx(), pool );
109 if ( error )
110 {
111 ::cleanup( outfile, outfileName, errfile, errfileName, pool );
112 throw svn::ClientException(error);
113 }
114
115 // then we reopen outfile for reading
116 apr_status_t aprstatus = apr_file_close (outfile);
117 if (aprstatus)
118 {
119 ::cleanup (outfile, outfileName, errfile, errfileName, pool);
120 ::fail (pool, aprstatus, "failed to close '%s'", outfileName);
121 }
122
123 aprstatus = apr_file_open (&outfile, outfileName, APR_READ, APR_OS_DEFAULT, pool);
124 if (aprstatus)
125 {
126 ::cleanup (outfile, outfileName, errfile, errfileName, pool);

Callers 1

runMethod · 0.45

Calls 8

ClientExceptionClass · 0.85
ctxMethod · 0.80
cleanupFunction · 0.70
failFunction · 0.70
QStringClass · 0.50
dataMethod · 0.45
c_strMethod · 0.45
revisionMethod · 0.45

Tested by

no test coverage detected