1 /*
2  * SessionSVN.hpp
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 
16 #ifndef SESSION_SVN_HPP
17 #define SESSION_SVN_HPP
18 
19 #include <shared_core/Error.hpp>
20 #include <shared_core/FilePath.hpp>
21 
22 #include "vcs/SessionVCSCore.hpp"
23 
24 namespace rstudio {
25 namespace session {
26 
27 namespace console_process {
28 
29 class ConsoleProcess;
30 
31 } // namespace console_process
32 
33 namespace modules {
34 
35 namespace svn {
36 
37 extern const char * const kVcsId;
38 
39 class SvnFileDecorationContext : public source_control::FileDecorationContext
40 {
41 public:
42    SvnFileDecorationContext(const core::FilePath& rootDir);
43    virtual ~SvnFileDecorationContext();
44    void decorateFile(const core::FilePath& filePath,
45                      core::json::Object* pFileObject);
46 private:
47    source_control::StatusResult vcsResult_;
48 };
49 
50 // Returns true if Subversion install is detected
51 bool isSvnInstalled();
52 
53 // Returns true if the working directory is in a Subversion tree
54 bool isSvnDirectory(const core::FilePath& workingDir);
55 
56 std::string repositoryRoot(const core::FilePath& workingDir);
57 
58 bool isSvnEnabled();
59 
60 core::FilePath detectedSvnExePath();
61 
62 std::string nonPathSvnBinDir();
63 
64 core::Error checkout(const std::string& url,
65                      const std::string& username,
66                      const std::string dirName,
67                      const core::FilePath& parentPath,
68                      boost::shared_ptr<console_process::ConsoleProcess>* ppCP);
69 
70 core::Error initialize();
71 
72 // Initialize SVN with the given working directory
73 core::Error initializeSvn(const core::FilePath& workingDir);
74 
75 } // namespace svn
76 } // namespace modules
77 } // namespace session
78 } // namespace rstudio
79 
80 #endif
81