[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH]: Fix for ambigious Error dialog when unavailable Revision number is used in Log

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 30 Dec 2009 21:44:06 +0100

On 30.12.2009 15:50, Ramasubramanian Sambamurthy wrote:
> Log:
>
> When “show log” command is used with “show range” option with any of the
> two revision numbers greater than HEAD revision, irrelevant Error dialog
> is shown. Fix is done such that appropriate error message will be
> displayed in display window when any of the given revision number is
> greater than HEAD Revision.
>
> * TortoiseSVN/src/TortoiseProc/LogDialog/LogDlg.cpp:
>
> (GetAll)
>
>
>
> Check is done whether startrev and endrev is greater than HEAD Revision
> and if any, Appropriate Error message is shown in Display window.
>
> Patch by: Ramasubramanian S V <svram_at_collab.net>

a few comments about this patch:

        SVN svn;
        svn_revnum_t m_head = svn.GetHEADRevision(m_path);
here you're creating a new SVN instance. This is not necessary since the
log dialog itself inherits from SVN. Just call GetHEADRevision()
directly. But there's another thing: GetHEADRevision might contact the
repository (especially if log caching is disabled), which we'd like to
do only on the thread, not on the UI thread.

                        if (dlg.DoModal()!=IDOK )
                                return;

slight formatting issue: remove the space before the ')'

        if (m_startrev > m_head || m_endrev > m_head)
        {
                CString revnum;
                _ttoi(m_startrev.ToString()) >= _ttoi(m_endrev.ToString()) ? revnum =
m_startrev.ToString() : revnum = m_endrev.ToString();
            pMsgView->SetWindowText(_T("No Such Revision ")+ (revnum));
            return;
        }

you're using the .ToString() method but then convert that to an integer
with _ttoi(). The SVNRev class has methods to determine what kind of
revision it represents. You could use m_endrev.IsDate() for this check.
Or !m_endrev.IsNumber(), depending on what you want to do.

And to show an error message, use
m_LogList.ShowText() instead of pMsgView->SetWindowText(). Showing an
error in the commit message view is bad, because there's no way to know
that it's an error and not the commit message.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2433863
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-12-30 21:44:20 CET

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.