OSDN Git Service

96a0186f57cadd4865044c7cd73ece617fee0096
[tortoisegit/TortoiseGitJp.git] / src / Git / Git.h
1 #pragma once\r
2 #include "GitRev.h"\r
3 #include "GitStatus.h"\r
4 #include "GitAdminDir.h"\r
5 enum\r
6 {\r
7         GIT_SUCCESS=0,\r
8         GIT_ERROR_OPEN_PIP,\r
9         GIT_ERROR_CREATE_PROCESS,\r
10         GIT_ERROR_GET_EXIT_CODE\r
11 };\r
12 \r
13 typedef std::vector<CString> STRING_VECTOR;\r
14 typedef std::map<CString, STRING_VECTOR> MAP_HASH_NAME;\r
15 \r
16 \r
17 class CGit\r
18 {\r
19 private:\r
20         GitAdminDir m_GitDir;\r
21 public:\r
22         static BOOL CheckMsysGitDir();\r
23 \r
24 //      static CString m_MsysGitPath;\r
25         CGit(void);\r
26         ~CGit(void);\r
27         int Run(CString cmd, CString* output);\r
28         int RunAsync(CString cmd,PROCESS_INFORMATION *pi, HANDLE* hRead, CString *StdioFile=NULL);\r
29         int RunLogFile(CString cmd, CString &filename);\r
30         CString GetUserName(void);\r
31         CString GetUserEmail(void);\r
32         CString GetCurrentBranch(void);\r
33 \r
34         bool SetCurrentDir(CString path)\r
35         {\r
36                 return m_GitDir.HasAdminDir(path,&m_CurrentDir);\r
37         }\r
38         CString m_CurrentDir;\r
39 \r
40         typedef enum\r
41         {\r
42                 BRANCH_LOCAL=0x1,\r
43                 BRANCH_REMOTE=0x2,\r
44                 BRANCH_ALL=BRANCH_LOCAL|BRANCH_REMOTE,\r
45         }BRANCH_TYPE;\r
46 \r
47         typedef enum\r
48         {\r
49                 LOG_INFO_STAT=0x1,\r
50                 LOG_INFO_FILESTATE=0x2,\r
51                 LOG_INFO_PATCH=0x4,\r
52                 LOG_INFO_FULLHISTORY=0x8,\r
53                 LOG_INFO_BOUNDARY=0x10,\r
54         LOG_INFO_ALL=0x20\r
55         }LOG_INFO_MASK;\r
56 \r
57         int GetRemoteList(STRING_VECTOR &list);\r
58         int GetBranchList(STRING_VECTOR &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);\r
59         int GetTagList(STRING_VECTOR &list);\r
60         int GetMapHashToFriendName(MAP_HASH_NAME &map);\r
61         \r
62         //hash is empty means all. -1 means all\r
63         int GetLog(CString& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY);\r
64 \r
65         git_revnum_t GetHash(CString &friendname);\r
66 \r
67         int BuildOutputFormat(CString &format,bool IsFull=TRUE);\r
68         int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1);\r
69         static void StringAppend(CString *str,char *p);\r
70 \r
71         BOOL IsInitRepos();\r
72         \r
73 };\r
74 extern void GetTempPath(CString &path);\r
75 extern CString GetTempFile();\r
76 \r
77 \r
78 extern CGit g_Git;