• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28354 (tree)
Time2018-09-08 03:28:23
Authorstefankueng

Log Message

Extend the "Go-offline" dialog:
* show the error message that's the cause for showing the dialog
* add a "Retry" button

Change Summary

Incremental Difference

--- trunk/src/LogCache/CacheLogQuery.cpp (revision 28353)
+++ trunk/src/LogCache/CacheLogQuery.cpp (revision 28354)
@@ -534,41 +534,48 @@
534534
535535 CString rooturl = CUnicodeUtils::GetUnicode (URL);
536536
537- try
537+ bool doRetry = false;
538+ do
538539 {
539- svnQuery->Log ( CTSVNPathList (path)
540- , static_cast<long>(startRevision)
541- , static_cast<long>(startRevision)
542- , static_cast<long>(endRevision)
543- , limit
544- , options.GetStrictNodeHistory()
545- , this
546- , true
547- , options.GetIncludeMerges()
548- , options.GetIncludeStandardRevProps()
549- , options.GetIncludeUserRevProps()
550- , TRevPropNames());
551- }
552- catch (SVNError& e)
553- {
554- // if the problem was caused by SVN and the user wants
555- // to go off-line, swallow the error
556-
557- if ( receiverError
558- || e.GetCode() == SVN_ERR_CANCELLED
559- || e.GetCode() == SVN_ERR_FS_NOT_FOUND // deleted paths etc.
560- || e.GetCode() == SVN_ERR_FS_NO_SUCH_REVISION
561- || !repositoryInfoCache->IsOffline (uuid, rooturl, true))
540+ try
562541 {
563- // we want to cache whatever data we could receive so far ..
542+ doRetry = false;
543+ svnQuery->Log(CTSVNPathList(path)
544+ , static_cast<long>(startRevision)
545+ , static_cast<long>(startRevision)
546+ , static_cast<long>(endRevision)
547+ , limit
548+ , options.GetStrictNodeHistory()
549+ , this
550+ , true
551+ , options.GetIncludeMerges()
552+ , options.GetIncludeStandardRevProps()
553+ , options.GetIncludeUserRevProps()
554+ , TRevPropNames());
555+ }
556+ catch (SVNError& e)
557+ {
558+ // if the problem was caused by SVN and the user wants
559+ // to go off-line, swallow the error
564560
565- MergeFromUpdateCache();
561+ if (receiverError
562+ || e.GetCode() == SVN_ERR_CANCELLED
563+ || e.GetCode() == SVN_ERR_FS_NOT_FOUND // deleted paths etc.
564+ || e.GetCode() == SVN_ERR_FS_NO_SUCH_REVISION
565+ || !repositoryInfoCache->IsOffline(uuid, rooturl, true, CUnicodeUtils::GetUnicode(e.GetMessage()), doRetry))
566+ {
567+ if (doRetry)
568+ continue;
569+ // we want to cache whatever data we could receive so far ..
566570
567- // cancel SVN op
571+ MergeFromUpdateCache();
568572
569- throw;
573+ // cancel SVN op
574+
575+ throw;
576+ }
570577 }
571- }
578+ } while (doRetry);
572579
573580 // update the cache with the data we may have received
574581
@@ -576,7 +583,8 @@
576583
577584 // update skip ranges etc. if we are still connected
578585
579- if (!repositoryInfoCache->IsOffline (uuid, rooturl, false))
586+ doRetry = false;
587+ if (!repositoryInfoCache->IsOffline (uuid, rooturl, false, L"", doRetry))
580588 {
581589 // do we miss some data at the end of the log?
582590 // (no-op, if end-of-log was reached;
@@ -1003,8 +1011,8 @@
10031011 }
10041012
10051013 // don't try to fetch data when in "disconnected" mode
1006-
1007- if (repositoryInfoCache->IsOffline (uuid, root, false))
1014+ bool doRetry = false;
1015+ if (repositoryInfoCache->IsOffline (uuid, root, false, L"", doRetry))
10081016 {
10091017 // just skip unknown revisions
10101018 // (we already warned the use that this might
@@ -1096,8 +1104,8 @@
10961104 if (iterator.DataIsMissing())
10971105 {
10981106 // don't try to fetch data when in "disconnected" mode
1099-
1100- if (repositoryInfoCache->IsOffline (uuid, root, false))
1107+ bool doRetry = false;
1108+ if (repositoryInfoCache->IsOffline (uuid, root, false, L"", doRetry))
11011109 {
11021110 // just skip unknown revisions
11031111 // (we already warned the use that this might
@@ -1234,7 +1242,8 @@
12341242 const CRevisionIndex& revisions = cache->GetRevisions();
12351243 result = cache->FindRevisionByDate (revision.GetDate());
12361244 CString sURL = url.GetSVNPathString();
1237- bool offline = repositoryInfoCache->IsOffline (uuid, sURL, false);
1245+ bool doRetry = false;
1246+ bool offline = repositoryInfoCache->IsOffline (uuid, sURL, false, L"", doRetry);
12381247
12391248 // special case: date is before revision 1 / first cached revision
12401249
@@ -1241,7 +1250,7 @@
12411250 if ( (result == NO_REVISION)
12421251 && ((revisions.GetFirstCachedRevision() < 2) || offline))
12431252 {
1244- // we won't get anyting better than this:
1253+ // we won't get anything better than this:
12451254
12461255 result = 0;
12471256 break;
@@ -1293,34 +1302,37 @@
12931302 {
12941303 // first attempt: ask directly for that revision
12951304
1296- SVNInfo info;
1297- const SVNInfoData * baseInfo
1298- = info.GetFirstFileInfo (path, peg, revision);
1299-
1300- if (baseInfo != NULL)
1305+ do
13011306 {
1302- result = static_cast<LONG>(baseInfo->rev);
1303- break;
1304- }
1307+ SVNInfo info;
1308+ const SVNInfoData * baseInfo
1309+ = info.GetFirstFileInfo(path, peg, revision);
13051310
1306- // was it just the revision being out of bound?
1311+ if (baseInfo != NULL)
1312+ {
1313+ result = static_cast<LONG>(baseInfo->rev);
1314+ break;
1315+ }
13071316
1308- if (info.GetSVNError()->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES)
1309- {
1310- // this will happen for dates in the future (post-HEAD)
1311- // as long as the URL is valid.
1312- // -> we are propably at the bottom end
1317+ // was it just the revision being out of bound?
13131318
1314- result = 0;
1315- break;
1316- }
1319+ if (info.GetSVNError()->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES)
1320+ {
1321+ // this will happen for dates in the future (post-HEAD)
1322+ // as long as the URL is valid.
1323+ // -> we are probably at the bottom end
13171324
1318- // (Probably) a server access errror. Retry off-line.
1325+ result = 0;
1326+ break;
1327+ }
13191328
1320- if (repositoryInfoCache->IsOffline (uuid, sURL, true))
1321- return DecodeRevision (path, url, revision, peg);
1322- else
1323- throw SVNError(info.GetSVNError());
1329+ // (Probably) a server access error. Retry off-line.
1330+ doRetry = false;
1331+ if (repositoryInfoCache->IsOffline(uuid, sURL, true, info.GetLastErrorMessage(), doRetry))
1332+ return DecodeRevision(path, url, revision, peg);
1333+ else
1334+ throw SVNError(info.GetSVNError());
1335+ } while (doRetry);
13241336 }
13251337
13261338 break;
--- trunk/src/LogCache/RepositoryInfo.cpp (revision 28353)
+++ trunk/src/LogCache/RepositoryInfo.cpp (revision 28354)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2007-2012, 2014-2015 - TortoiseSVN
3+// Copyright (C) 2007-2012, 2014-2015, 2018 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -414,7 +414,7 @@
414414
415415 // does the user want to be this repository off-line?
416416
417-bool CRepositoryInfo::IsOffline (SPerRepositoryInfo* info) const
417+bool CRepositoryInfo::IsOffline (SPerRepositoryInfo* info, const CString& sErr, bool& doRetry) const
418418 {
419419 // is this repository already off-line?
420420
@@ -427,17 +427,10 @@
427427 {
428428 // Default behavior is "Ask the user what to do"
429429
430- // TODO: improve the dialog with
431- // * the error message (why do we think the repository is offline?)
432- // this could be shown in the dialog itself in a label, a separate popup
433- // from a "show error" button or simply a tooltip
434- // * a button to retry
435- //
436- // for this, the IsOffline() method needs changing:
437- // * requires a param for the error message (or the SVNError exception object)
438- // * an int return type which tells either to cancel, go offline, retry, ...
439430 CGoOffline dialog;
431+ dialog.SetErrorMessage(sErr);
440432 dialog.DoModal();
433+ doRetry = dialog.doRetry;
441434 if (dialog.asDefault)
442435 CSettings::SetDefaultConnectionState (dialog.selection);
443436
@@ -580,24 +573,30 @@
580573
581574 info->headLookupTime = now;
582575 info->headURL = sURL;
583- info->headRevision = svn.GetHEADRevision (url, false);
576+ bool doRetry = false;
577+ do
578+ {
579+ doRetry = false;
580+ info->headRevision = svn.GetHEADRevision(url, false);
584581
585- // if we couldn't connect to the server, ask the user
582+ // if we couldn't connect to the server, ask the user
586583
587- bool cancelled = svn.GetSVNError() && (svn.GetSVNError()->apr_err == SVN_ERR_CANCELLED);
588- if ( !svn.IsSuppressedUI() && !cancelled
589- && (info->headRevision == NO_REVISION)
590- && IsOffline (info))
591- {
592- // user wants to go off-line
584+ bool cancelled = svn.GetSVNError() && (svn.GetSVNError()->apr_err == SVN_ERR_CANCELLED);
593585
594- SetHeadFromCache (info);
586+ if (!svn.IsSuppressedUI() && !cancelled
587+ && (info->headRevision == NO_REVISION)
588+ && IsOffline(info, svn.GetLastErrorMessage(), doRetry))
589+ {
590+ // user wants to go off-line
595591
596- // we just ignore our latest error
592+ SetHeadFromCache(info);
597593
598- svn.ClearSVNError();
599- }
594+ // we just ignore our latest error
600595
596+ svn.ClearSVNError();
597+ }
598+ } while (doRetry);
599+
601600 modified = true;
602601 }
603602
@@ -630,7 +629,7 @@
630629 // is the repository offline?
631630 // Don't modify the state if autoSet is false.
632631
633-bool CRepositoryInfo::IsOffline (const CString& uuid, const CString& root, bool autoSet)
632+bool CRepositoryInfo::IsOffline (const CString& uuid, const CString& root, bool autoSet, const CString& sErr, bool& doRetry)
634633 {
635634 async::CCriticalSectionLock lock (GetDataMutex());
636635
@@ -648,7 +647,7 @@
648647 // offline-defaults have been set)
649648
650649 if (autoSet)
651- IsOffline (info);
650+ IsOffline (info, sErr, doRetry);
652651
653652 // return state
654653
--- trunk/src/LogCache/RepositoryInfo.h (revision 28353)
+++ trunk/src/LogCache/RepositoryInfo.h (revision 28354)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2007-2009, 2012, 2014 - TortoiseSVN
3+// Copyright (C) 2007-2009, 2012, 2014, 2018 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -200,7 +200,7 @@
200200
201201 /// does the user want to be this repository off-line?
202202
203- bool IsOffline (SPerRepositoryInfo* info) const;
203+ bool IsOffline (SPerRepositoryInfo* info, const CString& sErr, bool& doRetry) const;
204204
205205 /// try to get the HEAD revision from the log cache
206206
@@ -229,7 +229,7 @@
229229 /// is the repository offline?
230230 /// Don't modify the state if autoSet is false.
231231
232- bool IsOffline (const CString& uuid, const CString& url, bool autoSet);
232+ bool IsOffline (const CString& uuid, const CString& url, bool autoSet, const CString& sErr, bool& doRetry);
233233
234234 /// get the connection state (uninterpreted)
235235
--- trunk/src/TortoiseProc/GoOffline.cpp (revision 28353)
+++ trunk/src/TortoiseProc/GoOffline.cpp (revision 28354)
@@ -1,4 +1,4 @@
1-// GoOffline.cpp : implementation file
1+// GoOffline.cpp : implementation file
22 //
33
44 #include "stdafx.h"
@@ -14,6 +14,7 @@
1414 : CDialog(CGoOffline::IDD, pParent)
1515 , asDefault(false)
1616 , selection(LogCache::online)
17+ , doRetry(false)
1718 {
1819
1920 }
@@ -22,6 +23,11 @@
2223 {
2324 }
2425
26+void CGoOffline::SetErrorMessage(const CString& errMsg)
27+{
28+ m_errMsg = errMsg;
29+}
30+
2531 void CGoOffline::DoDataExchange(CDataExchange* pDX)
2632 {
2733 CDialog::DoDataExchange(pDX);
@@ -34,9 +40,19 @@
3440 ON_BN_CLICKED(IDOK, &CGoOffline::OnBnClickedOk)
3541 ON_BN_CLICKED(IDC_PERMANENTLYOFFLINE, &CGoOffline::OnBnClickedPermanentlyOffline)
3642 ON_BN_CLICKED(IDCANCEL, &CGoOffline::OnBnClickedCancel)
43+ ON_BN_CLICKED(IDC_RETRY, &CGoOffline::OnBnClickedRetry)
3744 END_MESSAGE_MAP()
3845
3946
47+BOOL CGoOffline::OnInitDialog()
48+{
49+ CDialog::OnInitDialog();
50+
51+ SetDlgItemText(IDC_ERRORMSG, m_errMsg);
52+
53+ return TRUE;
54+}
55+
4056 // CGoOffline message handlers
4157
4258 void CGoOffline::OnBnClickedOk()
@@ -59,3 +75,12 @@
5975
6076 OnCancel();
6177 }
78+
79+
80+void CGoOffline::OnBnClickedRetry()
81+{
82+ doRetry = true;
83+ selection = LogCache::online;
84+
85+ OnCancel();
86+}
--- trunk/src/TortoiseProc/GoOffline.h (revision 28353)
+++ trunk/src/TortoiseProc/GoOffline.h (revision 28354)
@@ -1,4 +1,4 @@
1-#pragma once
1+#pragma once
22
33 #include "RepositoryInfo.h"
44
@@ -12,19 +12,25 @@
1212 CGoOffline(CWnd* pParent = NULL); // standard constructor
1313 virtual ~CGoOffline();
1414
15+ void SetErrorMessage(const CString& errMsg);
16+
17+ LogCache::ConnectionState selection;
18+ BOOL asDefault;
19+ BOOL doRetry;
20+
1521 // Dialog Data
1622 enum { IDD = IDD_GOOFFLINE };
1723
1824 protected:
1925 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
26+ virtual BOOL OnInitDialog();
2027
21- DECLARE_MESSAGE_MAP()
22-public:
23-
24- LogCache::ConnectionState selection;
25- BOOL asDefault;
26-
2728 afx_msg void OnBnClickedOk();
2829 afx_msg void OnBnClickedPermanentlyOffline();
2930 afx_msg void OnBnClickedCancel();
31+ afx_msg void OnBnClickedRetry();
32+
33+ DECLARE_MESSAGE_MAP()
34+private:
35+ CString m_errMsg;
3036 };
--- trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28353)
+++ trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28354)
@@ -1919,7 +1919,8 @@
19191919 DialogEnableWindow(IDC_REFRESH, TRUE);
19201920
19211921 LogCache::CRepositoryInfo& cachedProperties = GetLogCachePool()->GetRepositoryInfo();
1922- SetDlgTitle(cachedProperties.IsOffline (m_sUUID, m_sRepositoryRoot, false));
1922+ bool doRetry = false;
1923+ SetDlgTitle(cachedProperties.IsOffline (m_sUUID, m_sRepositoryRoot, false, L"", doRetry));
19231924
19241925 m_LogProgress.ShowWindow(FALSE);
19251926 if (!m_bMonitoringMode)
--- trunk/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp (revision 28353)
+++ trunk/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp (revision 28354)
@@ -1546,10 +1546,11 @@
15461546 CSyncPointer<const CFullHistory> fullHistoy (m_state.GetFullHistory());
15471547 if (fullHistoy.get() != NULL)
15481548 {
1549+ bool doRetry = false;
15491550 SetDlgTitle (cachedProperties.IsOffline
15501551 ( fullHistoy->GetRepositoryUUID()
15511552 , fullHistoy->GetRepositoryRoot()
1552- , false));
1553+ , false, L"", doRetry));
15531554 }
15541555
15551556 if (m_parent && !m_parent->GetOutputFile().IsEmpty())
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Show on old repository browser