[commit] r2354 - trunk/Tests/svngui
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Sep 20 18:49:52 CDT 2013
Author: volgy
Date: Fri Sep 20 18:49:52 2013
New Revision: 2354
Log:
SVN Client work in progress
Added:
trunk/Tests/svngui/SVNDialogPlaintext.cpp
trunk/Tests/svngui/SVNDialogPlaintext.h
trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp
trunk/Tests/svngui/SVNDialogSSLServerTrust.h
Deleted:
trunk/Tests/svngui/test.svngui
Modified:
trunk/Tests/svngui/Resource.h
trunk/Tests/svngui/SVNClient.cpp
trunk/Tests/svngui/svngui.rc
trunk/Tests/svngui/svngui.vcxproj
trunk/Tests/svngui/svngui.vcxproj.filters
trunk/Tests/svngui/svnguiDoc.cpp
Modified: trunk/Tests/svngui/Resource.h
==============================================================================
Binary files trunk/Tests/svngui/Resource.h Fri Sep 20 18:48:47 2013 (r2353) and trunk/Tests/svngui/Resource.h Fri Sep 20 18:49:52 2013 (r2354) differ
Modified: trunk/Tests/svngui/SVNClient.cpp
==============================================================================
--- trunk/Tests/svngui/SVNClient.cpp Fri Sep 20 18:48:47 2013 (r2353)
+++ trunk/Tests/svngui/SVNClient.cpp Fri Sep 20 18:49:52 2013 (r2354)
@@ -12,6 +12,8 @@
#include "svn_props.h"
#include "SVNDialogCommit.h"
+#include "SVNDialogPlaintext.h"
+#include "SVNDialogSSLServerTrust.h"
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "shfolder.lib")
@@ -96,11 +98,12 @@
CSVNClient::~CSVNClient(void)
{
+
POSITION p = svnFiles.GetHeadPosition();
while (p) {
delete svnFiles.GetNext(p);
}
-
+
apr_terminate();
}
@@ -341,14 +344,19 @@
///////////////////////////////////////////////////////////////////////
// SVN Client Auth Callbacks
///////////////////////////////////////////////////////////////////////
+
+//
+// Auth callback function for asking whether storing a password to disk in plaintext is allowed.
+//
svn_error_t* CSVNClient::cbAuthPlaintextPrompt(
svn_boolean_t *may_save_plaintext,
const char *realmstring,
void *baton,
apr_pool_t *pool)
{
- //TODO: implement this
- may_save_plaintext = FALSE;
+ CSVNDialogPlaintext dlg;
+ dlg.realm = realmstring;
+ *may_save_plaintext = (dlg.DoModal() == IDOK) ? TRUE : FALSE;
return SVN_NO_ERROR;
}
@@ -358,8 +366,9 @@
void *baton,
apr_pool_t *pool)
{
- //TODO: implement this
- may_save_plaintext = FALSE;
+ CSVNDialogPlaintext dlg;
+ dlg.realm = realmstring;
+ *may_save_plaintext = (dlg.DoModal() == IDOK) ? TRUE : FALSE;
return SVN_NO_ERROR;
}
@@ -373,9 +382,10 @@
{
//TODO: implement this
svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->username = NULL;
- ret->password = NULL;
+ ret->username = "volgy";
+ ret->password = "7torpe";
ret->may_save = may_save;
+ *cred = ret;
return SVN_NO_ERROR;
}
@@ -402,10 +412,44 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- //TODO: implement this
- svn_auth_cred_ssl_server_trust_t *ret = (svn_auth_cred_ssl_server_trust_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->accepted_failures = failures;
- ret->may_save = may_save;
+ /*
+ CSVNDialogSSLServerTrust dlg;
+ dlg.host = cert_info->hostname;
+ dlg.fingerprint = cert_info->fingerprint;
+ dlg.issuer = cert_info->issuer_dname;
+ dlg.permanentEnabled = may_save;
+
+ if (failures & SVN_AUTH_SSL_NOTYETVALID) {
+ dlg.problems += _T("Certificate is not yet valid.\r");
+ }
+ if (failures & SVN_AUTH_SSL_EXPIRED) {
+ dlg.problems += _T("Certificate has expired.\r");
+ }
+ if (failures & SVN_AUTH_SSL_CNMISMATCH) {
+ dlg.problems += _T("Certificate's CN does not match the remote hostname.\r");
+ }
+ if (failures & SVN_AUTH_SSL_UNKNOWNCA) {
+ dlg.problems += _T("Certificate authority is unknown or not trusted.\r");
+ }
+ if (failures & SVN_AUTH_SSL_OTHER) {
+ dlg.problems += _T("Other failure.\r");
+ }
+
+ if (dlg.DoModal() == IDOK) {
+ svn_auth_cred_ssl_server_trust_t *ret = (svn_auth_cred_ssl_server_trust_t *)apr_pcalloc(pool, sizeof(*ret));
+ ret->accepted_failures = failures;
+ ret->may_save = dlg.permanent;
+ *cred = ret;
+ }
+ else {
+ *cred = NULL;
+ }
+ */
+
+svn_auth_cred_ssl_server_trust_t *ret = (svn_auth_cred_ssl_server_trust_t *)apr_pcalloc(pool, sizeof(*ret));
+ret->accepted_failures = failures;
+ret->may_save = FALSE;
+*cred = ret;
return SVN_NO_ERROR;
}
@@ -455,14 +499,14 @@
svn_error_t* e;
if (client->isInitialized) {
- svn_opt_revision_t revision = {svn_opt_revision_head, {0}};
-
apr_pool_t* scratch_pool = svn_pool_create(client->pool);
+ svn_opt_revision_t revision = {svn_opt_revision_head, {0}};
+
e = svn_client_status5(NULL, client->ctx, CStringA(filePath),
&revision, svn_depth_immediates, TRUE, checkServer ? TRUE : FALSE,
FALSE, FALSE, TRUE, NULL, cbStatus, this, scratch_pool);
-
+apr_terminate();
svn_pool_clear(scratch_pool);
if (e && e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) {
@@ -504,7 +548,7 @@
CStringA filePathA(filePath);
const char* target = filePathA;
apr_pool_t* scratch_pool = svn_pool_create(client->pool);
- apr_array_header_t* targets = apr_array_make(client->pool, 1, sizeof(target));
+ apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
svn_opt_revision_t revision = {svn_opt_revision_head, {0}};
@@ -522,7 +566,7 @@
CStringA filePathA(filePath);
const char* target = filePathA;
apr_pool_t* scratch_pool = svn_pool_create(client->pool);
- apr_array_header_t* targets = apr_array_make(client->pool, 1, sizeof(target));
+ apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
SVNTHROW(svn_client_lock(targets, "GME auto-locking", FALSE, client->ctx, scratch_pool));
@@ -537,12 +581,12 @@
CStringA filePathA(filePath);
const char* target = filePathA;
apr_pool_t* scratch_pool = svn_pool_create(client->pool);
- apr_array_header_t* targets = apr_array_make(client->pool, 1, sizeof(target));
+ apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
SVNTHROW(svn_client_commit6(targets, svn_depth_immediates, FALSE, FALSE, FALSE,
FALSE, FALSE, NULL, NULL, NULL, NULL, client->ctx, scratch_pool));
-
+
// commit does not release the lock if the file was not changed (empty commit)
if (!client->canceledOperation) {
updateStatus();
@@ -577,7 +621,7 @@
apr_hash_t* props;
svn_opt_revision_t revision = {svn_opt_revision_base, {0}};
- SVNTHROW(svn_client_propget(&props, SVN_PROP_NEEDS_LOCK, CStringA(self->filePath),
+ SVN_ERR(svn_client_propget(&props, SVN_PROP_NEEDS_LOCK, CStringA(self->filePath),
&revision, FALSE, self->client->ctx, scratch_pool));
if (apr_hash_count(props)) {
Added: trunk/Tests/svngui/SVNDialogPlaintext.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogPlaintext.cpp Fri Sep 20 18:49:52 2013 (r2354)
@@ -0,0 +1,36 @@
+// SVNDialogPlaintext.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "svngui.h"
+#include "SVNDialogPlaintext.h"
+#include "afxdialogex.h"
+
+
+// CSVNDialogPlaintext dialog
+
+IMPLEMENT_DYNAMIC(CSVNDialogPlaintext, CDialogEx)
+
+CSVNDialogPlaintext::CSVNDialogPlaintext(CWnd* pParent /*=NULL*/)
+ : CDialogEx(CSVNDialogPlaintext::IDD, pParent)
+ , realm(_T(""))
+{
+
+}
+
+CSVNDialogPlaintext::~CSVNDialogPlaintext()
+{
+}
+
+void CSVNDialogPlaintext::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, realm);
+}
+
+
+BEGIN_MESSAGE_MAP(CSVNDialogPlaintext, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CSVNDialogPlaintext message handlers
Added: trunk/Tests/svngui/SVNDialogPlaintext.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogPlaintext.h Fri Sep 20 18:49:52 2013 (r2354)
@@ -0,0 +1,23 @@
+#pragma once
+
+
+// CSVNDialogPlaintext dialog
+
+class CSVNDialogPlaintext : public CDialogEx
+{
+ DECLARE_DYNAMIC(CSVNDialogPlaintext)
+
+public:
+ CSVNDialogPlaintext(CWnd* pParent = NULL); // standard constructor
+ virtual ~CSVNDialogPlaintext();
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_SVNPLAINTEXT };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ CString realm;
+};
Added: trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp Fri Sep 20 18:49:52 2013 (r2354)
@@ -0,0 +1,56 @@
+// SVNDialogSSLServerTrust.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "svngui.h"
+#include "SVNDialogSSLServerTrust.h"
+#include "afxdialogex.h"
+
+
+// CSVNDialogSSLServerTrust dialog
+
+IMPLEMENT_DYNAMIC(CSVNDialogSSLServerTrust, CDialogEx)
+
+CSVNDialogSSLServerTrust::CSVNDialogSSLServerTrust(CWnd* pParent /*=NULL*/)
+ : CDialogEx(CSVNDialogSSLServerTrust::IDD, pParent)
+ , host(_T(""))
+ , fingerprint(_T(""))
+ , issuer(_T(""))
+ , problems(_T(""))
+ , permanent(FALSE)
+ , permanentEnabled(TRUE)
+{
+
+}
+
+CSVNDialogSSLServerTrust::~CSVNDialogSSLServerTrust()
+{
+}
+
+void CSVNDialogSSLServerTrust::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, host);
+ DDX_Text(pDX, IDC_EDIT2, fingerprint);
+ DDX_Text(pDX, IDC_EDIT3, issuer);
+ DDX_Text(pDX, IDC_EDIT4, problems);
+ DDX_Check(pDX, IDC_CHECK1, permanent);
+}
+
+
+BEGIN_MESSAGE_MAP(CSVNDialogSSLServerTrust, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CSVNDialogSSLServerTrust message handlers
+
+
+BOOL CSVNDialogSSLServerTrust::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ GetDlgItem(IDC_CHECK_PERMANENT)->EnableWindow(permanentEnabled);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
Added: trunk/Tests/svngui/SVNDialogSSLServerTrust.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogSSLServerTrust.h Fri Sep 20 18:49:52 2013 (r2354)
@@ -0,0 +1,29 @@
+#pragma once
+
+
+// CSVNDialogSSLServerTrust dialog
+
+class CSVNDialogSSLServerTrust : public CDialogEx
+{
+ DECLARE_DYNAMIC(CSVNDialogSSLServerTrust)
+
+public:
+ CSVNDialogSSLServerTrust(CWnd* pParent = NULL); // standard constructor
+ virtual ~CSVNDialogSSLServerTrust();
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_SVNSSLSERVERTRUST };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ CString host;
+ CString fingerprint;
+ CString issuer;
+ CString problems;
+ BOOL permanent;
+ virtual BOOL OnInitDialog();
+ BOOL permanentEnabled;
+};
Modified: trunk/Tests/svngui/svngui.rc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/Tests/svngui/svngui.vcxproj
==============================================================================
--- trunk/Tests/svngui/svngui.vcxproj Fri Sep 20 18:48:47 2013 (r2353)
+++ trunk/Tests/svngui/svngui.vcxproj Fri Sep 20 18:49:52 2013 (r2354)
@@ -144,6 +144,8 @@
<ClInclude Include="stdafx.h" />
<ClInclude Include="SVNClient.h" />
<ClInclude Include="SVNDialogCommit.h" />
+ <ClInclude Include="SVNDialogPlaintext.h" />
+ <ClInclude Include="SVNDialogSSLServerTrust.h" />
<ClInclude Include="svngui.h" />
<ClInclude Include="svnguiDoc.h" />
<ClInclude Include="svnguiView.h" />
@@ -158,6 +160,8 @@
</ClCompile>
<ClCompile Include="SVNClient.cpp" />
<ClCompile Include="SVNDialogCommit.cpp" />
+ <ClCompile Include="SVNDialogPlaintext.cpp" />
+ <ClCompile Include="SVNDialogSSLServerTrust.cpp" />
<ClCompile Include="svngui.cpp" />
<ClCompile Include="svnguiDoc.cpp" />
<ClCompile Include="svnguiView.cpp" />
Modified: trunk/Tests/svngui/svngui.vcxproj.filters
==============================================================================
--- trunk/Tests/svngui/svngui.vcxproj.filters Fri Sep 20 18:48:47 2013 (r2353)
+++ trunk/Tests/svngui/svngui.vcxproj.filters Fri Sep 20 18:49:52 2013 (r2354)
@@ -73,6 +73,12 @@
<ClInclude Include="SVNDialogCommit.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="SVNDialogPlaintext.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="SVNDialogSSLServerTrust.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="svngui.cpp">
@@ -99,6 +105,12 @@
<ClCompile Include="SVNDialogCommit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="SVNDialogPlaintext.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="SVNDialogSSLServerTrust.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="svngui.rc">
Modified: trunk/Tests/svngui/svnguiDoc.cpp
==============================================================================
--- trunk/Tests/svngui/svnguiDoc.cpp Fri Sep 20 18:48:47 2013 (r2353)
+++ trunk/Tests/svngui/svnguiDoc.cpp Fri Sep 20 18:49:52 2013 (r2354)
@@ -170,9 +170,8 @@
svnFile->isVersioned() ? _T("yes") : _T("no"),
svnFile->isTracked() ? _T("yes") : _T("no"),
svnFile->isOwned() ? _T("yes") : _T("no"),
- svnFile->isLatest() ? _T("yes") : _T("no"));
+ svnFile->isLatest() ? _T("yes") : _T("no") /*_T("undefined")*/);
theApp.Log(logLine);
-
if (svnFile->isTracked() && !svnFile->isOwned()) {
if (AfxMessageBox(_T("This document is tracked in the repository.\nDo you want to lock it?"), MB_YESNO) == IDYES) {
if (!svnFile->takeOwnership()) {
@@ -191,7 +190,7 @@
}
}
- catch (CSVNError e) {
+ catch (const CSVNError& e) {
theApp.Log(e.msg());
}
return TRUE;
@@ -220,10 +219,14 @@
BOOL CsvnguiDoc::SaveModified()
{
- if (svnFile && svnFile->isOwned()) {
- svnFile->commit();
+ try {
+ if (svnFile && svnFile->isOwned()) {
+ svnFile->commit();
+ }
+ }
+ catch (const CSVNError& e) {
+ theApp.Log(e.msg());
}
-
// TODO: unlock file if not changed
return CDocument::SaveModified();
More information about the gme-commit
mailing list