本文整理汇总了C++中SVN::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ SVN::Add方法的具体用法?C++ SVN::Add怎么用?C++ SVN::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVN
的用法示例。
在下文中一共展示了SVN::Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOK
void CCreatePatch::OnOK()
{
if (m_bThreadRunning)
return;
int nListItems = m_PatchList.GetItemCount();
m_filesToRevert.Clear();
for (int j=0; j<nListItems; j++)
{
const CSVNStatusListCtrl::FileEntry * entry = m_PatchList.GetConstListEntry(j);
if (entry->IsChecked())
{
// Unversioned files are not included in the resulting patch file!
// We add those files to a list which will be used to add those files
// before creating the patch.
if ((entry->status == svn_wc_status_none)||(entry->status == svn_wc_status_unversioned))
{
m_filesToRevert.AddPath(entry->GetPath());
}
}
}
if (m_filesToRevert.GetCount())
{
// add all unversioned files to version control
// so they're included in the resulting patch
// NOTE: these files must be reverted after the patch
// has been created! Since this dialog doesn't create the patch
// itself, the calling function is responsible to revert these files!
SVN svn;
svn.Add(m_filesToRevert, NULL, svn_depth_empty, false, false, false, true);
}
//save only the files the user has selected into the path list
m_PatchList.WriteCheckedNamesToPathList(m_pathList);
CResizableStandAloneDialog::OnOK();
}
示例2: Execute
bool PasteMoveCommand::Execute()
{
CString sDroppath = parser.GetVal(L"droptarget");
CTSVNPath dropPath(sDroppath);
ProjectProperties props;
props.ReadProps(dropPath);
if (dropPath.IsAdminDir())
return FALSE;
SVN svn;
SVNStatus status;
unsigned long count = 0;
pathList.RemoveAdminPaths();
CString sNewName;
CProgressDlg progress;
progress.SetTitle(IDS_PROC_MOVING);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(GetExplorerHWND()));
for(int nPath = 0; nPath < pathList.GetCount(); nPath++)
{
CTSVNPath destPath;
if (sNewName.IsEmpty())
destPath = CTSVNPath(sDroppath+L"\\"+pathList[nPath].GetFileOrDirectoryName());
else
destPath = CTSVNPath(sDroppath+L"\\"+sNewName);
if (destPath.Exists())
{
CString name = pathList[nPath].GetFileOrDirectoryName();
if (!sNewName.IsEmpty())
name = sNewName;
progress.Stop();
CRenameDlg dlg;
dlg.SetFileSystemAutoComplete();
dlg.m_name = name;
dlg.SetInputValidator(this);
m_renPath = pathList[nPath];
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMEMOVE, (LPCTSTR)name);
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
destPath.SetFromWin(sDroppath+L"\\"+dlg.m_name);
}
svn_wc_status_kind s = status.GetAllStatus(pathList[nPath]);
if ((s == svn_wc_status_none)||(s == svn_wc_status_unversioned)||(s == svn_wc_status_ignored))
{
// source file is unversioned: move the file to the target, then add it
MoveFile(pathList[nPath].GetWinPath(), destPath.GetWinPath());
if (!svn.Add(CTSVNPathList(destPath), &props, svn_depth_infinity, true, true, false, true))
{
svn.ShowErrorDialog(GetExplorerHWND());
return FALSE; //get out of here
}
CShellUpdater::Instance().AddPathForUpdate(destPath);
}
else
{
if (!svn.Move(CTSVNPathList(pathList[nPath]), destPath))
{
svn.ShowErrorDialog(GetExplorerHWND());
return FALSE; //get out of here
}
else
CShellUpdater::Instance().AddPathForUpdate(destPath);
}
count++;
if (progress.IsValid())
{
progress.FormatPathLine(1, IDS_PROC_MOVINGPROG, pathList[nPath].GetWinPath());
progress.FormatPathLine(2, IDS_PROC_CPYMVPROG2, destPath.GetWinPath());
progress.SetProgress(count, pathList.GetCount());
}
if ((progress.IsValid())&&(progress.HasUserCancelled()))
{
TaskDialog(GetExplorerHWND(), AfxGetResourceHandle(), MAKEINTRESOURCE(IDS_APPNAME), MAKEINTRESOURCE(IDS_SVN_USERCANCELLED), NULL, TDCBF_OK_BUTTON, TD_INFORMATION_ICON, NULL);
return FALSE;
}
}
return true;
}
示例3: Execute
bool DropCopyCommand::Execute()
{
CString sDroppath = parser.GetVal(L"droptarget");
if (CTSVNPath(sDroppath).IsAdminDir())
return FALSE;
SVN svn;
unsigned long count = 0;
CString sNewName;
pathList.RemoveAdminPaths();
if ((parser.HasKey(L"rename"))&&(pathList.GetCount()==1))
{
// ask for a new name of the source item
CRenameDlg renDlg;
renDlg.SetInputValidator(this);
renDlg.SetFileSystemAutoComplete();
renDlg.m_windowtitle.LoadString(IDS_PROC_COPYRENAME);
renDlg.m_name = pathList[0].GetFileOrDirectoryName();
if (renDlg.DoModal() != IDOK)
{
return FALSE;
}
sNewName = renDlg.m_name;
}
CProgressDlg progress;
progress.SetTitle(IDS_PROC_COPYING);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(GetExplorerHWND()));
UINT msgRet = IDNO;
INT_PTR msgRetNonversioned = 0;
for (int nPath = 0; nPath < pathList.GetCount(); nPath++)
{
const CTSVNPath& sourcePath = pathList[nPath];
CTSVNPath fullDropPath(sDroppath);
if (sNewName.IsEmpty())
fullDropPath.AppendPathString(sourcePath.GetFileOrDirectoryName());
else
fullDropPath.AppendPathString(sNewName);
// Check for a drop-on-to-ourselves
if (sourcePath.IsEquivalentTo(fullDropPath))
{
// Offer a rename
progress.Stop();
CRenameDlg dlg;
dlg.SetFileSystemAutoComplete();
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMECOPY, (LPCTSTR)sourcePath.GetUIFileOrDirectoryName());
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
// rebuild the progress dialog
progress.EnsureValid();
progress.SetTitle(IDS_PROC_COPYING);
progress.SetTime(true);
progress.SetProgress(count, pathList.GetCount());
progress.ShowModeless(CWnd::FromHandle(GetExplorerHWND()));
// Rebuild the destination path, with the new name
fullDropPath.SetFromUnknown(sDroppath);
fullDropPath.AppendPathString(dlg.m_name);
}
if (!svn.Copy(CTSVNPathList(sourcePath), fullDropPath, SVNRev::REV_WC, SVNRev()))
{
if ((svn.GetSVNError() && svn.GetSVNError()->apr_err == SVN_ERR_ENTRY_EXISTS) && (fullDropPath.Exists()))
{
if ((msgRet != IDYESTOALL) && (msgRet != IDNOTOALL))
{
// target file already exists. Ask user if he wants to replace the file
CString sReplace;
sReplace.Format(IDS_PROC_REPLACEEXISTING, fullDropPath.GetWinPath());
CTaskDialog taskdlg(sReplace,
CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK2)),
L"TortoiseSVN",
0,
TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT);
taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK3)));
taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK4)));
taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON);
taskdlg.SetVerificationCheckboxText(CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK5)));
taskdlg.SetVerificationCheckbox(false);
taskdlg.SetDefaultCommandControl(2);
taskdlg.SetMainIcon(TD_WARNING_ICON);
INT_PTR ret = taskdlg.DoModal(GetExplorerHWND());
if (ret == 1) // replace
msgRet = taskdlg.GetVerificationCheckboxState() ? IDYES : IDYESTOALL;
else
msgRet = taskdlg.GetVerificationCheckboxState() ? IDNO : IDNOTOALL;
}
if ((msgRet == IDYES) || (msgRet == IDYESTOALL))
{
if (!svn.Remove(CTSVNPathList(fullDropPath), true, false))
{
fullDropPath.Delete(true);
}
if (!svn.Copy(CTSVNPathList(pathList[nPath]), fullDropPath, SVNRev::REV_WC, SVNRev()))
{
svn.ShowErrorDialog(GetExplorerHWND(), pathList[nPath]);
return FALSE; //get out of here
}
//.........这里部分代码省略.........
示例4: Execute
bool AddCommand::Execute()
{
bool bRet = false;
if (parser.HasKey(_T("noui")))
{
#if 0
SVN svn;
ProjectProperties props;
props.ReadPropsPathList(pathList);
bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
CShellUpdater::Instance().AddPathsForUpdate(pathList);
#endif
}
else
{
#if 0
if (pathList.AreAllPathsFiles())
{
SVN svn;
ProjectProperties props;
props.ReadPropsPathList(pathList);
bRet = !!svn.Add(pathList, &props, svn_depth_empty, FALSE, FALSE, TRUE);
CShellUpdater::Instance().AddPathsForUpdate(pathList);
}
else
{
#endif
CAddDlg dlg;
dlg.m_pathList = pathList;
if (dlg.DoModal() == IDOK)
{
#if 0
CString cmd,out;
int success=0;
for(int i=0;i<dlg.m_pathList.GetCount();i++)
{
cmd.Format(_T("git.exe add -- \"%s\""),dlg.m_pathList[i].GetGitPathString());
if(g_Git.Run(cmd,&out,CP_ACP))
{
CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
}
success++;
}
CString message;
message.Format(_T("%d file added"),success);
CMessageBox::Show(NULL,message,_T("TortoiseGit"),MB_OK);
return TRUE;
#endif
if (dlg.m_pathList.GetCount() == 0)
return FALSE;
CGitProgressDlg progDlg;
theApp.m_pMainWnd = &progDlg;
progDlg.SetCommand(CGitProgressDlg::GitProgress_Add);
if (parser.HasVal(_T("closeonend")))
progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
progDlg.SetPathList(dlg.m_pathList);
//ProjectProperties props;
//props.ReadPropsPathList(dlg.m_pathList);
//progDlg.SetProjectProperties(props);
progDlg.SetItemCount(dlg.m_pathList.GetCount());
progDlg.DoModal();
CShellUpdater::Instance().AddPathsForUpdate(dlg.m_pathList);
bRet = !progDlg.DidErrorsOccur();
}
// }
}
CShellUpdater::Instance().Flush();
return bRet;
}
示例5: Execute
bool PasteCopyCommand::Execute()
{
CString sDroppath = parser.GetVal(_T("droptarget"));
CTSVNPath dropPath(sDroppath);
ProjectProperties props;
props.ReadProps(dropPath);
if (dropPath.IsAdminDir())
return FALSE;
SVN svn;
SVNStatus status;
unsigned long count = 0;
CString sNewName;
pathList.RemoveAdminPaths();
CProgressDlg progress;
progress.SetTitle(IDS_PROC_COPYING);
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
for(int nPath = 0; nPath < pathList.GetCount(); nPath++)
{
const CTSVNPath& sourcePath = pathList[nPath];
CTSVNPath fullDropPath = dropPath;
if (sNewName.IsEmpty())
fullDropPath.AppendPathString(sourcePath.GetFileOrDirectoryName());
else
fullDropPath.AppendPathString(sNewName);
// Check for a drop-on-to-ourselves
if (sourcePath.IsEquivalentTo(fullDropPath))
{
// Offer a rename
progress.Stop();
CRenameDlg dlg;
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMECOPY, (LPCTSTR)sourcePath.GetUIFileOrDirectoryName());
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
// rebuild the progress dialog
progress.EnsureValid();
progress.SetTitle(IDS_PROC_COPYING);
progress.SetAnimation(IDR_MOVEANI);
progress.SetTime(true);
progress.SetProgress(count, pathList.GetCount());
progress.ShowModeless(CWnd::FromHandle(hwndExplorer));
// Rebuild the destination path, with the new name
fullDropPath.SetFromUnknown(sDroppath);
fullDropPath.AppendPathString(dlg.m_name);
}
svn_wc_status_kind s = status.GetAllStatus(sourcePath);
if ((s == svn_wc_status_none)||(s == svn_wc_status_unversioned)||(s == svn_wc_status_ignored))
{
// source file is unversioned: move the file to the target, then add it
CopyFile(sourcePath.GetWinPath(), fullDropPath.GetWinPath(), FALSE);
if (!svn.Add(CTSVNPathList(fullDropPath), &props, svn_depth_infinity, true, false, true))
{
TRACE(_T("%s\n"), (LPCTSTR)svn.GetLastErrorMessage());
CMessageBox::Show(hwndExplorer, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
return FALSE; //get out of here
}
else
CShellUpdater::Instance().AddPathForUpdate(fullDropPath);
}
else
{
if (!svn.Copy(CTSVNPathList(sourcePath), fullDropPath, SVNRev::REV_WC, SVNRev()))
{
TRACE(_T("%s\n"), (LPCTSTR)svn.GetLastErrorMessage());
CMessageBox::Show(hwndExplorer, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
return FALSE; //get out of here
}
else
CShellUpdater::Instance().AddPathForUpdate(fullDropPath);
}
count++;
if (progress.IsValid())
{
progress.FormatPathLine(1, IDS_PROC_COPYINGPROG, sourcePath.GetWinPath());
progress.FormatPathLine(2, IDS_PROC_CPYMVPROG2, fullDropPath.GetWinPath());
progress.SetProgress(count, pathList.GetCount());
}
if ((progress.IsValid())&&(progress.HasUserCancelled()))
{
CMessageBox::Show(hwndExplorer, IDS_SVN_USERCANCELLED, IDS_APPNAME, MB_ICONINFORMATION);
return false;
}
}
return true;
}
示例6: Execute
bool DropMoveCommand::Execute()
{
CString droppath = parser.GetVal(L"droptarget");
if (CTSVNPath(droppath).IsAdminDir())
return FALSE;
SVN svn;
unsigned long count = 0;
pathList.RemoveAdminPaths();
CString sNewName;
if ((parser.HasKey(L"rename"))&&(pathList.GetCount()==1))
{
// ask for a new name of the source item
CRenameDlg renDlg;
renDlg.SetFileSystemAutoComplete();
renDlg.SetInputValidator(this);
renDlg.m_windowtitle.LoadString(IDS_PROC_MOVERENAME);
renDlg.m_name = pathList[0].GetFileOrDirectoryName();
if (renDlg.DoModal() != IDOK)
{
return FALSE;
}
sNewName = renDlg.m_name;
}
CProgressDlg progress;
if (progress.IsValid())
{
progress.SetTitle(IDS_PROC_MOVING);
progress.SetTime(true);
progress.ShowModeless(CWnd::FromHandle(GetExplorerHWND()));
}
UINT msgRet = IDNO;
INT_PTR msgRetNonversioned = 0;
for (int nPath = 0; nPath < pathList.GetCount(); nPath++)
{
CTSVNPath destPath;
if (sNewName.IsEmpty())
destPath = CTSVNPath(droppath+L"\\"+pathList[nPath].GetFileOrDirectoryName());
else
destPath = CTSVNPath(droppath+L"\\"+sNewName);
// path the same but case-changed is ok: results in a case-rename
if (!(pathList[nPath].IsEquivalentToWithoutCase(destPath) && !pathList[nPath].IsEquivalentTo(destPath)))
{
if (destPath.Exists())
{
progress.Stop();
CString name = pathList[nPath].GetFileOrDirectoryName();
if (!sNewName.IsEmpty())
name = sNewName;
progress.Stop();
CRenameDlg dlg;
dlg.SetFileSystemAutoComplete();
dlg.SetInputValidator(this);
dlg.m_name = name;
dlg.m_windowtitle.Format(IDS_PROC_NEWNAMEMOVE, (LPCTSTR)name);
if (dlg.DoModal() != IDOK)
{
return FALSE;
}
destPath.SetFromWin(droppath+L"\\"+dlg.m_name);
progress.EnsureValid();
progress.SetTitle(IDS_PROC_MOVING);
progress.SetTime(true);
progress.SetProgress(count, pathList.GetCount());
progress.ShowModeless(CWnd::FromHandle(GetExplorerHWND()));
}
}
if (!svn.Move(CTSVNPathList(pathList[nPath]), destPath))
{
if ((svn.GetSVNError() && svn.GetSVNError()->apr_err == SVN_ERR_ENTRY_EXISTS) && (destPath.Exists()))
{
if ((msgRet != IDYESTOALL) && (msgRet != IDNOTOALL))
{
progress.Stop();
// target file already exists. Ask user if he wants to replace the file
CString sReplace;
sReplace.Format(IDS_PROC_REPLACEEXISTING, destPath.GetWinPath());
CTaskDialog taskdlg(sReplace,
CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK2)),
L"TortoiseSVN",
0,
TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT);
taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK3)));
taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK4)));
taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON);
taskdlg.SetVerificationCheckboxText(CString(MAKEINTRESOURCE(IDS_PROC_REPLACEEXISTING_TASK5)));
taskdlg.SetVerificationCheckbox(false);
taskdlg.SetDefaultCommandControl(2);
taskdlg.SetMainIcon(TD_WARNING_ICON);
INT_PTR ret = taskdlg.DoModal(GetExplorerHWND());
if (ret == 1) // replace
msgRet = taskdlg.GetVerificationCheckboxState() ? IDYESTOALL : IDYES;
else
msgRet = taskdlg.GetVerificationCheckboxState() ? IDNOTOALL : IDNO;
progress.EnsureValid();
progress.SetTitle(IDS_PROC_MOVING);
progress.SetTime(true);
progress.SetProgress(count, pathList.GetCount());
//.........这里部分代码省略.........