OSDN Git Service

b9da969fcaaba02a4864ceee250d6de08be53eda
[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_BRANCH=0x20,\r
55                 LOG_INFO_ONLY_HASH=0x40,\r
56                 LOG_INFO_DETECT_RENAME=0x80,\r
57                 LOG_INFO_DETECT_COPYRENAME=0x100\r
58         }LOG_INFO_MASK;\r
59 \r
60         int GetRemoteList(STRING_VECTOR &list);\r
61         int GetBranchList(STRING_VECTOR &list, int *Current,BRANCH_TYPE type=BRANCH_LOCAL);\r
62         int GetTagList(STRING_VECTOR &list);\r
63         int GetMapHashToFriendName(MAP_HASH_NAME &map);\r
64         \r
65         //hash is empty means all. -1 means all\r
66         int GetLog(CString& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME);\r
67 \r
68         git_revnum_t GetHash(CString &friendname);\r
69 \r
70         int BuildOutputFormat(CString &format,bool IsFull=TRUE);\r
71         //int GetShortLog(CString &log,CTGitPath * path=NULL, int count =-1);\r
72         static void StringAppend(CString *str,char *p);\r
73 \r
74         BOOL IsInitRepos();\r
75         \r
76 };\r
77 extern void GetTempPath(CString &path);\r
78 extern CString GetTempFile();\r
79 \r
80 \r
81 extern CGit g_Git;