1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4 
5 #include "cmConfigure.h" // IWYU pragma: keep
6 
7 #include <string>
8 #include <utility>
9 #include <vector>
10 
11 #include "cmCTestGenericHandler.h"
12 
13 /** \class cmCTestUpdateHandler
14  * \brief A class that handles ctest -S invocations
15  *
16  */
17 class cmCTestUpdateHandler : public cmCTestGenericHandler
18 {
19 public:
20   using Superclass = cmCTestGenericHandler;
21 
22   /*
23    * The main entry point for this class
24    */
25   int ProcessHandler() override;
26 
27   cmCTestUpdateHandler();
28 
29   enum
30   {
31     e_UNKNOWN = 0,
32     e_CVS,
33     e_SVN,
34     e_BZR,
35     e_GIT,
36     e_HG,
37     e_P4,
38     e_LAST
39   };
40 
41   /**
42    * Initialize handler
43    */
44   void Initialize() override;
45 
46 private:
47   // Some structures needed for update
48   struct StringPair : public std::pair<std::string, std::string>
49   {
50   };
51   struct UpdateFiles : public std::vector<StringPair>
52   {
53   };
54 
55   // Determine the type of version control
56   int DetermineType(const char* cmd, const char* type);
57 
58   // The VCS command to update the working tree.
59   std::string UpdateCommand;
60   int UpdateType;
61 
62   int DetectVCS(const std::string& dir);
63   bool SelectVCS();
64 };
65