Пример #1
0
void CUpdateDlg::OnBnClickedSparse()
{
    UpdateData();

    CString strURLs;

    CTSVNPathList paths;
    paths.LoadFromAsteriskSeparatedString (strURLs);

    SVN svn;
    CString strUrl = svn.GetURLFromPath(m_wcPath);

    CRepositoryBrowser browser(strUrl, SVNRev::REV_HEAD, this);
    browser.SetSparseCheckoutMode(m_wcPath);
    if (browser.DoModal() == IDOK)
    {
        m_checkoutDepths = browser.GetUpdateDepths();
        CString sCustomDepth = CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_CUSTOM));
        int customIndex = m_depthCombo.FindStringExact(-1, sCustomDepth);
        if (customIndex == CB_ERR)
        {
            customIndex = m_depthCombo.AddString(sCustomDepth);
        }
        m_depthCombo.SetCurSel(customIndex);
    }
}
Пример #2
0
bool CRevisionGraphWnd::FetchRevisionData
    ( const CString& path
    , SVNRev pegRevision
    , CProgressDlg* progress
    , ITaskbarList3 * pTaskbarList
    , HWND hWnd)
{
    // (re-)fetch the data
    SVN svn;
    if (svn.GetRepositoryRoot(CTSVNPath(path)) == svn.GetURLFromPath(CTSVNPath(path)))
    {
        m_state.SetLastErrorMessage(CString(MAKEINTRESOURCE(IDS_REVGRAPH_ERR_NOGRAPHFORROOT)));
        return false;
    }

    std::unique_ptr<CFullHistory> newFullHistory (new CFullHistory());

    bool showWCRev
        = m_state.GetOptions()->GetOption<CShowWC>()->IsSelected();
    bool showWCModification
        = m_state.GetOptions()->GetOption<CShowWCModification>()->IsSelected();
    bool result = newFullHistory->FetchRevisionData ( path
                                                    , pegRevision
                                                    , showWCRev
                                                    , showWCModification
                                                    , progress
                                                    , pTaskbarList
                                                    , hWnd);

    m_state.SetLastErrorMessage (newFullHistory->GetLastErrorMessage());

    if (result)
    {
        std::unique_ptr<CFullGraph> newFullGraph (new CFullGraph());

        CFullGraphBuilder builder (*newFullHistory, *newFullGraph);
        builder.Run();

        CFullGraphFinalizer finalizer (*newFullHistory, *newFullGraph);
        finalizer.Run();

        m_state.SetQueryResult ( newFullHistory
                               , newFullGraph
                               , showWCRev || showWCModification);
    }

    return result;
}
Пример #3
0
BOOL CMergeWizard::OnInitDialog()
{
    BOOL bResult = CResizableSheetEx::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    SetIcon(m_hIcon, TRUE);         // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon

    SVN svn;
    url = svn.GetURLFromPath(wcPath);
    sUUID = svn.GetUUIDFromPath(wcPath);

    MARGINS margs;
    margs.cxLeftWidth = 0;
    margs.cyTopHeight = 0;
    margs.cxRightWidth = 0;
    margs.cyBottomHeight = BOTTOMMARG;

    if ((DWORD)CRegDWORD(L"Software\\TortoiseSVN\\EnableDWMFrame", TRUE))
    {
        HIGHCONTRAST hc = { sizeof(HIGHCONTRAST) };
        SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &hc, FALSE);
        BOOL bEnabled = FALSE;
        if (((hc.dwFlags & HCF_HIGHCONTRASTON) == 0) && SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled)
        {
            DwmExtendFrameIntoClientArea(m_hWnd, &margs);
            ShowGrip(false);
        }
        m_aeroControls.SubclassOkCancelHelp(this);
        m_aeroControls.SubclassControl(this, ID_WIZFINISH);
        m_aeroControls.SubclassControl(this, ID_WIZBACK);
        m_aeroControls.SubclassControl(this, ID_WIZNEXT);
    }

    if ((m_pParentWnd == NULL) && (GetExplorerHWND()))
        CenterWindow(CWnd::FromHandle(GetExplorerHWND()));
    EnableSaveRestore(L"MergeWizard");

    return bResult;
}
Пример #4
0
bool CHooks::PreConnect(const CTSVNPathList& pathList)
{
    if ((m_lastPreConnectTicks == 0) || ((GetTickCount64() - m_lastPreConnectTicks) > 5*60*1000))
    {
        hookiterator it = FindItem(pre_connect_hook, pathList);
        if (it == end())
        {
            if (!m_PathsConvertedToUrls && pathList.GetCount() && pathList[0].IsUrl())
            {
                SVN svn;
                for (hookiterator ith = begin(); ith != end(); ++ith)
                {
                    if (ith->first.htype == pre_connect_hook)
                    {
                        CString sUrl = svn.GetURLFromPath(ith->first.path);
                        hookkey hk;
                        hk.htype = pre_connect_hook;
                        hk.path = CTSVNPath(sUrl);
                        insert(std::pair<hookkey, hookcmd>(hk, ith->second));
                    }
                }
                m_PathsConvertedToUrls = true;
                it = FindItem(pre_connect_hook, pathList);
                if (it == end())
                    return false;
            }
            else
                return false;
        }
        CString sCmd = it->second.commandline;
        CString error;
        RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow);
        m_lastPreConnectTicks = GetTickCount64();
        return true;
    }
    return false;
}
bool DropExternalCommand::Execute()
{
    bool bSuccess = false;
    CString droppath = parser.GetVal(L"droptarget");
    CTSVNPath droptsvnpath = CTSVNPath(droppath);
    if (droptsvnpath.IsAdminDir())
        droptsvnpath = droptsvnpath.GetDirectory();
    if (!droptsvnpath.IsDirectory())
        droptsvnpath = droptsvnpath.GetDirectory();

    // first get the svn:externals property from the target folder
    SVNProperties props(droptsvnpath, SVNRev::REV_WC, false, false);
    std::string sExternalsValue;
    for (int i = 0; i < props.GetCount(); ++i)
    {
        if (props.GetItemName(i).compare(SVN_PROP_EXTERNALS) == 0)
        {
            sExternalsValue = props.GetItemValue(i);
            break;
        }
    }

    // we don't add admin dirs as externals
    pathList.RemoveAdminPaths();
    if (pathList.GetCount() == 0)
        return bSuccess;

    SVNStatus status;
    status.GetStatus(droptsvnpath);
    CString sTargetRepoRootUrl;
    if (status.status && status.status->repos_root_url)
    {
        sTargetRepoRootUrl = CUnicodeUtils::GetUnicode(status.status->repos_root_url);
    }
    if (sTargetRepoRootUrl.IsEmpty())
    {
        // failed to get the status and/or the repo root url
        CString messageString;
        messageString.Format(IDS_ERR_NOURLOFFILE, droptsvnpath.GetWinPath());
        ::MessageBox(GetExplorerHWND(), messageString, L"TortoiseSVN", MB_ICONERROR);
    }
    SVN svn;
    for (auto i = 0; i < pathList.GetCount(); ++i)
    {
        CTSVNPath destPath = droptsvnpath;
        destPath.AppendPathString(pathList[i].GetFileOrDirectoryName());
        bool bExists = !!PathFileExists(destPath.GetWinPath());
        if (!bExists &&
            (PathIsDirectory(pathList[i].GetWinPath()) || CopyFile(pathList[i].GetWinPath(), destPath.GetWinPath(), TRUE)))
        {
            SVNStatus sourceStatus;
            sourceStatus.GetStatus(pathList[i]);
            if (sourceStatus.status && sourceStatus.status->repos_root_url)
            {
                CString sExternalRootUrl = CUnicodeUtils::GetUnicode(sourceStatus.status->repos_root_url);
                CString sExternalUrl = svn.GetURLFromPath(pathList[i]);
                CString sExtValue = sExternalUrl + L" " + pathList[i].GetFileOrDirectoryName();
                // check if the url is from the same repo as the target, and if it is
                // use a relative external url instead of a full url
                if (sTargetRepoRootUrl.Compare(sExternalRootUrl) == 0)
                {
                    sExtValue = L"^" + sExternalUrl.Mid(sTargetRepoRootUrl.GetLength()) + L" " + pathList[i].GetFileOrDirectoryName();
                }
                if (!sExternalsValue.empty())
                {
                    if (sExternalsValue[sExternalsValue.size() - 1] != '\n')
                        sExternalsValue += "\n";
                }
                sExternalsValue += CUnicodeUtils::StdGetUTF8((LPCWSTR)sExtValue);
                bSuccess = true;
            }
        }
        else
        {
            // the file already exists, there can't be an external with the
            // same name.

            CString messageString;
            messageString.Format(IDS_DROPEXT_FILEEXISTS, (LPCWSTR)pathList[i].GetFileOrDirectoryName());
            ::MessageBox(GetExplorerHWND(), messageString, L"TortoiseSVN", MB_ICONERROR);
            bSuccess = false;
        }
    }
    if (bSuccess)
    {
        bSuccess = !!props.Add(SVN_PROP_EXTERNALS, sExternalsValue, true);
        if (bSuccess)
        {
            CString sInfo;
            sInfo.Format(IDS_DROPEXT_UPDATE_TASK1, (LPCTSTR)droptsvnpath.GetFileOrDirectoryName());
            CTaskDialog taskdlg(sInfo,
                                CString(MAKEINTRESOURCE(IDS_DROPEXT_UPDATE_TASK2)),
                                L"TortoiseSVN",
                                0,
                                TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT);
            taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_DROPEXT_UPDATE_TASK3)));
            taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_DROPEXT_UPDATE_TASK4)));
            taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON);
            taskdlg.SetDefaultCommandControl(2);
            taskdlg.SetMainIcon(TD_WARNING_ICON);
            bool doUpdate = (taskdlg.DoModal(GetExplorerHWND()) == 1);
            if (doUpdate)
            {
                DWORD exitcode = 0;
                CString error;
                ProjectProperties pprops;
                pprops.ReadPropsPathList(pathList);
                CHooks::Instance().SetProjectProperties(droptsvnpath, pprops);
                if (CHooks::Instance().StartUpdate(GetExplorerHWND(), pathList, exitcode, error))
                {
                    if (exitcode)
                    {
                        CString temp;
                        temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
                        ::MessageBox(GetExplorerHWND(), temp, L"TortoiseSVN", MB_ICONERROR);
                        return FALSE;
                    }
                }

                CSVNProgressDlg progDlg;
                theApp.m_pMainWnd = &progDlg;
                progDlg.SetCommand(CSVNProgressDlg::SVNProgress_Update);
                progDlg.SetAutoClose(parser);
                progDlg.SetOptions(ProgOptSkipPreChecks);
                progDlg.SetPathList(CTSVNPathList(droptsvnpath));
                progDlg.SetRevision(SVNRev(L"HEAD"));
                progDlg.SetProjectProperties(pprops);
                progDlg.SetDepth(svn_depth_unknown);
                progDlg.DoModal();
                return !progDlg.DidErrorsOccur();
            }
        }
        else
        {
            // adding the svn:externals property failed, remove all the copied files
            props.ShowErrorDialog(GetExplorerHWND());
        }
    }

    return bSuccess != false;
}
Пример #6
0
BOOL CCopyDlg::OnInitDialog()
{
    CResizableStandAloneDialog::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    ExtendFrameIntoClientArea(IDC_EXTGROUP);
    m_aeroControls.SubclassControl(this, IDC_DOSWITCH);
    m_aeroControls.SubclassControl(this, IDC_MAKEPARENTS);
    m_aeroControls.SubclassOkCancelHelp(this);
    m_bCancelled = false;

    DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_CHECKBOXES;
    m_ExtList.SetExtendedStyle(exStyle);
    SetWindowTheme(m_ExtList.GetSafeHwnd(), L"Explorer", NULL);
    m_ExtList.ShowText(CString(MAKEINTRESOURCE(IDS_COPY_WAITFOREXTERNALS)));

    AdjustControlSize(IDC_COPYHEAD);
    AdjustControlSize(IDC_COPYREV);
    AdjustControlSize(IDC_COPYWC);
    AdjustControlSize(IDC_DOSWITCH);
    AdjustControlSize(IDC_MAKEPARENTS);

    CTSVNPath path(m_path);
    CString sWindowTitle;
    GetWindowText(sWindowTitle);
    CAppUtils::SetWindowTitle(m_hWnd, path.GetUIPathString(), sWindowTitle);

    m_History.SetMaxHistoryItems((LONG)CRegDWORD(L"Software\\TortoiseSVN\\MaxHistoryItems", 25));

    SetRevision(m_CopyRev);

    m_tooltips.AddTool(IDC_HISTORY, IDS_COMMITDLG_HISTORY_TT);

    if (SVN::PathIsURL(path))
    {
        DialogEnableWindow(IDC_COPYWC, FALSE);
        DialogEnableWindow(IDC_DOSWITCH, FALSE);
        SetDlgItemText(IDC_COPYSTARTLABEL, CString(MAKEINTRESOURCE(IDS_COPYDLG_FROMURL)));
    }

    SVN svn;
    CString sUUID;
    m_repoRoot = svn.GetRepositoryRootAndUUID(path, true, sUUID);
    m_repoRoot.TrimRight('/');
    m_wcURL = svn.GetURLFromPath(path);
    if (m_wcURL.IsEmpty() || (!path.IsUrl() && !path.Exists()))
    {
        CString Wrong_URL=path.GetSVNPathString();
        CString temp;
        temp.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)Wrong_URL);
        ::MessageBox(this->m_hWnd, temp, L"TortoiseSVN", MB_ICONERROR);
        this->EndDialog(IDCANCEL);      //exit
    }
    m_URLCombo.LoadHistory(L"Software\\TortoiseSVN\\History\\repoPaths\\"+sUUID, L"url");
    m_URLCombo.SetCurSel(0);
    CString relPath = m_wcURL.Mid(m_repoRoot.GetLength());
    if (!m_URL.IsEmpty())
    {
        // allow the use of urls relative to the repo root
        if (m_URL[0] != '^')
            relPath = m_URL.Mid(m_repoRoot.GetLength());
        else
            relPath = m_URL.Mid(1);
    }
    CTSVNPath r = CTSVNPath(relPath);
    relPath = r.GetUIPathString();
    relPath.Replace('\\', '/');
    m_URLCombo.AddString(relPath, 0);
    m_URLCombo.SelectString(-1, relPath);
    m_URL = m_wcURL;
    SetDlgItemText(IDC_DESTURL, CPathUtils::CombineUrls(m_repoRoot, relPath));
    SetDlgItemText(IDC_FROMURL, m_wcURL);

    CString reg;
    reg.Format(L"Software\\TortoiseSVN\\History\\commit%s", (LPCTSTR)sUUID);
    m_History.Load(reg, L"logmsgs");

    m_ProjectProperties.ReadProps(m_path);
    if (CRegDWORD(L"Software\\TortoiseSVN\\AlwaysWarnIfNoIssue", FALSE))
        m_ProjectProperties.bWarnIfNoIssue = TRUE;

    m_cLogMessage.Init(m_ProjectProperties);
    m_cLogMessage.SetFont((CString)CRegString(L"Software\\TortoiseSVN\\LogFontName", L"Courier New"), (DWORD)CRegDWORD(L"Software\\TortoiseSVN\\LogFontSize", 8));

    GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(FALSE);
    CBugTraqAssociations bugtraq_associations;
    bugtraq_associations.Load(m_ProjectProperties.GetProviderUUID(), m_ProjectProperties.sProviderParams);

    if (bugtraq_associations.FindProvider(CTSVNPathList(m_path), &m_bugtraq_association))
    {
        CComPtr<IBugTraqProvider> pProvider;
        HRESULT hr = pProvider.CoCreateInstance(m_bugtraq_association.GetProviderClass());
        if (SUCCEEDED(hr))
        {
            m_BugTraqProvider = pProvider;
            ATL::CComBSTR temp;
            ATL::CComBSTR parameters;
            parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString());
            hr = pProvider->GetLinkText(GetSafeHwnd(), parameters, &temp);
            if (SUCCEEDED(hr))
            {
                SetDlgItemText(IDC_BUGTRAQBUTTON, temp == 0 ? L"" : temp);
                GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(TRUE);
                GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_SHOW);
            }
        }

        GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
    }
    if (m_ProjectProperties.sMessage.IsEmpty())
    {
        GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE);
        GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE);
        GetDlgItem(IDC_LOGMESSAGE)->SetFocus();
    }
    else
    {
        GetDlgItem(IDC_BUGID)->ShowWindow(SW_SHOW);
        GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_SHOW);
        if (!m_ProjectProperties.sLabel.IsEmpty())
            SetDlgItemText(IDC_BUGIDLABEL, m_ProjectProperties.sLabel);
        GetDlgItem(IDC_BUGID)->SetFocus();
    }

    if (!m_sLogMessage.IsEmpty())
        m_cLogMessage.SetText(m_sLogMessage);
    else
        m_cLogMessage.SetText(m_ProjectProperties.GetLogMsgTemplate(PROJECTPROPNAME_LOGTEMPLATEBRANCH));

    OnEnChangeLogmessage();

    m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKALL);
    m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKNONE);

    // line up all controls and adjust their sizes.
#define LINKSPACING 9
    RECT rc = AdjustControlSize(IDC_SELECTLABEL);
    rc.right -= 15; // AdjustControlSize() adds 20 pixels for the checkbox/radio button bitmap, but this is a label...
    rc = AdjustStaticSize(IDC_CHECKALL, rc, LINKSPACING);
    rc = AdjustStaticSize(IDC_CHECKNONE, rc, LINKSPACING);

    CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_TEXT);
    CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_HELP, CString(MAKEINTRESOURCE(IDS_INPUT_ENTERLOG)));
    CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_INVISIBLE)));

    CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKALL)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK);
    CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKNONE)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK);

    CAppUtils::SetAccProperty(m_URLCombo.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_TOURLLABEL)));
    CAppUtils::SetAccProperty(GetDlgItem(IDC_FROMURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_COPYSTARTLABEL)));
    CAppUtils::SetAccProperty(GetDlgItem(IDC_DESTURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_DESTLABEL)));

    AddAnchor(IDC_REPOGROUP, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_COPYSTARTLABEL, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_FROMURL, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_TOURLLABEL, TOP_LEFT);
    AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_BROWSE, TOP_RIGHT);
    AddAnchor(IDC_DESTLABEL, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_DESTURL, TOP_LEFT, TOP_RIGHT);
    AddAnchor(IDC_MSGGROUP, TOP_LEFT, MIDDLE_RIGHT);
    AddAnchor(IDC_HISTORY, TOP_LEFT);
    AddAnchor(IDC_BUGTRAQBUTTON, TOP_LEFT);
    AddAnchor(IDC_BUGIDLABEL, TOP_RIGHT);
    AddAnchor(IDC_BUGID, TOP_RIGHT);
    AddAnchor(IDC_INVISIBLE, TOP_RIGHT);
    AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, MIDDLE_RIGHT);
    AddAnchor(IDC_FROMGROUP, MIDDLE_LEFT, MIDDLE_RIGHT);
    AddAnchor(IDC_COPYHEAD, MIDDLE_LEFT);
    AddAnchor(IDC_COPYREV, MIDDLE_LEFT);
    AddAnchor(IDC_COPYREVTEXT, MIDDLE_RIGHT);
    AddAnchor(IDC_BROWSEFROM, MIDDLE_RIGHT);
    AddAnchor(IDC_COPYWC, MIDDLE_LEFT);
    AddAnchor(IDC_EXTGROUP, MIDDLE_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_SELECTLABEL, MIDDLE_LEFT);
    AddAnchor(IDC_CHECKALL, MIDDLE_LEFT);
    AddAnchor(IDC_CHECKNONE, MIDDLE_LEFT);
    AddAnchor(IDC_EXTERNALSLIST, MIDDLE_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_DOSWITCH, BOTTOM_LEFT);
    AddAnchor(IDC_MAKEPARENTS, BOTTOM_LEFT);
    AddAnchor(IDOK, BOTTOM_RIGHT);
    AddAnchor(IDCANCEL, BOTTOM_RIGHT);
    AddAnchor(IDHELP, BOTTOM_RIGHT);

    if ((m_pParentWnd==NULL)&&(GetExplorerHWND()))
        CenterWindow(CWnd::FromHandle(GetExplorerHWND()));
    EnableSaveRestore(L"CopyDlg");

    m_bSettingChanged = false;
    if (!m_path.IsUrl())
    {
        // start a thread to obtain the highest revision number of the working copy
        // without blocking the dialog
        if ((m_pThread = AfxBeginThread(FindRevThreadEntry, this))==NULL)
        {
            OnCantStartThread();
        }
    }

    return TRUE;
}
Пример #7
0
bool RepositoryBrowserCommand::Execute()
{
    CString url;
    SVN svn;
    if (!cmdLinePath.IsEmpty())
    {
        if (cmdLinePath.GetSVNPathString().Left(4).CompareNoCase(_T("svn:"))==0)
        {
            // If the path starts with "svn:" and there is another protocol
            // found in the path (a "://" found after the "svn:") then
            // remove "svn:" from the beginning of the path.
            if (cmdLinePath.GetSVNPathString().Find(_T("://"), 4)>=0)
                cmdLinePath.SetFromSVN(cmdLinePath.GetSVNPathString().Mid(4));
        }

        url = svn.GetURLFromPath(cmdLinePath);

        if (url.IsEmpty())
        {
            if (SVN::PathIsURL(cmdLinePath))
                url = cmdLinePath.GetSVNPathString();
            else if (svn.IsRepository(cmdLinePath))
            {
                // The path points to a local repository.
                // Add 'file:///' so the repository browser recognizes
                // it as an URL to the local repository.
                if (cmdLinePath.GetWinPathString().GetAt(0) == '\\')    // starts with '\' means an UNC path
                {
                    CString p = cmdLinePath.GetWinPathString();
                    p.TrimLeft('\\');
                    url = _T("file://")+p;
                }
                else
                    url = _T("file:///")+cmdLinePath.GetWinPathString();
                url.Replace('\\', '/');
            }
        }
    }
    if (cmdLinePath.GetUIPathString().Left(7).CompareNoCase(_T("file://"))==0)
    {
        cmdLinePath.SetFromUnknown(cmdLinePath.GetUIPathString().Mid(7));
    }

    if (url.IsEmpty())
    {
        CURLDlg urldlg;
        if (urldlg.DoModal() != IDOK)
        {
            return false;
        }
        url = urldlg.m_url;
        cmdLinePath = CTSVNPath(url);
    }

    CString val = parser.GetVal(_T("rev"));
    SVNRev rev(val);
    CRepositoryBrowser dlg(url, rev);
    if (!cmdLinePath.IsUrl())
        dlg.m_ProjectProperties.ReadProps(cmdLinePath);
    else
    {
        if (parser.HasVal(_T("projectpropertiespath")))
        {
            dlg.m_ProjectProperties.ReadProps(CTSVNPath(parser.GetVal(_T("projectpropertiespath"))));
        }
    }
    if (parser.HasKey(L"sparse"))
    {
        if (SVN::PathIsURL(cmdLinePath))
            dlg.SetSparseCheckoutMode(CTSVNPath());
        else
            dlg.SetSparseCheckoutMode(cmdLinePath);
    }
    dlg.m_path = cmdLinePath;
    dlg.DoModal();
    if (parser.HasVal(L"outfile"))
    {
        CString sText = dlg.GetPath();
        sText += L"\n";
        sText += dlg.GetRevision().ToString();
        CStringUtils::WriteStringToTextFile(parser.GetVal(L"outfile"), (LPCTSTR)sText, true);
    }
    return true;
}
Пример #8
0
BOOL CEditPropExternals::OnInitDialog()
{
    CResizableStandAloneDialog::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    ExtendFrameIntoClientArea(IDC_EXTERNALSLIST);
    m_aeroControls.SubclassControl(this, IDC_ADD);
    m_aeroControls.SubclassControl(this, IDC_EDIT);
    m_aeroControls.SubclassControl(this, IDC_REMOVE);
    m_aeroControls.SubclassControl(this, IDC_FINDHEAD);
    m_aeroControls.SubclassOkCancelHelp(this);

    ATLASSERT(m_pathList.GetCount() == 1);

    SVN svn;
    m_url = CTSVNPath(svn.GetURLFromPath(m_pathList[0]));
    m_repoRoot = CTSVNPath(svn.GetRepositoryRoot(m_pathList[0]));

    m_externals.Add(m_pathList[0], m_PropValue, false);

    DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER;
    m_ExtList.SetExtendedStyle(exStyle);

    SetWindowTheme(m_ExtList.GetSafeHwnd(), L"Explorer", NULL);

    m_ExtList.SetRedraw(false);
    m_ExtList.DeleteAllItems();

    int c = m_ExtList.GetHeaderCtrl()->GetItemCount()-1;
    while (c>=0)
        m_ExtList.DeleteColumn(c--);
    CString temp;
    temp.LoadString(IDS_STATUSLIST_COLFILE);
    m_ExtList.InsertColumn(0, temp);
    temp.LoadString(IDS_STATUSLIST_COLURL);
    m_ExtList.InsertColumn(1, temp);
    temp.LoadString(IDS_EXTERNALS_PEG);
    m_ExtList.InsertColumn(2, temp);
    temp.LoadString(IDS_EXTERNALS_OPERATIVE);
    m_ExtList.InsertColumn(3, temp);
    temp.LoadString(IDS_EXTERNALS_HEADREV);
    m_ExtList.InsertColumn(4, temp);
    m_ExtList.SetItemCountEx((int)m_externals.size());

    CRect rect;
    m_ExtList.GetClientRect(&rect);
    m_ExtList.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
    int cx = (rect.Width()-240-m_ExtList.GetColumnWidth(0));
    m_ExtList.SetColumnWidth(1, cx);
    m_ExtList.SetColumnWidth(2, 80);
    m_ExtList.SetColumnWidth(3, 80);
    m_ExtList.SetColumnWidth(4, 80);

    m_ExtList.SetRedraw(true);

    CString sWindowTitle;
    GetWindowText(sWindowTitle);
    CAppUtils::SetWindowTitle(m_hWnd, m_pathList.GetCommonRoot().GetUIPathString(), sWindowTitle);

    AddAnchor(IDC_EXTERNALSLIST, TOP_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_ADD, BOTTOM_LEFT);
    AddAnchor(IDC_EDIT, BOTTOM_LEFT);
    AddAnchor(IDC_REMOVE, BOTTOM_LEFT);
    AddAnchor(IDC_FINDHEAD, BOTTOM_LEFT);
    AddAnchor(IDOK, BOTTOM_RIGHT);
    AddAnchor(IDCANCEL, BOTTOM_RIGHT);
    AddAnchor(IDHELP, BOTTOM_RIGHT);
    EnableSaveRestore(L"EditPropsExternals");

    return TRUE;
}
Пример #9
0
BOOL CSwitchDlg::OnInitDialog()
{
	CResizableStandAloneDialog::OnInitDialog();

	ExtendFrameIntoClientArea(IDC_REVGROUP);
	m_aeroControls.SubclassOkCancelHelp(this);

	CTSVNPath svnPath(m_path);
	SetDlgItemText(IDC_SWITCHPATH, m_path);
	m_bFolder = svnPath.IsDirectory();
	SVN svn;
	CString sUUID;
	m_repoRoot = svn.GetRepositoryRootAndUUID(svnPath, true, sUUID);
	m_repoRoot.TrimRight('/');
	CString url = svn.GetURLFromPath(svnPath);
	m_URLCombo.LoadHistory(_T("Software\\TortoiseSVN\\History\\repoPaths\\")+sUUID, _T("url"));
	m_URLCombo.SetCurSel(0);
	if (!url.IsEmpty())
	{
		CString relPath = url.Mid(m_repoRoot.GetLength());
		CTSVNPath r = CTSVNPath(relPath);
		relPath = r.GetUIPathString();
		relPath.Replace('\\', '/');
		m_URLCombo.AddString(relPath, 0);
		m_URLCombo.SelectString(-1, relPath);
		m_URL = url;

		SetDlgItemText(IDC_DESTURL, CPathUtils::CombineUrls(m_repoRoot, relPath));
	}

	if (m_sTitle.IsEmpty())
		GetWindowText(m_sTitle);
	SetWindowText(m_sTitle);
	if (m_sLabel.IsEmpty())
		GetDlgItemText(IDC_URLLABEL, m_sLabel);
	SetDlgItemText(IDC_URLLABEL, m_sLabel);

	// set head revision as default revision
	SetRevision(SVNRev::REV_HEAD);

	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_WORKING)));
	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_INFINITE)));
	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_IMMEDIATE)));
	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_FILES)));
	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EMPTY)));
	m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EXCLUDE)));
	m_depthCombo.SetCurSel(0);

	RECT rect;
	GetWindowRect(&rect);
	m_height = rect.bottom - rect.top;

	AddAnchor(IDC_SWITCHLABEL, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_SWITCHPATH, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_URLLABEL, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_BROWSE, TOP_RIGHT);
	AddAnchor(IDC_DESTLABEL, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_DESTURL, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_REVGROUP, TOP_LEFT);
	AddAnchor(IDC_REVISION_HEAD, TOP_LEFT);
	AddAnchor(IDC_REVISION_N, TOP_LEFT);
	AddAnchor(IDC_REVISION_NUM, TOP_LEFT);
	AddAnchor(IDC_LOG, TOP_LEFT);
	AddAnchor(IDC_GROUPMIDDLE, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_DEPTH, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_NOEXTERNALS, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDOK, BOTTOM_RIGHT);
	AddAnchor(IDCANCEL, BOTTOM_RIGHT);
	AddAnchor(IDHELP, BOTTOM_RIGHT);

	if ((m_pParentWnd==NULL)&&(hWndExplorer))
		CenterWindow(CWnd::FromHandle(hWndExplorer));
	EnableSaveRestore(_T("SwitchDlg"));
	return TRUE;
}