当前位置: 首页>>代码示例>>C++>>正文


C++ CTGitPath函数代码示例

本文整理汇总了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);
}
开发者ID:KristinaTaylor,项目名称:TortoiseSI,代码行数:33,代码来源:TGitPath.cpp

示例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;
}
开发者ID:mirror,项目名称:TortoiseGit,代码行数:26,代码来源:DirectoryWatcher.cpp

示例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();
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:51,代码来源:TempFile.cpp

示例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());
}
开发者ID:paulogeneses,项目名称:TortoiseGit,代码行数:14,代码来源:RequestPullDlg.cpp

示例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();
		}
	}

}
开发者ID:tribis,项目名称:TortoiseGit,代码行数:26,代码来源:SetHooks.cpp

示例6: CTGitPath

bool CLogFile::Open()
{
	if (m_maxlines == 0)
		return false;
	CTGitPath logfile = CTGitPath(CPathUtils::GetLocalAppDataDirectory() + _T("logfile.txt"));
	return Open(logfile);
}
开发者ID:tribis,项目名称:TortoiseGit,代码行数:7,代码来源:LogFile.cpp

示例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);
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:35,代码来源:Patch.cpp

示例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;
	}
}
开发者ID:Teivaz,项目名称:TortoiseGit,代码行数:31,代码来源:GitAdminDir.cpp

示例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);
}
开发者ID:Teivaz,项目名称:TortoiseGit,代码行数:26,代码来源:SendMail.cpp

示例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;
}
开发者ID:jfjdautzenberg,项目名称:TortoiseGit,代码行数:25,代码来源:SubmoduleUpdateDlg.cpp

示例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();
}
开发者ID:AJH16,项目名称:TortoiseGit,代码行数:31,代码来源:SetHooksAdv.cpp

示例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();
}
开发者ID:545546460,项目名称:TortoiseGit,代码行数:26,代码来源:Hooks.cpp

示例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();
		}
}
开发者ID:konlytest,项目名称:TortoiseGit,代码行数:16,代码来源:RepositoryBrowser.cpp

示例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();
}
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:29,代码来源:Hooks.cpp

示例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);
	}
}
开发者ID:Blonder,项目名称:TortoiseGit,代码行数:60,代码来源:SyncDlg.cpp


注:本文中的CTGitPath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。