void CRepositoryBrowserSelection::Add (const CItem* item)
{
    if (item == NULL)
        return;

    // extract the info from the list item

    SPath path;
    CString absPath = item->absolutepath;

    absPath.Replace (L"\\", L"%5C");
    path.url = CTSVNPath (absPath);

    // we don't fully escape the urls, because the GetSVNApiPath() method
    // of the CTSVNPath already does escaping.
    // We only escape special chars here:
    // the '%' because we know that this char isn't escaped yet, and
    // the '"' char, because we pass these urls to the command line as well
    absPath.Replace (L"%", L"%25");
    absPath.Replace (L"\"", L"%22");
    path.urlEscaped = CTSVNPath (absPath);

    path.isExternal = item->is_external;
    path.isFolder = item->kind == svn_node_dir;
    path.isLocked = !item->locktoken.IsEmpty();

    // store & accumulate in the corresponding repository bucket

    InternalAdd (item->repository, path);
}
Esempio n. 2
0
    void AdminDirTest()
    {
        CTSVNPath testPath;
        testPath.SetFromUnknown(L"c:\\.svndir");
        ATLASSERT(!testPath.IsAdminDir());
        testPath.SetFromUnknown(L"c:\\test.svn");
        ATLASSERT(!testPath.IsAdminDir());
        testPath.SetFromUnknown(L"c:\\.svn");
        ATLASSERT(testPath.IsAdminDir());
        testPath.SetFromUnknown(L"c:\\.svndir\\test");
        ATLASSERT(!testPath.IsAdminDir());
        testPath.SetFromUnknown(L"c:\\.svn\\test");
        ATLASSERT(testPath.IsAdminDir());

        CTSVNPathList pathList;
        pathList.AddPath(CTSVNPath(L"c:\\.svndir"));
        pathList.AddPath(CTSVNPath(L"c:\\.svn"));
        pathList.AddPath(CTSVNPath(L"c:\\.svn\\test"));
        pathList.AddPath(CTSVNPath(L"c:\\test"));
        pathList.RemoveAdminPaths();
        ATLASSERT(pathList.GetCount()==2);
        pathList.Clear();
        pathList.AddPath(CTSVNPath(L"c:\\test"));
        pathList.RemoveAdminPaths();
        ATLASSERT(pathList.GetCount()==1);
    }
Esempio n. 3
0
CTSVNPath CDirectoryWatcher::CloseInfoMap(HANDLE hDir)
{
    AutoLocker lock(m_critSec);
    auto d = watchInfoMap.find(hDir);
    if (d != watchInfoMap.end())
    {
        CTSVNPath root = CTSVNPath(CTSVNPath(d->second->m_DirPath).GetRootPathString());
        RemovePathAndChildren(root);
        BlockPath(root);
    }
    CloseWatchHandles();

    CTSVNPath 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;
}
Esempio n. 4
0
void CRepositoryBrowserSelection::Add (const CTreeItem* item)
{
    if (item == NULL)
        return;

    // extract the info from the list item

    SPath path;
    CString absPath = item->url;
    path.url = CTSVNPath (absPath);

    // we don't fully escape the urls, because the GetSVNApiPath() method
    // of the CTSVNPath already does escaping.
    // We only escape special chars here:
    // the '%' because we know that this char isn't escaped yet, and
    // the '"' char, because we pass these urls to the command line as well
    absPath.Replace (_T("%"), _T("%25"));
    absPath.Replace (_T("\""), _T("%22"));
    path.urlEscaped = CTSVNPath (absPath);

    path.isExternal = item->is_external;
    path.isFolder = true;
    path.isLocked = false;

    // store & accumulate in the corresponding repository bucket

    InternalAdd (item->repository, path);
}
void CEditPropExternalsValue::OnBnClickedShowLog()
{
    UpdateData(TRUE);
    if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
        return;
    CString urlString = m_URLCombo.GetString();
    CTSVNPath logUrl = m_URL;
    if (urlString.GetLength()>1)
    {
        logUrl = CTSVNPath(SVNExternals::GetFullExternalUrl(urlString, m_RepoRoot.GetSVNPathString(), m_URL.GetSVNPathString()));
    }
    else
    {
        logUrl = m_RepoRoot;
        logUrl.AppendPathString(urlString);
    }

    if (!logUrl.IsEmpty())
    {
        delete m_pLogDlg;
        m_pLogDlg = new CLogDlg();
        m_pLogDlg->SetSelect(true);
        m_pLogDlg->m_pNotifyWindow = this;
        m_pLogDlg->m_wParam = 0;
        m_pLogDlg->SetParams(CTSVNPath(logUrl), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, TRUE);
        m_pLogDlg->ContinuousSelection(true);
        m_pLogDlg->Create(IDD_LOGMESSAGE, this);
        m_pLogDlg->ShowWindow(SW_SHOW);
    }
    AfxGetApp()->DoWaitCursor(-1);
}
Esempio n. 6
0
 void AncestorTest()
 {
     CTSVNPath testPath;
     testPath.SetFromWin(L"c:\\windows");
     ATLASSERT(testPath.IsAncestorOf(CTSVNPath(L"c:\\"))==false);
     ATLASSERT(testPath.IsAncestorOf(CTSVNPath(L"c:\\windows")));
     ATLASSERT(testPath.IsAncestorOf(CTSVNPath(L"c:\\windowsdummy"))==false);
     ATLASSERT(testPath.IsAncestorOf(CTSVNPath(L"c:\\windows\\test.txt")));
     ATLASSERT(testPath.IsAncestorOf(CTSVNPath(L"c:\\windows\\system32\\test.txt")));
 }
Esempio n. 7
0
void CSetBugTraqAdv::OnOK()
{
    UpdateData();

    m_provider_clsid = GUID_NULL;

    int index = m_cProviderCombo.GetCurSel();
    if (index != CB_ERR)
    {
        CBugTraqProvider *provider = (CBugTraqProvider *)m_cProviderCombo.GetItemDataPtr(index);
        m_provider_clsid = provider->clsid;
    }

    CComPtr<IBugTraqProvider> pProvider;
    HRESULT hr = pProvider.CoCreateInstance(m_provider_clsid);

    if (FAILED(hr))
    {
        m_tooltips.ShowBalloon(IDC_BUGTRAQPROVIDERCOMBO, IDS_ERR_MISSING_PROVIDER, IDS_ERR_ERROR, TTI_ERROR);
        return;
    }

    VARIANT_BOOL valid;
    ATL::CComBSTR parameters;
    parameters.Attach(m_sParameters.AllocSysString());
    hr = pProvider->ValidateParameters(GetSafeHwnd(), parameters, &valid);
    if (FAILED(hr))
    {
        ShowEditBalloon(IDC_BUGTRAQPARAMETERS, IDS_ERR_PROVIDER_VALIDATE_FAILED, IDS_ERR_ERROR, TTI_ERROR);
        return;
    }

    if (valid == VARIANT_FALSE)
        return; // It's assumed that the provider will have done this.

    if (m_pAssociations)
    {
        CBugTraqAssociation bugtraq_association;
        if (m_pAssociations->FindProvider(CTSVNPathList(CTSVNPath(m_sPath)), &bugtraq_association))
        {
            if (bugtraq_association.GetPath().IsEquivalentToWithoutCase(CTSVNPath(m_sPath)))
            {
                ShowEditBalloon(IDC_BUGTRAQPATH, IDS_ERR_PROVIDER_PATH_ALREADY_CONFIGURED, IDS_ERR_ERROR, TTI_ERROR);
                return;
            }
        }
    }

    CResizableStandAloneDialog::OnOK();
}
void CEditPropExternalsValue::OnOK()
{
    UpdateData();
    m_sWCPath.Trim(L"\"'");
    if (!CTSVNPath(m_sWCPath).IsValidOnWindows())
    {
        ShowEditBalloon(IDC_CHECKOUTDIRECTORY, IDS_ERR_NOVALIDPATH, IDS_ERR_ERROR, TTI_ERROR);
        return;
    }

    if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
    {
        m_pLogDlg->SendMessage(WM_CLOSE);
        return;
    }

    if (GetCheckedRadioButton(IDC_REVISION_HEAD, IDC_REVISION_N) == IDC_REVISION_HEAD)
    {
        m_External.revision.kind = svn_opt_revision_head;
        m_sPegRev.Empty();
    }
    else
    {
        SVNRev rev = m_sRevision;
        if (!rev.IsValid())
        {
            ShowEditBalloon(IDC_REVISION_N, IDS_ERR_INVALIDREV, IDS_ERR_ERROR, TTI_ERROR);
            return;
        }
        m_External.revision = *rev;
    }
    m_URLCombo.SaveHistory();
    m_URL = CTSVNPath(m_URLCombo.GetString());
    m_External.url = CUnicodeUtils::GetUnicode(CPathUtils::PathEscape(CUnicodeUtils::GetUTF8(m_URL.GetSVNPathString())));
    if (m_URL.GetSVNPathString().GetLength() && (m_URL.GetSVNPathString()[0] == '^'))
    {
        // the ^ char must not be escaped
        m_External.url = CUnicodeUtils::GetUnicode(CPathUtils::PathEscape(CUnicodeUtils::GetUTF8(m_URL.GetSVNPathString().Mid(1))));
        m_External.url = '^' + m_External.url;
    }

    if (m_sPegRev.IsEmpty())
        m_External.pegrevision = *SVNRev(L"HEAD");
    else
        m_External.pegrevision = *SVNRev(m_sPegRev);
    m_External.targetDir = m_sWCPath;

    CResizableStandAloneDialog::OnOK();
}
Esempio n. 9
0
void CSetHooksAdv::OnOK()
{
#if 0
	UpdateData();
	int cursel = m_cHookTypeCombo.GetCurSel();
	key.htype = unknown_hook;
	if (cursel != CB_ERR)
	{
		key.htype = (hooktype)m_cHookTypeCombo.GetItemData(cursel);
		key.path = CTSVNPath(m_sPath);
		cmd.commandline = m_sCommandLine;
		cmd.bWait = !!m_bWait;
		cmd.bShow = !m_bHide;
	}
	if (key.htype == unknown_hook)
	{
		ShowBalloon(IDC_HOOKTYPECOMBO, IDS_ERR_NOHOOKTYPESPECIFIED);
		return;
	}
	if (key.path.IsEmpty())
	{
		ShowBalloon(IDC_HOOKPATH, IDS_ERR_NOHOOKPATHSPECIFIED);
		return;
	}
	if (cmd.commandline.IsEmpty())
	{
		ShowBalloon(IDC_HOOKCOMMANDLINE, IDS_ERR_NOHOOKCOMMANDPECIFIED);
		return;
	}
#endif
	CResizableStandAloneDialog::OnOK();
}
Esempio n. 10
0
void CMergeWizardTree::OnBnClickedFindbranchend()
{
	CheckData(false);

	if ((!EndRev.IsValid())||(EndRev == 0))
		EndRev = SVNRev::REV_HEAD;
	if (::IsWindow(m_pLogDlg2->GetSafeHwnd())&&(m_pLogDlg2->IsWindowVisible()))
		return;
	CString url;

	m_URLCombo2.GetWindowText(url);
	//now show the log dialog for the main trunk
	if (!url.IsEmpty())
	{
		CTSVNPath wcPath = ((CMergeWizard*)GetParent())->wcPath;
		if (m_pLogDlg2)
		{
			m_pLogDlg2->DestroyWindow();
			delete m_pLogDlg2;
		}
		m_pLogDlg2 = new CLogDlg();
		CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseSVN\\NumberOfLogs"), 100);
		int limit = (int)(LONG)reg;
		m_pLogDlg2->m_wParam = MERGE_REVSELECTEND;
		m_pLogDlg2->SetDialogTitle(CString(MAKEINTRESOURCE(IDS_MERGE_SELECTENDREVISION)));
		m_pLogDlg2->SetSelect(true);
		m_pLogDlg2->m_pNotifyWindow = this;
		m_pLogDlg2->SetProjectPropertiesPath(wcPath);
		m_pLogDlg2->SetParams(CTSVNPath(url), EndRev, EndRev, 1, limit, TRUE, FALSE);
		m_pLogDlg2->ContinuousSelection(true);
		m_pLogDlg2->SetMergePath(wcPath);
		m_pLogDlg2->Create(IDD_LOGMESSAGE, this);
		m_pLogDlg2->ShowWindow(SW_SHOW);
	}
}
Esempio n. 11
0
void CSetHooks::OnBnClickedEditbutton()
{
#if 0
	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 = CTSVNPath(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();
		}
	}
#endif
}
void CMergeWizardReintegrate::OnBnClickedShowmergelog()
{
	if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
		return;
	CString url;
	m_URLCombo.GetWindowText(url);

	if (!url.IsEmpty())
	{
		CTSVNPath wcPath = ((CMergeWizard*)GetParent())->wcPath;
		if (m_pLogDlg)
			m_pLogDlg->DestroyWindow();
		delete m_pLogDlg;
		m_pLogDlg = new CLogDlg();
		CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseSVN\\NumberOfLogs"), 100);
		int limit = (int)(LONG)reg;
		m_pLogDlg->SetDialogTitle(CString(MAKEINTRESOURCE(IDS_MERGE_SELECTRANGE)));

		m_pLogDlg->SetSelect(true);
		m_pLogDlg->m_pNotifyWindow = this;
		m_pLogDlg->SetParams(CTSVNPath(url), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, limit, TRUE, FALSE);
		m_pLogDlg->SetProjectPropertiesPath(wcPath);
		m_pLogDlg->SetMergePath(wcPath);
		m_pLogDlg->Create(IDD_LOGMESSAGE, this);
		m_pLogDlg->ShowWindow(SW_SHOW);
	}
}
void CConflictResolveDlg::OnBnClickedUselocal()
{
    bool bUseFull = !!m_pConflictDescription->is_binary;
    bool diffallowed = ((m_pConflictDescription->merged_file && m_pConflictDescription->base_abspath)
                        || (!m_pConflictDescription->base_abspath && m_pConflictDescription->my_abspath && m_pConflictDescription->their_abspath));
    bUseFull = bUseFull || !diffallowed;
    if (!bUseFull && m_pConflictDescription->local_abspath)
    {
        // try to get the mime-type property
        // note:
        // the is_binary member of the conflict description struct is currently
        // always 'false' for merge conflicts. The svn library does not
        // try to find out whether the text conflict is actually from a binary
        // or a text file but passes 'false' unconditionally. So we try to
        // find out for real whether the file is binary or not by reading
        // the svn:mime-type property.
        // If the svn lib ever changes that, we can remove this part of the code.
        SVNProperties props(CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->local_abspath)), SVNRev::REV_WC, false, false);
        for (int i = 0; i < props.GetCount(); ++i)
        {
            if (props.GetItemName(i).compare("svn:mime-type") == 0)
            {
                if (props.GetItemValue(i).find("text") == std::string::npos)
                    bUseFull = true;
            }
        }
    }
    m_choice =  bUseFull ? svn_wc_conflict_choose_mine_full : svn_wc_conflict_choose_mine_conflict;
    EndDialog(IDOK);
}
void CEditPropExternals::OnBnClickedFindhead()
{
    CProgressDlg progDlg;
    progDlg.ShowModal(m_hWnd, TRUE);
    progDlg.SetTitle(IDS_EDITPROPS_PROG_FINDHEADTITLE);
    progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_EDITPROPS_PROG_FINDHEADROOTS)));
    DWORD count = 0;
    DWORD total = (DWORD)m_externals.size()*4;
    SVN svn;
    svn.SetPromptParentWindow(m_hWnd);
    SVNInfo svnInfo;
    svnInfo.SetPromptParentWindow(m_hWnd);
    for (auto it = m_externals.begin(); it != m_externals.end(); ++it)
    {
        progDlg.SetProgress(count++, total);
        if (progDlg.HasUserCancelled())
            break;
        if (it->root.IsEmpty())
        {
            CTSVNPath p = it->path;
            p.AppendPathString(it->targetDir);
            it->root = svn.GetRepositoryRoot(p);
        }
    }

    progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_EDITPROPS_PROG_FINDHEADREVS)));
    SVNLogHelper logHelper;
    for (auto it = m_externals.begin(); it != m_externals.end(); ++it)
    {
        progDlg.SetProgress(count, total);
        progDlg.SetLine(2, it->url, true);
        if (progDlg.HasUserCancelled())
            break;
        count += 4;
        if (!it->root.IsEmpty())
        {
            auto youngestRev = logHelper.GetYoungestRev(CTSVNPath(it->fullurl));
            if (!youngestRev.IsValid())
                it->headrev = svn.GetHEADRevision(CTSVNPath(it->fullurl), true);
            else
                it->headrev = youngestRev;
        }
    }
    progDlg.Stop();
    m_ExtList.Invalidate();
}
Esempio n. 15
0
CSVNStatusCache::CSVNStatusCache(void)
{
#define forever DWORD(-1)
	AutoLocker lock(m_NoWatchPathCritSec);
	TCHAR path[MAX_PATH];
	SHGetFolderPath(NULL, CSIDL_COOKIES, NULL, 0, path);
	m_NoWatchPaths[CTSVNPath(CString(path))] = forever;
	SHGetFolderPath(NULL, CSIDL_HISTORY, NULL, 0, path);
	m_NoWatchPaths[CTSVNPath(CString(path))] = forever;
	SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL, 0, path);
	m_NoWatchPaths[CTSVNPath(CString(path))] = forever;
	SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, 0, path);
	m_NoWatchPaths[CTSVNPath(CString(path))] = forever;
	SHGetFolderPath(NULL, CSIDL_WINDOWS, NULL, 0, path);
	m_NoWatchPaths[CTSVNPath(CString(path))] = forever;
	m_bClearMemory = false;
	m_mostRecentExpiresAt = 0;
}
void CConflictResolveDlg::OnBnClickedEditconflict()
{
    CString filename, n1, n2, n3, n4;
    if (m_pConflictDescription->property_name)
    {
        filename = CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name);
        n1.Format(IDS_DIFF_PROP_WCNAME, (LPCTSTR)filename);
        n2.Format(IDS_DIFF_PROP_BASENAME, (LPCTSTR)filename);
        n3.Format(IDS_DIFF_PROP_REMOTENAME, (LPCTSTR)filename);
        n4.Format(IDS_DIFF_PROP_MERGENAME, (LPCTSTR)filename);
    }
    else
    {
        filename = CUnicodeUtils::GetUnicode(m_pConflictDescription->local_abspath);
        filename = CPathUtils::GetFileNameFromPath(filename);
        n1.Format(IDS_DIFF_WCNAME, (LPCTSTR)filename);
        n2.Format(IDS_DIFF_BASENAME, (LPCTSTR)filename);
        n3.Format(IDS_DIFF_REMOTENAME, (LPCTSTR)filename);
        n4.Format(IDS_DIFF_MERGEDNAME, (LPCTSTR)filename);
    }

    m_mergedfile = CTempFiles::Instance().GetTempFilePath(false, CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->local_abspath))).GetWinPath();
    CAppUtils::MergeFlags flags;
    flags.bAlternativeTool = (GetKeyState(VK_SHIFT)&0x8000) != 0;
    flags.bReadOnly = true;
    CTSVNPath basefile;
    CTSVNPath theirfile;
    CTSVNPath myfile;
    if (m_pConflictDescription->base_abspath)
        basefile = CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->base_abspath));
    else
        basefile = CTempFiles::Instance().GetTempFilePath(true);
    if (m_pConflictDescription->their_abspath && (m_pConflictDescription->kind != svn_wc_conflict_kind_property))
        theirfile = CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->their_abspath));
    else
    {
        if (m_pConflictDescription->merged_file)
            theirfile = CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->merged_file));
        else
            theirfile = CTempFiles::Instance().GetTempFilePath(true);
    }
    if (m_pConflictDescription->my_abspath)
        myfile = CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->my_abspath));
    else
    {
        if (m_pConflictDescription->merged_file)
            myfile = CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->merged_file));
        else
            myfile = CTempFiles::Instance().GetTempFilePath(true);
    }
    CAppUtils::StartExtMerge(flags,
                             basefile,
                             theirfile,
                             myfile,
                             CTSVNPath(m_mergedfile), true,
                             n2, n3, n1, n4, filename);

    GetDlgItem(IDC_RESOLVED)->EnableWindow(TRUE);
}
Esempio n. 17
0
CString DropMoveCommand::Validate(const int /*nID*/, const CString& input)
{
    CString sError;

    CString sDroppath = parser.GetVal(_T("droptarget"));
    if (input.IsEmpty())
        sError.LoadString(IDS_ERR_NOVALIDPATH);
    else if (!CTSVNPath(sDroppath+_T("\\")+input).IsValidOnWindows())
        sError.LoadString(IDS_ERR_NOVALIDPATH);

    return sError;
}
Esempio n. 18
0
    void RemoveDuplicatesTest()
    {
        CTSVNPathList list;
        list.AddPath(CTSVNPath(L"Z"));
        list.AddPath(CTSVNPath(L"A"));
        list.AddPath(CTSVNPath(L"E"));
        list.AddPath(CTSVNPath(L"E"));

        ATLASSERT(list[2].IsEquivalentTo(list[3]));
        ATLASSERT(list[2]==list[3]);

        ATLASSERT(list.GetCount() == 4);

        list.RemoveDuplicates();

        ATLASSERT(list.GetCount() == 3);

        ATLASSERT(list[0].GetWinPathString() == L"A");
        ATLASSERT(list[1].GetWinPathString().Compare(L"E") == 0);
        ATLASSERT(list[2].GetWinPathString() == L"Z");
    }
Esempio n. 19
0
CSVNStatusCache::CSVNStatusCache(void)
{
#define forever DWORD(-1)
    AutoLocker lock(m_NoWatchPathCritSec);
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_Cookies))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_History))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_InternetCache))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_Windows))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_CDBurning))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_Fonts))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_RecycleBinFolder))] = forever;
    m_NoWatchPaths[CTSVNPath(GetSpecialFolder(FOLDERID_SearchHistory))] = forever;
    m_bClearMemory = false;
    m_mostRecentExpiresAt = 0;
}
Esempio n. 20
0
CTSVNPath CTSVNPathList::GetCommonRoot() const
{
    if (GetCount() == 0)
        return CTSVNPath();
    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() + '\\';
    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() + '\\';

        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 ('\\'), rootLength);

    // done

    return CTSVNPath (root);
}
Esempio n. 21
0
bool UrlDiffCommand::Execute()
{
    bool bRet = false;
    CUrlDiffDlg dlg;
    dlg.m_path = cmdLinePath.GetWinPathString();
    if (dlg.DoModal() == IDOK)
    {
        SVNDiff diff(NULL, GetExplorerHWND());
        diff.SetJumpLine(parser.GetLongVal(_T("line")));
        bool ignoreprops = !!parser.HasKey(_T("ignoreprops"));
        bRet = diff.ShowCompare(cmdLinePath, SVNRev::REV_WC, CTSVNPath(dlg.m_URL), dlg.Revision, SVNRev(), ignoreprops, L"");
    }
    return bRet;
}
Esempio n. 22
0
void CSwitchDlg::OnBnClickedLog()
{
	UpdateData(TRUE);
	if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
		return;
	m_URL = CPathUtils::CombineUrls(m_repoRoot, m_URLCombo.GetString());
	if (!m_URL.IsEmpty())
	{
		delete m_pLogDlg;
		m_pLogDlg = new CLogDlg();
		CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseSVN\\NumberOfLogs"), 100);
		int limit = (int)(LONG)reg;
		m_pLogDlg->SetSelect(true);
		m_pLogDlg->m_pNotifyWindow = this;
		m_pLogDlg->m_wParam = 0;
		m_pLogDlg->SetParams(CTSVNPath(m_URL), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, limit, TRUE);
		m_pLogDlg->ContinuousSelection(true);
		m_pLogDlg->SetProjectPropertiesPath(CTSVNPath(m_path));
		m_pLogDlg->Create(IDD_LOGMESSAGE, this);
		m_pLogDlg->ShowWindow(SW_SHOW);
	}
	AfxGetApp()->DoWaitCursor(-1);
}
void CTreeConflictEditorDlg::OnBnClickedBranchlog()
{
    CString sTemp;
    sTemp.Format(L"%s/%s", (LPCTSTR)src_left_version_url, (LPCTSTR)src_left_version_path);

    CString sFile;
    CTSVNPath logPath = CTSVNPath(sTemp);
    if (src_left_version_kind != svn_node_dir)
    {
        sFile = logPath.GetFilename();
        logPath = logPath.GetContainingDirectory();
    }

    CAppUtils::RunTortoiseProc(GetShowLogCmd(logPath, sFile));
}
Esempio n. 24
0
void CTSVNPathList::LoadFromAsteriskSeparatedString(const CString& sPathString)
{
    if (GetCount() > 0)
        Clear();

    int pos = 0;
    CString temp;
    for(;;)
    {
        temp = sPathString.Tokenize(L"*",pos);
        if(temp.IsEmpty())
        {
            break;
        }
        AddPath(CTSVNPath(CPathUtils::GetLongPathname(temp)));
    }
}
Esempio n. 25
0
bool DiffCommand::Execute()
{
	bool bRet = false;
	CString path2 = CPathUtils::GetLongPathname(parser.GetVal(_T("path2")));
	bool bAlternativeTool = !!parser.HasKey(_T("alternative"));
	bool bBlame = !!parser.HasKey(_T("blame"));
	if (path2.IsEmpty())
	{
		SVNDiff diff(NULL, hwndExplorer);
		diff.SetAlternativeTool(bAlternativeTool);
		diff.SetJumpLine(parser.GetLongVal(_T("line")));
		if ( parser.HasKey(_T("startrev")) && parser.HasKey(_T("endrev")) )
		{
			SVNRev StartRevision = SVNRev(parser.GetLongVal(_T("startrev")));
			SVNRev EndRevision = SVNRev(parser.GetLongVal(_T("endrev")));
			bRet = diff.ShowCompare(cmdLinePath, StartRevision, cmdLinePath, EndRevision, SVNRev(), false, bBlame);
		}
		else
		{
			svn_revnum_t baseRev = 0;
			if (cmdLinePath.IsDirectory())
			{
				bRet = diff.DiffProps(cmdLinePath, SVNRev::REV_WC, SVNRev::REV_BASE, baseRev);
				if (bRet == false)
				{
					CChangedDlg dlg;
					dlg.m_pathList = CTSVNPathList(cmdLinePath);
					dlg.DoModal();
					bRet = true;
				}
			}
			else
			{
				bRet = diff.DiffFileAgainstBase(cmdLinePath, baseRev);
			}
		}
	} 
	else
		bRet = CAppUtils::StartExtDiff(
			CTSVNPath(path2), cmdLinePath, CString(), CString(),
			CAppUtils::DiffFlags().AlternativeTool(bAlternativeTool), parser.GetLongVal(_T("line")));
	return bRet;
}
Esempio n. 26
0
void CSetHooks::OnBnClickedRemovebutton()
{
#if 0
	// traversing from the end to the beginning so that the indices are not skipped
	int index = m_cHookList.GetItemCount()-1;
	while (index >= 0)
	{
		if (m_cHookList.GetItemState(index, LVIS_SELECTED) & LVIS_SELECTED)
		{
			hookkey key;
			key.htype = CHooks::GetHookType((LPCTSTR)m_cHookList.GetItemText(index, 0));
			key.path = CTSVNPath(m_cHookList.GetItemText(index, 1));
			CHooks::Instance().Remove(key);		
			m_cHookList.DeleteItem(index);
			SetModified();
		}
		index--;
	}
#endif
}
Esempio n. 27
0
void CConflictResolveDlg::OnBnClickedEditconflict()
{
	CString filename, n1, n2, n3;
	if (m_pConflictDescription->property_name)
	{
		filename = CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name);
		n1.Format(IDS_DIFF_PROP_WCNAME, (LPCTSTR)filename);
		n2.Format(IDS_DIFF_PROP_BASENAME, (LPCTSTR)filename);
		n3.Format(IDS_DIFF_PROP_REMOTENAME, (LPCTSTR)filename);
	}
	else
	{
		filename = CUnicodeUtils::GetUnicode(m_pConflictDescription->path);
		filename = CPathUtils::GetFileNameFromPath(filename);
		n1.Format(IDS_DIFF_WCNAME, (LPCTSTR)filename);
		n2.Format(IDS_DIFF_BASENAME, (LPCTSTR)filename);
		n3.Format(IDS_DIFF_REMOTENAME, (LPCTSTR)filename);
	}

	if (m_pConflictDescription->base_file == NULL)
	{
		CAppUtils::DiffFlags flags;
		// no base file, start TortoiseMerge in Two-way diff mode
		CAppUtils::StartExtDiff(CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->their_file)),
			CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->my_file)),
			n3, n1, flags);
	}
	else
	{
		// Subversion segfaults (1.5.1) if the path of the merged file is not a child of the
		// folder where the conflict occurs. That's why we try to use the provided file path first...
		if (m_pConflictDescription->merged_file)
			m_mergedfile = CUnicodeUtils::GetUnicode(m_pConflictDescription->merged_file);
		else
			m_mergedfile = CTempFiles::Instance().GetTempFilePath(false, CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->path))).GetWinPath();
		CAppUtils::StartExtMerge(CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->base_file)),
								CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->their_file)),
								CTSVNPath(CUnicodeUtils::GetUnicode(m_pConflictDescription->my_file)),
								CTSVNPath(m_mergedfile),
								n2, n3, n1, CString(), false);
	}

	GetDlgItem(IDC_RESOLVED)->EnableWindow(TRUE);
}
Esempio n. 28
0
void CCopyDlg::OnBnClickedBrowsefrom()
{
    m_tooltips.Pop();   // hide the tooltips
    UpdateData(TRUE);
    if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible()))
        return;
    AfxGetApp()->DoWaitCursor(1);
    //now show the log dialog
    if (!m_wcURL.IsEmpty())
    {
        delete m_pLogDlg;
        m_pLogDlg = new CLogDlg();
        m_pLogDlg->SetParams(CTSVNPath(m_wcURL), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, TRUE);
        m_pLogDlg->SetSelect(true);
        m_pLogDlg->Create(IDD_LOGMESSAGE, this);
        m_pLogDlg->ShowWindow(SW_SHOW);
        m_pLogDlg->m_wParam = 0;
        m_pLogDlg->m_pNotifyWindow = this;
    }
    AfxGetApp()->DoWaitCursor(-1);
}
void CRepoCreationFinished::OnBnClickedCreatefolders()
{
    // create the default folder structure in a temp folder
    CTSVNPath tempDir = CTempFiles::Instance().GetTempDirPath(true);
    if (tempDir.IsEmpty())
    {
        ::MessageBox(m_hWnd, CString(MAKEINTRESOURCE(IDS_ERR_CREATETEMPDIR)), CString(MAKEINTRESOURCE(IDS_APPNAME)), MB_ICONERROR);
        return;
    }
    CTSVNPath tempDirSub = tempDir;
    tempDirSub.AppendPathString(L"trunk");
    CreateDirectory(tempDirSub.GetWinPath(), NULL);
    tempDirSub = tempDir;
    tempDirSub.AppendPathString(L"branches");
    CreateDirectory(tempDirSub.GetWinPath(), NULL);
    tempDirSub = tempDir;
    tempDirSub.AppendPathString(L"tags");
    CreateDirectory(tempDirSub.GetWinPath(), NULL);

    CString url;
    if (m_RepoPath.GetWinPathString().GetAt(0) == '\\')    // starts with '\' means an UNC path
    {
        CString p = m_RepoPath.GetWinPathString();
        p.TrimLeft('\\');
        url = L"file://"+p;
    }
    else
        url = L"file:///"+m_RepoPath.GetWinPathString();

    // import the folder structure into the new repository
    SVN svn;
    if (!svn.Import(tempDir, CTSVNPath(url), CString(MAKEINTRESOURCE(IDS_MSG_IMPORTEDSTRUCTURE)), NULL, svn_depth_infinity, true, true, false))
    {
        svn.ShowErrorDialog(m_hWnd);
        return;
    }
    MessageBox(CString(MAKEINTRESOURCE(IDS_MSG_IMPORTEDSTRUCTUREFINISHED)), L"TortoiseSVN", MB_ICONINFORMATION);
    DialogEnableWindow(IDC_CREATEFOLDERS, FALSE);
}
Esempio n. 30
0
void CExportDlg::OnBnClickedShowlog()
{
    m_tooltips.Pop();   // hide the tooltips
    UpdateData(TRUE);
    m_URL = m_URLCombo.GetString();
    if ((m_pLogDlg)&&(m_pLogDlg->IsWindowVisible()))
        return;
    AfxGetApp()->DoWaitCursor(1);
    //now show the log dialog for working copy
    if (!m_URL.IsEmpty())
    {
        delete m_pLogDlg;
        m_pLogDlg = new CLogDlg();
        m_pLogDlg->SetParams(CTSVNPath(m_URL), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1);
        m_pLogDlg->m_wParam = 1;
        m_pLogDlg->SetSelect(true);
        m_pLogDlg->m_pNotifyWindow = this;
        m_pLogDlg->Create(IDD_LOGMESSAGE, this);
        m_pLogDlg->ShowWindow(SW_SHOW);
    }
    AfxGetApp()->DoWaitCursor(-1);
}