本文整理汇总了C++中CTGitPath函数的典型用法代码示例。如果您正苦于以下问题:C++ CTGitPath函数的具体用法?C++ CTGitPath怎么用?C++ CTGitPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CTGitPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CTGitPath
CTGitPath CTGitPathList::GetCommonRoot() const
{
if (IsEmpty())
return CTGitPath();
if (GetCount() == 1)
return m_paths[0];
// first entry is common root for itself
// (add trailing '\\' to detect partial matches of the last path element)
CString root = m_paths[0].GetWinPathString() + _T('\\');
int rootLength = root.GetLength();
// determine common path string prefix
for (PathVector::const_iterator it = m_paths.begin() + 1; it != m_paths.end(); ++it)
{
CString path = it->GetWinPathString() + _T('\\');
int newLength = CStringUtils::GetMatchingLength(root, path);
if (newLength != rootLength)
{
root.Delete(newLength, rootLength);
rootLength = newLength;
}
}
// remove the last (partial) path element
if (rootLength > 0)
root.Delete(root.ReverseFind(_T('\\')), rootLength);
// done
return CTGitPath(root);
}
示例2: lock
CTGitPath CDirectoryWatcher::CloseInfoMap(HANDLE hDir)
{
AutoLocker lock(m_critSec);
TInfoMap::const_iterator d = watchInfoMap.find(hDir);
if (d != watchInfoMap.end())
{
CTGitPath root = CTGitPath(CTGitPath(d->second->m_DirPath).GetRootPathString());
RemovePathAndChildren(root);
BlockPath(root);
}
CloseWatchHandles();
CTGitPath path;
if (watchInfoMap.empty())
return path;
for (TInfoMap::iterator I = watchInfoMap.begin(); I != watchInfoMap.end(); ++I)
{
CDirectoryWatcher::CDirWatchInfo * info = I->second;
ScheduleForDeletion (info);
}
watchInfoMap.clear();
return path;
}
示例3: ConstructTempPath
CTGitPath CTempFiles::CreateTempPath (bool bRemoveAtEnd, const CTGitPath& path, bool directory)
{
bool succeeded = false;
for (int retryCount = 0; retryCount < MAX_RETRIES; ++retryCount)
{
CTGitPath tempfile = ConstructTempPath (path);
// now create the temp file / directory, so that subsequent calls to GetTempFile() return
// different filenames.
// Handle races, i.e. name collisions.
if (directory)
{
DeleteFile(tempfile.GetWinPath());
if (CreateDirectory(tempfile.GetWinPath(), nullptr) == FALSE)
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
return CTGitPath();
}
else
succeeded = true;
}
else
{
CAutoFile hFile = CreateFile(tempfile.GetWinPath(), GENERIC_READ, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (!hFile)
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
return CTGitPath();
}
else
{
succeeded = true;
}
}
// done?
if (succeeded)
{
if (bRemoveAtEnd)
m_TempFileList.AddPath(tempfile);
return tempfile;
}
}
// give up
return CTGitPath();
}
示例4: CTGitPath
void CRequestPullDlg::OnBnClickedButtonLocalBranch()
{
// use the git log to allow selection of a version
CLogDlg dlg;
CString revision;
m_cStartRevision.GetWindowText(revision);
dlg.SetParams(CTGitPath(), CTGitPath(), revision, revision, 0);
// tell the dialog to use mode for selecting revisions
dlg.SetSelect(true);
// only one revision must be selected however
dlg.SingleSelection(true);
if ( dlg.DoModal() == IDOK )
m_cStartRevision.SetWindowText(dlg.GetSelectedHash().at(0).ToString());
}
示例5: CTGitPath
void CSetHooks::OnBnClickedEditbutton()
{
if (m_cHookList.GetSelectedCount() > 1)
return;
POSITION pos = m_cHookList.GetFirstSelectedItemPosition();
if (pos)
{
CSetHooksAdv dlg;
int index = m_cHookList.GetNextSelectedItem(pos);
dlg.key.htype = CHooks::GetHookType((LPCTSTR)m_cHookList.GetItemText(index, 0));
dlg.key.path = CTGitPath(m_cHookList.GetItemText(index, 1));
dlg.cmd.commandline = m_cHookList.GetItemText(index, 2);
dlg.cmd.bWait = (m_cHookList.GetItemText(index, 3).Compare(_T("true"))==0);
dlg.cmd.bShow = (m_cHookList.GetItemText(index, 4).Compare(_T("show"))==0);
hookkey key = dlg.key;
if (dlg.DoModal() == IDOK)
{
CHooks::Instance().Remove(key);
CHooks::Instance().Add(dlg.key.htype, dlg.key.path, dlg.cmd.commandline, dlg.cmd.bWait, dlg.cmd.bShow);
RebuildHookList();
SetModified();
}
}
}
示例6: CTGitPath
bool CLogFile::Open()
{
if (m_maxlines == 0)
return false;
CTGitPath logfile = CTGitPath(CPathUtils::GetLocalAppDataDirectory() + _T("logfile.txt"));
return Open(logfile);
}
示例7: ASSERT
int CSendMailPatch::SendAsCombinedMail(CTGitPathList &list, CGitProgressList * instance)
{
ASSERT(instance);
CStringArray attachments;
CString body;
for (int i = 0; i < list.GetCount(); ++i)
{
CPatch patch;
if (patch.Parse((CString &)list[i].GetWinPathString()))
{
instance->ReportError(_T("Could not open/parse ") + list[i].GetWinPathString());
return -2;
}
if (m_bAttachment)
{
attachments.Add(list[i].GetWinPathString());
body += patch.m_Subject;
body += _T("\r\n");
}
else
{
try
{
g_Git.StringAppend(&body, (BYTE*)patch.m_Body.GetBuffer(), CP_UTF8, patch.m_Body.GetLength());
}
catch (CMemoryException *)
{
instance->ReportError(_T("Out of memory. Could not parse ") + list[i].GetWinPathString());
return -2;
}
}
}
return SendMail(CTGitPath(), instance, m_sSenderName, m_sSenderMail, m_sTo, m_sCC, m_sSubject, body, attachments);
}
示例8: _T
/**
* Returns the .git-path (if .git is a file, read the repository path and return it)
* adminDir always ends with "\"
*/
bool GitAdminDir::GetAdminDirPath(const CString &projectTopDir, CString& adminDir)
{
if (IsBareRepo(projectTopDir))
{
adminDir = projectTopDir;
adminDir.TrimRight('\\');
adminDir.Append(_T("\\"));
return true;
}
CString sDotGitPath = projectTopDir + _T("\\") + GetAdminDirName();
if (CTGitPath(sDotGitPath).IsDirectory())
{
sDotGitPath.TrimRight('\\');
sDotGitPath.Append(_T("\\"));
adminDir = sDotGitPath;
return true;
}
else
{
CString result = ReadGitLink(projectTopDir, sDotGitPath);
if (result.IsEmpty())
return false;
adminDir = result + _T("\\");
return true;
}
}
示例9: ASSERT
int CSendMailCombineable::SendAsCombinedMail(const CTGitPathList &list, CGitProgressList* instance)
{
ASSERT(instance);
CStringArray attachments;
CString body;
for (int i = 0; i < list.GetCount(); ++i)
{
if (m_bAttachment)
{
attachments.Add(list[i].GetWinPathString());
}
else
{
CString filename(list[i].GetWinPathString());
body += filename + _T(":\n");
if (GetFileContents(filename, body))
{
instance->ReportError(_T("Could not open ") + filename);
return -2;
}
body += _T("\n");
}
}
return SendMail(CTGitPath(), instance, m_sSenderName, m_sSenderMail, m_sTo, m_sCC, m_sSubject, body, attachments);
}
示例10: GetWindowText
BOOL CSubmoduleUpdateDlg::OnInitDialog()
{
CStandAloneDialog::OnInitDialog();
CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
CString sWindowTitle;
GetWindowText(sWindowTitle);
CString dir = g_Git.m_CurrentDir;
if (m_PathFilterList.size() > 0)
dir += (g_Git.m_CurrentDir.Right(1) == _T('\\') ? _T("") : _T("\\")) + CTGitPath(m_PathFilterList[0]).GetWinPathString();
if (m_PathFilterList.size() > 1)
dir += _T(", ...");
CAppUtils::SetWindowTitle(m_hWnd, dir, sWindowTitle);
AdjustControlSize(IDC_CHECK_SUBMODULE_INIT);
AdjustControlSize(IDC_CHECK_SUBMODULE_RECURSIVE);
AdjustControlSize(IDC_CHECK_SUBMODULE_NOFETCH);
AdjustControlSize(IDC_CHECK_SUBMODULE_MERGE);
AdjustControlSize(IDC_CHECK_SUBMODULE_REBASE);
Refresh();
UpdateData(FALSE);
return TRUE;
}
示例11: UpdateData
void CSetHooksAdv::OnOK()
{
UpdateData();
int cursel = m_cHookTypeCombo.GetCurSel();
key.htype = unknown_hook;
if (cursel != CB_ERR)
{
key.htype = (hooktype)m_cHookTypeCombo.GetItemData(cursel);
key.path = CTGitPath(m_sPath);
cmd.commandline = m_sCommandLine;
cmd.bWait = !!m_bWait;
cmd.bShow = !m_bHide;
}
if (key.htype == unknown_hook)
{
m_tooltips.ShowBalloon(IDC_HOOKTYPECOMBO, IDS_ERR_NOHOOKTYPESPECIFIED, IDS_ERR_ERROR, TTI_ERROR);
return;
}
if (key.path.IsEmpty())
{
ShowEditBalloon(IDC_HOOKPATH, IDS_ERR_NOHOOKPATHSPECIFIED, IDS_ERR_ERROR, TTI_ERROR);
return;
}
if (cmd.commandline.IsEmpty())
{
ShowEditBalloon(IDC_HOOKCOMMANDLINE, IDS_ERR_NOHOOKCOMMANDPECIFIED, IDS_ERR_ERROR, TTI_ERROR);
return;
}
CResizableStandAloneDialog::OnOK();
}
示例12: find
const_hookiterator CHooks::FindItem(hooktype t, const CString& workingTree) const
{
hookkey key;
CTGitPath path = workingTree;
do
{
key.htype = t;
key.path = path;
auto it = find(key);
if (it != end())
{
return it;
}
path = path.GetContainingDirectory();
} while(!path.IsEmpty());
// look for a script with a path as '*'
key.htype = t;
key.path = CTGitPath(_T("*"));
auto it = find(key);
if (it != end())
{
return it;
}
return end();
}
示例13: CTGitPath
void CRepositoryBrowser::OnBnClickedButtonRevision()
{
// use the git log to allow selection of a version
CLogDlg dlg;
dlg.SetParams(CTGitPath(), CTGitPath(), m_sRevision, m_sRevision, 0);
// tell the dialog to use mode for selecting revisions
dlg.SetSelect(true);
// only one revision must be selected however
dlg.SingleSelection(true);
if (dlg.DoModal() == IDOK)
{
// get selected hash if any
m_sRevision = dlg.GetSelectedHash();
Refresh();
}
}
示例14: find
hookiterator CHooks::FindItem(hooktype t, const CTGitPathList& pathList)
{
hookkey key;
for (int i=0; i<pathList.GetCount(); ++i)
{
CTGitPath path = pathList[i];
do
{
key.htype = t;
key.path = path;
hookiterator it = find(key);
if (it != end())
{
return it;
}
path = path.GetContainingDirectory();
} while(!path.IsEmpty());
}
// look for a script with a path as '*'
key.htype = t;
key.path = CTGitPath(_T("*"));
hookiterator it = find(key);
if (it != end())
{
return it;
}
return end();
}
示例15: FillNewRefMap
void CSyncDlg::RunPostAction()
{
if (m_bWantToExit)
return;
FillNewRefMap();
if (this->m_CurrentCmd == GIT_COMMAND_PUSH)
{
if (!m_GitCmdStatus)
{
CTGitPathList list;
list.AddPath(CTGitPath(g_Git.m_CurrentDir));
DWORD exitcode;
CString error;
if (CHooks::Instance().PostPush(list,exitcode, error))
{
if (exitcode)
{
CString temp;
temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
//ReportError(temp);
CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
return;
}
}
}
EnableControlButton(true);
SwitchToInput();
this->FetchOutList(true);
}
else if (this->m_CurrentCmd == GIT_COMMAND_PULL)
{
PullComplete();
}
else if (this->m_CurrentCmd == GIT_COMMAND_FETCH || this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE)
{
FetchComplete();
}
else if (this->m_CurrentCmd == GIT_COMMAND_SUBMODULE)
{
//this->m_ctrlCmdOut.SetSel(-1,-1);
//this->m_ctrlCmdOut.ReplaceSel(_T("Done\r\n"));
//this->m_ctrlCmdOut.SetSel(-1,-1);
EnableControlButton(true);
SwitchToInput();
}
else if (this->m_CurrentCmd == GIT_COMMAND_STASH)
{
StashComplete();
}
else if (this->m_CurrentCmd == GIT_COMMAND_REMOTE)
{
this->FetchOutList(true);
EnableControlButton(true);
SwitchToInput();
ShowTab(IDC_REFLIST);
}
}