1 | //----------------------------------------------------------- |
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
3 | // arnault@lal.in2p3.fr |
---|
4 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
5 | //----------------------------------------------------------- |
---|
6 | |
---|
7 | #ifndef __cmt_vcs_h__ |
---|
8 | #define __cmt_vcs_h__ |
---|
9 | |
---|
10 | #include "cmt_system.h" |
---|
11 | #include "cmt_use.h" |
---|
12 | |
---|
13 | class Modules; |
---|
14 | class Vcs |
---|
15 | { |
---|
16 | public: |
---|
17 | |
---|
18 | typedef enum |
---|
19 | { |
---|
20 | Cvs, |
---|
21 | Svn |
---|
22 | } VcsType; |
---|
23 | |
---|
24 | public: |
---|
25 | |
---|
26 | /* static void tags (const CmtSystem::cmt_string_vector& arguments); */ |
---|
27 | /* static void branches (const cmt_string& module); */ |
---|
28 | /* static void subpackages (const cmt_string& module); */ |
---|
29 | /* static void subprojects (const cmt_string& module); */ |
---|
30 | static void checkout (const CmtSystem::cmt_string_vector& arguments); |
---|
31 | |
---|
32 | class Checkout |
---|
33 | { |
---|
34 | public: |
---|
35 | Checkout () |
---|
36 | : m_head (false), m_recursive (false), m_context (false), m_info (false) |
---|
37 | { } |
---|
38 | cmt_string m_version_tag; |
---|
39 | bool m_head; |
---|
40 | cmt_string m_checkout_dir; |
---|
41 | cmt_string m_version_dir; |
---|
42 | cmt_string m_offset; |
---|
43 | CmtSystem::cmt_string_vector m_modules; |
---|
44 | cmt_string m_requirements; |
---|
45 | cmt_string m_command; |
---|
46 | bool m_recursive; |
---|
47 | bool m_context; |
---|
48 | bool m_info; |
---|
49 | void print () |
---|
50 | { |
---|
51 | cerr << "m_version_tag: " << m_version_tag << endl; |
---|
52 | cerr << "m_head: " << m_head << endl; |
---|
53 | cerr << "m_checkout_dir: " << m_checkout_dir << endl; |
---|
54 | cerr << "m_version_dir: " << m_version_dir << endl; |
---|
55 | cerr << "m_offset: " << m_offset << endl; |
---|
56 | for (int arg = 0; arg < m_modules.size (); arg++) |
---|
57 | { |
---|
58 | cerr << "m_modules[" << arg << "]: " << m_modules[arg] << endl; |
---|
59 | } |
---|
60 | cerr << "m_requirements: " << m_requirements << endl; |
---|
61 | cerr << "m_command: " << m_command << endl; |
---|
62 | cerr << "m_recursive: " << m_recursive << endl; |
---|
63 | cerr << "m_context: " << m_context << endl; |
---|
64 | } |
---|
65 | }; |
---|
66 | |
---|
67 | static void checkout_module (const Checkout& checkout, |
---|
68 | bool config, bool with_version_directory, |
---|
69 | cmt_string module, cmt_string version_tag, |
---|
70 | VcsType type); |
---|
71 | static void checkout_from_requirements (const Checkout& checkout, |
---|
72 | bool config, bool with_version_directory, |
---|
73 | const cmt_string& requirements, |
---|
74 | VcsType type); |
---|
75 | static void checkout_context (const Checkout& checkout, Modules modules, |
---|
76 | bool config, bool with_version_directory, |
---|
77 | VcsType type); |
---|
78 | |
---|
79 | private: |
---|
80 | |
---|
81 | static void help (); |
---|
82 | static void add_cmtpath (const cmt_string& dir); |
---|
83 | static bool need_version_directory (); |
---|
84 | static int parse_arguments (const CmtSystem::cmt_string_vector& arguments, |
---|
85 | Checkout& checkout, bool& config); |
---|
86 | static int parse_checkout (Checkout& checkout, Modules& modules); |
---|
87 | // static int parse_checkout (const Checkout& checkout, cmt_string& uses); |
---|
88 | static int resolve_uses (const cmt_string& text, cmt_string& uses); |
---|
89 | static int resolve_uses (const cmt_string& text, Use::UsePtrVector& uses); |
---|
90 | static int resolve_uses (const Checkout& checkout, const cmt_string& uses); |
---|
91 | // static int resolve_uses (const Checkout& checkout, const Modules& modules); |
---|
92 | // static void start_visit (IUseVisitor& visitor); |
---|
93 | }; |
---|
94 | |
---|
95 | class Svn |
---|
96 | { |
---|
97 | public: |
---|
98 | |
---|
99 | static void checkout (Vcs::Checkout checkout, Modules modules, |
---|
100 | bool config, bool with_version_directory); |
---|
101 | }; |
---|
102 | |
---|
103 | class IUseVisitor |
---|
104 | { |
---|
105 | public: |
---|
106 | //virtual void pre (Project* p) = 0; |
---|
107 | virtual void in (Use* use) = 0; |
---|
108 | //virtual void in_again (Project* p) = 0; |
---|
109 | //virtual void post (Project* p) = 0; |
---|
110 | }; |
---|
111 | |
---|
112 | #endif |
---|