| 77 | } |
| 78 | |
| 79 | std::string |
| 80 | Client::diff(const Path & tmpPath, const Path & path, |
| 81 | const Revision & revision1, const Revision & revision2, |
| 82 | const bool recurse, const bool ignoreAncestry, |
| 83 | const bool noDiffDeleted) |
| 84 | { |
| 85 | Pool pool; |
| 86 | svn_error_t * error; |
| 87 | apr_status_t status; |
| 88 | apr_file_t * outfile = nullptr; |
| 89 | const char * outfileName = nullptr; |
| 90 | apr_file_t * errfile = nullptr; |
| 91 | const char * errfileName = nullptr; |
| 92 | apr_array_header_t * options; |
| 93 | svn_stringbuf_t * stringbuf; |
| 94 | |
| 95 | // svn_client_diff needs an options array, even if it is empty |
| 96 | options = apr_array_make(pool, 0, 0); |
| 97 | |
| 98 | // svn_client_diff needs a temporary file to write diff output to |
| 99 | error = svn_io_open_unique_file(&outfile, &outfileName, |
| 100 | tmpPath.c_str(), ".tmp", |
| 101 | false, pool); |
| 102 | |
| 103 | if (error != nullptr) |
| 104 | { |
| 105 | diffCleanup(outfile, outfileName, errfile, errfileName, pool); |
| 106 | throw ClientException(error); |
| 107 | } |
| 108 | |
| 109 | // and another one to write errors to |
| 110 | error = svn_io_open_unique_file(&errfile, &errfileName, |
| 111 | tmpPath.c_str(), ".tmp", |
| 112 | false, pool); |
| 113 | |
| 114 | if (error != nullptr) |
| 115 | { |
| 116 | diffCleanup(outfile, outfileName, errfile, errfileName, pool); |
| 117 | throw ClientException(error); |
| 118 | } |
| 119 | |
| 120 | // run diff |
| 121 | error = svn_client_diff(options, |
| 122 | path.c_str(), revision1.revision(), |
| 123 | path.c_str(), revision2.revision(), |
| 124 | recurse, ignoreAncestry, noDiffDeleted, |
| 125 | outfile, errfile, |
| 126 | *m_context, |
| 127 | pool); |
| 128 | |
| 129 | if (error != nullptr) |
| 130 | { |
| 131 | diffCleanup(outfile, outfileName, errfile, errfileName, pool); |
| 132 | throw ClientException(error); |
| 133 | } |
| 134 | |
| 135 | // then we reopen outfile for reading |
| 136 | status = apr_file_close(outfile); |
nothing calls this directly
no test coverage detected