Thread: [Grandmas-svn-commit] SF.net SVN: grandmas-svn: [110] trunk (Page 4)
Brought to you by:
matthiasmiller
From: <hig...@us...> - 2006-12-19 17:43:31
|
Revision: 110 http://svn.sourceforge.net/grandmas-svn/?rev=110&view=rev Author: highjinx Date: 2006-12-19 09:43:31 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Improving error messages coming from subversion code Modified Paths: -------------- trunk/include/svn/helpers.h trunk/src/svn/add.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/file_access.cpp trunk/src/svn/helpers.cpp trunk/src/svn/operation.cpp trunk/src/svn/revert.cpp trunk/src/svn/svn_commit.cpp trunk/src/svn/update.cpp Modified: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/include/svn/helpers.h 2006-12-19 17:43:31 UTC (rev 110) @@ -18,12 +18,16 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include <QString> + struct apr_array_header_t; class QStringList; struct apr_pool_t; +struct svn_error_t; namespace Svn { apr_array_header_t* aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool); + QString formatSvnErrorMessage(svn_error_t* pError); }; Modified: trunk/src/svn/add.cpp =================================================================== --- trunk/src/svn/add.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/add.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -20,6 +20,7 @@ #include "svn/add.h" +#include "svn/helpers.h" #include "svn/operation.h" #include "svn/server_access.h" @@ -40,7 +41,7 @@ svn_error_t* pError = svn_client_add2(fullCanonPath, true, false, ctx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = formatSvnErrorMessage(pError); return false; } Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/commit_summary.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -87,7 +87,7 @@ } if (pError) { - rError = pError->message; + rError = formatSvnErrorMessage(pError); return false; } else Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/file_access.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -19,6 +19,7 @@ ***************************************************************************/ #include "svn/file_access.h" +#include "svn/helpers.h" #include "svn/operation.h" #include <svn_client.h> @@ -89,7 +90,7 @@ svn_error_t* pError = svn_client_cat(pStream, fullRepoPath.toAscii(), &svnRev, pCtx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = Svn::formatSvnErrorMessage(pError); return false; } Modified: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/helpers.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -27,6 +27,8 @@ #include <apr_strings.h> #include <apr_tables.h> +#include <svn_error.h> + using namespace Svn; apr_array_header_t* Svn::aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool) @@ -40,3 +42,15 @@ return array; } + +QString Svn::formatSvnErrorMessage(svn_error_t* pError) +{ + QString sErrorMsg; + svn_error_t* pWorkingError = pError; + while (pWorkingError) + { + sErrorMsg += QString(pWorkingError->message) + "\n"; + } + + return sErrorMsg.trimmed(); +} Modified: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/operation.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "svn/helpers.h" #include "svn/operation.h" #include "svn/server_access.h" @@ -90,7 +91,7 @@ svn_error_t* pError = svn_client_info(fullCanonPath, NULL, NULL, infoCallback, this, false, ctx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = Svn::formatSvnErrorMessage(pError); return false; } rRelPath = mRelativeRepoUrl; Modified: trunk/src/svn/revert.cpp =================================================================== --- trunk/src/svn/revert.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/revert.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -43,7 +43,7 @@ svn_error_t* pError = svn_client_revert(array, true, ctx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = formatSvnErrorMessage(pError); return false; } Modified: trunk/src/svn/svn_commit.cpp =================================================================== --- trunk/src/svn/svn_commit.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/svn_commit.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -62,7 +62,7 @@ svn_error_t* pError = svn_client_commit3(&pResultingInfo, filesArray, true, true, ctx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = formatSvnErrorMessage(pError); return false; } Modified: trunk/src/svn/update.cpp =================================================================== --- trunk/src/svn/update.cpp 2006-12-19 17:31:21 UTC (rev 109) +++ trunk/src/svn/update.cpp 2006-12-19 17:43:31 UTC (rev 110) @@ -65,7 +65,7 @@ svn_error_t* pError = svn_client_update2(NULL, paths, &svnRev, true, false, ctx, rContext.getAprPool()); if (pError) { - rError = pError->message; + rError = formatSvnErrorMessage(pError); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-20 03:25:56
|
Revision: 113 http://svn.sourceforge.net/grandmas-svn/?rev=113&view=rev Author: matthiasmiller Date: 2006-12-19 19:25:55 -0800 (Tue, 19 Dec 2006) Log Message: ----------- support 'make dist' on Windows (requires 7-zip) Modified Paths: -------------- trunk/grandmas_svn.pro Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags *.idb *.pdb + *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags tmp *.idb *.pdb Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-19 23:10:57 UTC (rev 112) +++ trunk/grandmas_svn.pro 2006-12-20 03:25:55 UTC (rev 113) @@ -1,4 +1,18 @@ +defineReplace(build_conf) { + debug_and_release { + contains(BUILD_NAME, Debug): return(debug) + contains(BUILD_NAME, Release): return(release) + isEmpty(BUILD_NAME): return() + error(Unrecognized build name: $$BUILD_NAME) + } + + debug:!release: return debug + !debug:release: return release + + error(Unrecognized build type: $$BUILD_NAME) +} + unix { APR_CONFIG = apr-config APU_CONFIG = apu-config @@ -52,15 +66,21 @@ } win32 { + !exists($(SVN_BIN_DIR)) { + error("SVN_BIN_DIR must point to the Subversion binaries directory."); + } !exists($(SVN_DEV_DIR)) { - error("SVN_DEV_DIR must point to the Subversion development folder."); + error("SVN_DEV_DIR must point to the Subversion development directory."); } !exists($(SVN_LIBINTL_DIR)) { - error("SVN_LIBINTL_DIR must point to the Subversion libintl folder."); + error("SVN_LIBINTL_DIR must point to the Subversion libintl directory."); } !exists($(BERKELEY_DEV_DIR)) { - error("BERKELEY_DEV_DIR must point to the Berkeley development folder."); + error("BERKELEY_DEV_DIR must point to the Berkeley development directory."); } + !exists($(VC80_CRT_DIR)) { + error("VC80_CRT_DIR must point to the Visual Studio 8.0 CRT directory."); + } INCLUDEPATH += $(SVN_DEV_DIR)\include INCLUDEPATH += $(SVN_DEV_DIR)\include\apr @@ -102,29 +122,37 @@ -lshlwapi \ -lws2_32 + DIST_FILES = \ + "bin\release\grandmas-svn.exe" \ + "$$(SVN_BIN_DIR)\bin\*.dll" \ + "$$(BERKELEY_DEV_DIR)\bin\libdb44.dll" \ + "$$[QT_INSTALL_BINS]\QtCore4.dll" \ + "$$[QT_INSTALL_BINS]\QtGui4.dll" \ + "$$(VC80_CRT_DIR)\*.dll" \ + # This is an ugly hack to get MSVC to use the release CRT even in debug mode, # since there aren't any debug Subversion libraries to link against. QMAKE_CFLAGS_DEBUG -= -MDd QMAKE_CFLAGS_DEBUG += -MD QMAKE_CXXFLAGS_DEBUG -= -MDd QMAKE_CXXFLAGS_DEBUG += -MD + + # This is already defined in APR's header. + DEFINES -= _CRT_SECURE_NO_DEPRECATE } # must set debug/release configuration immediately since it affects output directories. CONFIG += debug -debug: CONF_SUBDIR = debug -!debug: CONF_SUBDIR = release - -DESTDIR = bin/$${CONF_SUBDIR} +DESTDIR = bin/$${build_conf()} TARGET = grandmas-svn -OBJECTS_DIR = tmp/$${CONF_SUBDIR}/obj -MOC_DIR = tmp/$${CONF_SUBDIR}/moc -UI_DIR = tmp/$${CONF_SUBDIR}/ui -RCC_DIR = tmp/$${CONF_SUBDIR}/rcc +OBJECTS_DIR = tmp/$${build_conf()}/obj +MOC_DIR = tmp/$${build_conf()}/moc +UI_DIR = tmp/$${build_conf()}/ui +RCC_DIR = tmp/$${build_conf()}/rcc -CONFIG += \ +CONFIG += embed_manifest_exe \ warn_on \ qt \ thread \ @@ -205,7 +233,7 @@ # UNIT TESTS -debug { +contains(build_conf, debug) { DEFINES += GSVN_TESTS } contains(DEFINES, GSVN_TESTS) { @@ -223,3 +251,38 @@ LIBS += -lsvn_repos-1 } } + +# DISTRIBUTION PACKAGE + +win32 { + DIST_DIR = tmp$${DIR_SEPARATOR}dist + DIST_PKG_DIR = $${DIST_DIR}$${DIR_SEPARATOR}grandmas-svn$${DIR_SEPARATOR} + DIST_SFX = grandmas-svn-pkg.exe + + # Set up the cleanup commands + dist_rmdir.commands = if exist "$$DIST_DIR" rmdir /S /Q "$$DIST_DIR" + dist_mkdir.commands = $$QMAKE_MKDIR "$$DIST_DIR" && $$QMAKE_MKDIR "$$DIST_PKG_DIR" + + clean.CONFIG += phony + clean.depends += dist_rmdir + + distclean.CONFIG += phony + distclean.depends += dist_rmdir + + # Set up the build commands + for(CUR_DIST_FILE, DIST_FILES) { + DIST_CMDS += $$quote($${QMAKE_COPY} \"$$CUR_DIST_FILE\" \"$${DIST_PKG_DIR}$${DIR_SEPARATOR}.\") + } + dist_copy.commands = $$join(DIST_CMDS, $$escape_expand(\t)&& \\$$escape_expand(\n\t)) + + dist_zip.commands += cd \"$$DIST_DIR\" && 7z a -r -sfx7z.sfx -mx9 \"$$DIST_SFX\" * + + dist.depends = \ + release \ + dist_rmdir \ + dist_mkdir \ + dist_copy \ + dist_zip \ + + QMAKE_EXTRA_TARGETS += dist_rmdir dist_mkdir dist_copy dist_zip clean distclean dist +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-12-20 23:34:36
|
Revision: 116 http://svn.sourceforge.net/grandmas-svn/?rev=116&view=rev Author: highjinx Date: 2006-12-20 15:34:35 -0800 (Wed, 20 Dec 2006) Log Message: ----------- * Improve move/copy support * Fix crash when an svn operation failed * Remove revision 0 from list of historical revisions Revision Links: -------------- http://svn.sourceforge.net/grandmas-svn/?rev=0&view=rev Modified Paths: -------------- trunk/grandmas_svn.kdevelop trunk/include/svn/commit_summary.h trunk/include/svn/helpers.h trunk/include/svn/modification.h trunk/include/svn/operation.h trunk/src/dialogs/modificationsmodel.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/helpers.cpp trunk/src/svn/operation.cpp Modified: trunk/grandmas_svn.kdevelop =================================================================== --- trunk/grandmas_svn.kdevelop 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/grandmas_svn.kdevelop 2006-12-20 23:34:35 UTC (rev 116) @@ -12,7 +12,7 @@ <ignoreparts/> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description/> + <description></description> <versioncontrol/> </general> <kdevfileview> @@ -69,16 +69,16 @@ </kdevdoctreeview> <kdevdebugger> <general> - <dbgshell/> + <dbgshell></dbgshell> <breakpoints/> - <programargs/> + <programargs></programargs> <gdbpath>/usr/bin/</gdbpath> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>false</floatingtoolbar> - <configGdbScript/> - <runShellScript/> - <runGdbScript/> + <configGdbScript></configGdbScript> + <runShellScript></runShellScript> + <runGdbScript></runGdbScript> </general> <display> <staticmembers>false</staticmembers> @@ -105,7 +105,7 @@ <runmultiplejobs>false</runmultiplejobs> <numberofjobs>1</numberofjobs> <dontact>false</dontact> - <makebin/> + <makebin></makebin> <prio>0</prio> <envvars/> </make> @@ -159,10 +159,10 @@ <qt> <used>true</used> <version>4</version> - <root/> + <root></root> </qt> <creategettersetter> - <prefixGet/> + <prefixGet></prefixGet> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/include/svn/commit_summary.h 2006-12-20 23:34:35 UTC (rev 116) @@ -72,6 +72,7 @@ protected: QString mWcPath; + QString mRepoUrl; QList<CommitSummary> mSummaries; private: // Callbacks Modified: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/include/svn/helpers.h 2006-12-20 23:34:35 UTC (rev 116) @@ -30,4 +30,6 @@ { apr_array_header_t* aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool); QString formatSvnErrorMessage(svn_error_t* pError); + + bool removePrefixNoCase(QString& rString, QString prefix); }; Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/include/svn/modification.h 2006-12-20 23:34:35 UTC (rev 116) @@ -39,9 +39,7 @@ Type_TextMod, Type_Add, Type_Delete, - Type_Move, Type_PropMod, - Type_Copy, // Pseudo-types: types that are not modifications, but need to be displayed Type_New, // exists, but has not been added @@ -56,9 +54,7 @@ case Type_TextMod: case Type_Add: case Type_Delete: - case Type_Move: case Type_PropMod: - case Type_Copy: return true; case Type_New: case Type_Missing: @@ -73,11 +69,16 @@ Type getType() const { return mType; } // Only use for move mods - QString getMoveDestFilePath() const + bool isAddedWithHistory() const { - Q_ASSERT(mType == Type_Move); - return mDestFilePath; + Q_ASSERT(mType == Type_Add); + return mHistoryFilePath != ""; } + QString getHistoryFilePath() const + { + Q_ASSERT(isAddedWithHistory()); + return mHistoryFilePath; + } Revision getOldRevision() const { return mOldRevision; } Revision getNewRevision() const { return mNewRevision; } @@ -87,7 +88,7 @@ Type mType; QString mFilePath; - QString mDestFilePath; + QString mHistoryFilePath; Revision mOldRevision; Revision mNewRevision; }; Modified: trunk/include/svn/operation.h =================================================================== --- trunk/include/svn/operation.h 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/include/svn/operation.h 2006-12-20 23:34:35 UTC (rev 116) @@ -31,4 +31,5 @@ bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); bool getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError); + bool getRepoUrlWithPath(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError); }; Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-20 23:34:35 UTC (rev 116) @@ -27,11 +27,11 @@ struct ModificationsModel::DeclinedMod { - QString mPath, mMoveDestPath; + QString mPath; bool operator==(const DeclinedMod& other) const { - return mPath == other.mPath && mMoveDestPath == other.mMoveDestPath; + return mPath == other.mPath; } bool operator!=(const DeclinedMod& other) const { @@ -40,7 +40,7 @@ static DeclinedMod fromSvnMod(const Modification& mod) { - DeclinedMod declinedMod = { mod.getFilePath(), mod.getType() == Modification::Type_Move ? mod.getMoveDestFilePath() : QString() }; + DeclinedMod declinedMod = { mod.getFilePath() }; return declinedMod; } }; @@ -157,9 +157,7 @@ case Modification::Type_TextMod: return tr("Modified"); case Modification::Type_Add: return tr("Added"); case Modification::Type_Delete: return tr("Deleted"); - case Modification::Type_Move: return tr("Moved"); case Modification::Type_PropMod: return tr("Property Modified"); - case Modification::Type_Copy: return tr("Copied"); case Modification::Type_New: return tr("?"); case Modification::Type_Missing: return tr("!"); case Modification::Type_Conflicting: return tr("Conflicting"); @@ -170,10 +168,11 @@ } else if (isPathColumn(rcIndex.column())) { - if (mod.getType() == Modification::Type_Move) - return mod.getFilePath() + "\n" + mod.getMoveDestFilePath(); - else - return mod.getFilePath(); + QString path = mod.getFilePath(); + if (mod.getType() == Modification::Type_Add && mod.isAddedWithHistory()) + path += tr(" (with history from %1)").arg(mod.getHistoryFilePath()); + + return path; } else return QVariant(); Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/src/svn/commit_summary.cpp 2006-12-20 23:34:35 UTC (rev 116) @@ -45,9 +45,9 @@ svn_error_t* pError = NULL; if (startRevision.getType() != Revision::Uncommitted) { - if (!Operation::getRepoCheckoutUrl(rContext, ctx, mWcPath, fullCanonPath, rError)) - return false; - + if (!Operation::getRepoCheckoutUrl(rContext, ctx, mRepoUrl, fullCanonPath, rError)) + return false; + svn_opt_revision_t startRev = startRevision.getSvnRevision(); svn_opt_revision_t endRev = endRevision.getSvnRevision(); apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); @@ -65,14 +65,16 @@ } else { + mWcPath = fullCanonPath; + if (!Operation::getRepoUrlWithPath(rContext, ctx, mRepoUrl, fullCanonPath, rError)) + return false; + if (mSummaries.size() == 0) { CommitSummary summary; mSummaries.append(summary); } - mWcPath = fullCanonPath; - svn_opt_revision_t svnRevision = startRevision.getSvnRevision(); pError = svn_client_status2(NULL, fullCanonPath, &svnRevision, statusCallback, @@ -111,6 +113,10 @@ svn_error_t* Svn::CommitSummaryFetcher::logCallback(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool) { + // skip revision 0 to mimic the official svn client behavior + if (revision == 0) + return NULL; + CommitSummaryFetcher* pThis = (CommitSummaryFetcher*)baton; CommitSummary summary; @@ -124,8 +130,7 @@ Modification mod; mod.mFilePath = path; - if (mod.mFilePath.startsWith(pThis->mWcPath)) - mod.mFilePath.remove(0, pThis->mWcPath.length()); + removePrefixNoCase(mod.mFilePath, pThis->mRepoUrl); mod.mNewRevision = Revision::committed(revision); mod.mOldRevision = Revision::committed(revision-1); @@ -173,7 +178,9 @@ mod.mType = Modification::Type_New; break; case svn_wc_status_added: - mod.mFilePath = path; + if (status->copied) + mod.mHistoryFilePath = status->entry->copyfrom_url; + mod.mType = Modification::Type_Add; break; @@ -215,14 +222,12 @@ mod.mNewRevision = Revision::uncommitted(); mod.mFilePath = path; - if (mod.mFilePath.startsWith(pThis->mWcPath)) - mod.mFilePath.remove(0, pThis->mWcPath.length()); + removePrefixNoCase(mod.mFilePath, pThis->mWcPath); + removePrefixNoCase(mod.mHistoryFilePath, pThis->mRepoUrl); // Set old revision to base, if the file is already under version control if (status->entry) mod.mOldRevision = Revision::base(); -// else -// mod.mOldRevision = Revision::unknown(); // Assume that if we're here (i.e. checking WC status) that we're only retrieving one revision GSVN_ASSERT(pThis->mSummaries.size() == 1); Modified: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/src/svn/helpers.cpp 2006-12-20 23:34:35 UTC (rev 116) @@ -50,7 +50,20 @@ while (pWorkingError) { sErrorMsg += QString(pWorkingError->message) + "\n"; + pWorkingError = pWorkingError->child; } return sErrorMsg.trimmed(); } + +bool Svn::removePrefixNoCase(QString& rString, QString prefix) +{ + if (rString.startsWith(prefix, Qt::CaseInsensitive)) + { + rString.remove(0, prefix.length()); + return true; + } + + return false; +} + Modified: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp 2006-12-20 17:37:36 UTC (rev 115) +++ trunk/src/svn/operation.cpp 2006-12-20 23:34:35 UTC (rev 116) @@ -85,7 +85,7 @@ class SvnInfo { public: - bool getRepoCheckoutUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError) + bool getRepoUrls(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelCheckoutPath, QString& rRepoUrlWithPath, QString& rError) { const char* fullCanonPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); svn_error_t* pError = svn_client_info(fullCanonPath, NULL, NULL, infoCallback, this, false, ctx, rContext.getAprPool()); @@ -94,7 +94,8 @@ rError = Svn::formatSvnErrorMessage(pError); return false; } - rRelPath = mRelativeRepoUrl; + rRelCheckoutPath = mRelativeRepoUrl; + rRepoUrlWithPath = mRepoUrlWithPath; return true; } @@ -109,18 +110,29 @@ if (!sRepoUrl.startsWith(sRootUrl)) return svn_error_create(SVN_ERR_INCOMPLETE_DATA, NULL, "Invalid repository information."); + pThis->mRepoUrlWithPath = sRepoUrl; + sRepoUrl.remove(0, sRootUrl.length()); pThis->mRelativeRepoUrl = sRepoUrl; return NULL; } QString mRelativeRepoUrl; + QString mRepoUrlWithPath; }; bool Operation::getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError) { SvnInfo info; - return info.getRepoCheckoutUrl(rContext, fullRepoPath, ctx, rRelPath, rError); + QString ignored; + return info.getRepoUrls(rContext, fullRepoPath, ctx, rRelPath, ignored, rError); } +bool Operation::getRepoUrlWithPath(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError) +{ + SvnInfo info; + QString ignored; + return info.getRepoUrls(rContext, fullRepoPath, ctx, ignored, rRelPath, rError); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-21 17:47:25
|
Revision: 118 http://svn.sourceforge.net/grandmas-svn/?rev=118&view=rev Author: matthiasmiller Date: 2006-12-21 09:47:20 -0800 (Thu, 21 Dec 2006) Log Message: ----------- CommitSummaryThread now includes the commit summaries when it emits the fetchedSummaries signal. (This is safe because QLists use implicit sharing.) Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/svn/commit_summary_thread.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/commit_summary_thread.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-12-20 23:37:12 UTC (rev 117) +++ trunk/include/dialogs/mainwindow.h 2006-12-21 17:47:20 UTC (rev 118) @@ -56,9 +56,9 @@ void add(); void move(); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); - void fetchedCommittedRevisions(); + void fetchedCommittedRevisions(QList<Svn::CommitSummary> summaries); void fetchCommittedRevisionsFailed(QString error); - void fetchedModifications(); + void fetchedModifications(QList<Svn::CommitSummary> summaries); void fetchModificationsFailed(QString error); private: Modified: trunk/include/svn/commit_summary_thread.h =================================================================== --- trunk/include/svn/commit_summary_thread.h 2006-12-20 23:37:12 UTC (rev 117) +++ trunk/include/svn/commit_summary_thread.h 2006-12-21 17:47:20 UTC (rev 118) @@ -21,10 +21,8 @@ #include <QMutex> #include <QThread> -namespace Svn -{ - class CommitSummary; -}; +#include "svn/commit_summary.h" + class Revision; class SvnOperationStatusUnimpl; @@ -38,12 +36,11 @@ // The caller should connect to the fetchedSummaries signal to receive the results. Any pending requests will be cancelled. void fetchSummaries(QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications); - void getSummaries(QList<Svn::CommitSummary>& rSummaries); void cancel(); signals: - void fetchedSummaries(); + void fetchedSummaries(QList<Svn::CommitSummary> summaries); void failed(QString error); private: @@ -54,5 +51,4 @@ SvnOperationStatusUnimpl* mpStatus; QMutex mMutex; Parms* mpParms; - QList<Svn::CommitSummary> mSummaries; }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-20 23:37:12 UTC (rev 117) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-21 17:47:20 UTC (rev 118) @@ -47,11 +47,11 @@ mPath = path; mpCommitSummaryThread = new CommitSummaryFetcherThread; - connect(mpCommitSummaryThread, SIGNAL(fetchedSummaries()), this, SLOT(fetchedCommittedRevisions())); + connect(mpCommitSummaryThread, SIGNAL(fetchedSummaries(QList<Svn::CommitSummary>)), this, SLOT(fetchedCommittedRevisions(QList<Svn::CommitSummary>))); connect(mpCommitSummaryThread, SIGNAL(failed(QString)), this, SLOT(fetchCommittedRevisionsFailed(QString))); mpModificationsThread = new CommitSummaryFetcherThread; - connect(mpModificationsThread, SIGNAL(fetchedSummaries()), this, SLOT(fetchedModifications())); + connect(mpModificationsThread, SIGNAL(fetchedSummaries(QList<Svn::CommitSummary>)), this, SLOT(fetchedModifications(QList<Svn::CommitSummary>))); connect(mpModificationsThread, SIGNAL(failed(QString)), this, SLOT(fetchModificationsFailed(QString))); mpUi = new Ui_MainWindow(); @@ -306,10 +306,8 @@ } } -void MainWindow::fetchedCommittedRevisions() +void MainWindow::fetchedCommittedRevisions(QList<Svn::CommitSummary> summaries) { - QList<Svn::CommitSummary> summaries; - mpCommitSummaryThread->getSummaries(summaries); mpRevisionsModel->showCommittedRevisions(summaries); } @@ -318,10 +316,8 @@ qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); } -void MainWindow::fetchedModifications() +void MainWindow::fetchedModifications(QList<Svn::CommitSummary> summaries) { - QList<Svn::CommitSummary> summaries; - mpModificationsThread->getSummaries(summaries); GSVN_ASSERT(summaries.count() == 1); mpModificationsModel->showModifications(summaries.at(0).modifications(), true); } Modified: trunk/src/svn/commit_summary_thread.cpp =================================================================== --- trunk/src/svn/commit_summary_thread.cpp 2006-12-20 23:37:12 UTC (rev 117) +++ trunk/src/svn/commit_summary_thread.cpp 2006-12-21 17:47:20 UTC (rev 118) @@ -22,6 +22,8 @@ #include "svn/commit_summary.h" #include "svn/revision.h" +#include <QMetaType> + struct CommitSummaryFetcherThread::Parms { QString mFullRepoPath; @@ -60,13 +62,6 @@ start(); } -void CommitSummaryFetcherThread::getSummaries(QList<Svn::CommitSummary>& rSummaries) -{ - mMutex.lock(); - rSummaries = mSummaries; - mMutex.unlock(); -} - void CommitSummaryFetcherThread::cancel() { if (isRunning()) @@ -94,11 +89,8 @@ QString error; if (fetcher.fetchSummaries(context, parms.mFullRepoPath, parms.mStartRevision, parms.mEndRevision, parms.mFetchModifications, summaries, error)) { - mMutex.lock(); - mSummaries = summaries; - mMutex.unlock(); - - emit fetchedSummaries(); + qRegisterMetaType<QList<Svn::CommitSummary> >("QList<Svn::CommitSummary>"); + emit fetchedSummaries(summaries); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-21 17:51:34
|
Revision: 119 http://svn.sourceforge.net/grandmas-svn/?rev=119&view=rev Author: matthiasmiller Date: 2006-12-21 09:51:30 -0800 (Thu, 21 Dec 2006) Log Message: ----------- Don't use constant references to QLists. (They're implicitly shared.) Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/include/settings/userpaths.h trunk/include/svn/commit_summary.h trunk/src/dialogs/modificationsmodel.cpp trunk/src/settings/userpaths.cpp trunk/tests/svn_test.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/include/dialogs/modificationsmodel.h 2006-12-21 17:51:30 UTC (rev 119) @@ -30,7 +30,7 @@ virtual ~ModificationsModel(); void showError(QString error); - void showModifications(const QList<Modification>& rcModifications, bool includeUnversionedMods); + void showModifications(QList<Modification> modifications, bool includeUnversionedMods); bool getModificationForRow(int row, Modification& rModification) const; Modified: trunk/include/settings/userpaths.h =================================================================== --- trunk/include/settings/userpaths.h 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/include/settings/userpaths.h 2006-12-21 17:51:30 UTC (rev 119) @@ -45,7 +45,7 @@ bool operator<(const WorkingCopy& rcOther) const; static void load(QSettings* pSettings, QList<WorkingCopy>& rWorkingCopies); - static void save(QSettings* pSettings, const QList<WorkingCopy>& rcWorkingCopies); + static void save(QSettings* pSettings, QList<WorkingCopy> workingCopies); static void sort(QList<WorkingCopy>& rWorkingCopies); private: Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/include/svn/commit_summary.h 2006-12-21 17:51:30 UTC (rev 119) @@ -49,7 +49,7 @@ Revision getRevision() const { return mRevision; } // This function may be called for working copy revision - const QList<Modification>& modifications() const { return mModifications; } + QList<Modification> modifications() const { return mModifications; } protected: friend class CommitSummaryFetcher; Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 17:51:30 UTC (rev 119) @@ -62,10 +62,10 @@ emit layoutChanged(); } -void ModificationsModel::showModifications(const QList<Modification>& rcModifications, bool includeUnversionedMods) +void ModificationsModel::showModifications(QList<Modification> modifications, bool includeUnversionedMods) { mError = QString(); - mAllModifications = rcModifications; + mAllModifications = modifications; // filter unversioned modifications if (!includeUnversionedMods) Modified: trunk/src/settings/userpaths.cpp =================================================================== --- trunk/src/settings/userpaths.cpp 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/src/settings/userpaths.cpp 2006-12-21 17:51:30 UTC (rev 119) @@ -66,13 +66,13 @@ sort(rWorkingCopies); } -void UserPathsModel::WorkingCopy::save(QSettings* pSettings, const QList<WorkingCopy>& rcWorkingCopies) +void UserPathsModel::WorkingCopy::save(QSettings* pSettings, QList<WorkingCopy> workingCopies) { pSettings->beginWriteArray("WorkingCopies"); - for (int wc = 0; wc < rcWorkingCopies.size(); wc++) + for (int wc = 0; wc < workingCopies.size(); wc++) { pSettings->setArrayIndex(wc); - pSettings->setValue("Path", rcWorkingCopies.at(wc).getPath()); + pSettings->setValue("Path", workingCopies.at(wc).getPath()); } pSettings->endArray(); } Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-21 17:47:20 UTC (rev 118) +++ trunk/tests/svn_test.cpp 2006-12-21 17:51:30 UTC (rev 119) @@ -242,7 +242,7 @@ rev = Revision::committed(1); GSVN_VERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); - const QList<Modification>& mods = summary.modifications(); + QList<Modification> mods = summary.modifications(); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/first.txt")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-21 18:33:09
|
Revision: 120 http://svn.sourceforge.net/grandmas-svn/?rev=120&view=rev Author: matthiasmiller Date: 2006-12-21 10:32:59 -0800 (Thu, 21 Dec 2006) Log Message: ----------- checked/unchecked modifications can now simply be tracked with a single path Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-12-21 17:51:30 UTC (rev 119) +++ trunk/include/dialogs/modificationsmodel.h 2006-12-21 18:32:59 UTC (rev 120) @@ -54,10 +54,8 @@ bool isTypeColumn(int col) const; bool isPathColumn(int col) const; - struct DeclinedMod; - QString mError; QList<Modification> mAllModifications; - QList<DeclinedMod> mDeclinedModifications; + QList<QString> mDeclinedPaths; bool mAllowSelections; }; Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 17:51:30 UTC (rev 119) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 18:32:59 UTC (rev 120) @@ -25,27 +25,6 @@ #include <QSize> -struct ModificationsModel::DeclinedMod -{ - QString mPath; - - bool operator==(const DeclinedMod& other) const - { - return mPath == other.mPath; - } - bool operator!=(const DeclinedMod& other) const - { - return !(*this == other); - } - - static DeclinedMod fromSvnMod(const Modification& mod) - { - DeclinedMod declinedMod = { mod.getFilePath() }; - return declinedMod; - } -}; - - ModificationsModel::ModificationsModel() : mAllowSelections(false) { } @@ -181,7 +160,7 @@ { if (isCheckboxColumn(rcIndex.column())) { - if (mDeclinedModifications.contains(DeclinedMod::fromSvnMod(mod))) + if (mDeclinedPaths.contains(mod.getFilePath())) return Qt::Unchecked; else return Qt::Checked; @@ -198,17 +177,17 @@ if (isCheckboxColumn(rcIndex.column()) && rcValue.canConvert(QVariant::Bool) && rcIndex.isValid() && rcIndex.row() < mAllModifications.size()) { - DeclinedMod mod = DeclinedMod::fromSvnMod(mAllModifications.at(rcIndex.row())); + QString path = mAllModifications.at(rcIndex.row()).getFilePath(); if (rcValue.toBool()) { // remove from list of declined mods - mDeclinedModifications.removeAll(mod); + mDeclinedPaths.removeAll(path); } else { // add to the list of declined modifications - if (!mDeclinedModifications.contains(mod)) - mDeclinedModifications.push_back(mod); + if (!mDeclinedPaths.contains(path)) + mDeclinedPaths.push_back(path); } return true; @@ -242,7 +221,7 @@ QList<Modification> modifications; Q_FOREACH(Modification mod, mAllModifications) { - if (!mDeclinedModifications.contains(DeclinedMod::fromSvnMod(mod))) + if (!mDeclinedPaths.contains(mod.getFilePath())) modifications.push_back(mod); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-21 22:37:07
|
Revision: 123 http://svn.sourceforge.net/grandmas-svn/?rev=123&view=rev Author: matthiasmiller Date: 2006-12-21 14:37:08 -0800 (Thu, 21 Dec 2006) Log Message: ----------- * maintain correct selection when modifications are refreshed * make the commit dialog responsible for removing unversioned modifications (instead of the model) Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-12-21 20:44:17 UTC (rev 122) +++ trunk/include/dialogs/modificationsmodel.h 2006-12-21 22:37:08 UTC (rev 123) @@ -30,7 +30,7 @@ virtual ~ModificationsModel(); void showError(QString error); - void showModifications(QList<Modification> modifications, bool includeUnversionedMods); + void showModifications(QList<Modification> modifications); bool getModificationForRow(int row, Modification& rModification) const; Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-12-21 20:44:17 UTC (rev 122) +++ trunk/src/dialogs/commit.cpp 2006-12-21 22:37:08 UTC (rev 123) @@ -125,7 +125,18 @@ Svn::CommitSummaryFetcher fetcher; QString error; if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), true, summary, error)) - mpModificationsModel->showModifications(summary.modifications(), false); + { + // remove unversioned mods + QList<Modification> unversionedMods = summary.modifications(); + QMutableListIterator<Modification> i(unversionedMods); + while (i.hasNext()) + { + if (!Modification::isVersionedType(i.next().getType())) + i.remove(); + } + + mpModificationsModel->showModifications(summary.modifications()); + } else mpModificationsModel->showError(error); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-21 20:44:17 UTC (rev 122) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-21 22:37:08 UTC (rev 123) @@ -277,7 +277,7 @@ void MainWindow::reloadModifications() { // Update immediately for all revisions, then post a background request to refresh uncommitted modifications. - mpModificationsModel->showModifications(mDisplayedCommitSummary.modifications(), true); + mpModificationsModel->showModifications(mDisplayedCommitSummary.modifications()); Revision rev = mDisplayedCommitSummary.getRevision(); if (rev.getType() == Revision::Uncommitted) @@ -319,7 +319,7 @@ void MainWindow::fetchedModifications(QList<Svn::CommitSummary> summaries) { GSVN_ASSERT(summaries.count() == 1); - mpModificationsModel->showModifications(summaries.at(0).modifications(), true); + mpModificationsModel->showModifications(summaries.at(0).modifications()); } void MainWindow::fetchModificationsFailed(QString error) Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 20:44:17 UTC (rev 122) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-21 22:37:08 UTC (rev 123) @@ -41,23 +41,60 @@ emit layoutChanged(); } -void ModificationsModel::showModifications(QList<Modification> modifications, bool includeUnversionedMods) +void ModificationsModel::showModifications(QList<Modification> modifications) { - mError = QString(); - mAllModifications = modifications; + if (!mError.isEmpty()) + { + mError = QString(); + mAllModifications = modifications; + reset(); + return; + } - // filter unversioned modifications - if (!includeUnversionedMods) + // remove all obsolete modifications + for (int i = mAllModifications.size()-1; i >= 0; i--) { - QMutableListIterator<Modification> i(mAllModifications); - while (i.hasNext()) + bool shouldKeepMod = false; + Q_FOREACH(Modification mod, modifications) { - if (!Modification::isVersionedType(i.next().getType())) - i.remove(); + if (mod.getFilePath() == mAllModifications[i].getFilePath()) + { + shouldKeepMod = true; + break; + } } + + if (!shouldKeepMod) + { + qDebug(tr("remove %1 at %2").arg(mAllModifications.at(i).getFilePath()).arg(i).toAscii()); + beginRemoveRows(QModelIndex(), i, i); + mAllModifications.removeAt(i); + endRemoveRows(); + } } + GSVN_ASSERT(mAllModifications.size() <= modifications.size()); - emit layoutChanged(); + // add new modifications -- NOTE: This assumes that the caller will give modifications + // in a consistent order. Otherwise, selection may be lost. + for (int i = 0; i < modifications.size(); i++) + { + if (i < mAllModifications.size() && mAllModifications[i].getFilePath() == modifications[i].getFilePath()) + { + // update modification if paths match + mAllModifications[i] = modifications[i]; + emit dataChanged(index(i,0), index(i,columnCount())); + } + else + { + qDebug(tr("insert %1 at %2").arg(modifications.at(i).getFilePath()).arg(i).toAscii()); + + // insert new modification + beginInsertRows(QModelIndex(), i, i); + mAllModifications.insert(i, modifications[i]); + endInsertRows(); + } + } + GSVN_ASSERT(mAllModifications.size() == modifications.size()); } bool ModificationsModel::getModificationForRow(int row, Modification& rModification) const This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 17:06:18
|
Revision: 130 http://svn.sourceforge.net/grandmas-svn/?rev=130&view=rev Author: matthiasmiller Date: 2006-12-22 09:06:17 -0800 (Fri, 22 Dec 2006) Log Message: ----------- add helper functions to sort commit summaries by revision Modified Paths: -------------- trunk/grandmas_svn.pro trunk/tests/tests.cpp Added Paths: ----------- trunk/include/commit_summary_sort.h trunk/src/commit_summary_sort.cpp trunk/tests/commit_summary_sort_test.cpp trunk/tests/commit_summary_sort_test.h Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-22 15:15:46 UTC (rev 129) +++ trunk/grandmas_svn.pro 2006-12-22 17:06:17 UTC (rev 130) @@ -187,6 +187,7 @@ RC_FILE = ui/icons/win32.rc HEADERS += include/commandline.h \ + include/commit_summary_sort.h \ include/debug.h \ include/dialogs/authentication.h \ include/dialogs/commit.h \ @@ -217,6 +218,7 @@ src/grandmas_svn.h SOURCES += src/commandline.cpp \ + src/commit_summary_sort.cpp \ src/debug.cpp \ src/dialogs/authentication.cpp \ src/dialogs/commit.cpp \ @@ -254,10 +256,12 @@ contains(DEFINES, GSVN_TESTS) { CONFIG += qtestlib HEADERS += tests/commandlinetest.h \ + tests/commit_summary_sort_test.h \ tests/nullable_test.h \ tests/svn_test.h \ tests/tests.h SOURCES += tests/commandlinetest.cpp \ + tests/commit_summary_sort_test.cpp \ tests/nullable_test.cpp \ tests/svn_test.cpp \ tests/tests.cpp Added: trunk/include/commit_summary_sort.h =================================================================== --- trunk/include/commit_summary_sort.h (rev 0) +++ trunk/include/commit_summary_sort.h 2006-12-22 17:06:17 UTC (rev 130) @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QList> + +class Revision; +namespace Svn +{ + class CommitSummary; +} + +// "less than" means "earlier than" +bool isRevisionLessThan(const Revision& rLeft, const Revision& rRight); + +bool isRevisionInRange(Revision rev, Revision min, Revision max); + +namespace CommitSummaryFinder +{ + // This function returns the revisions from latest-to-earliest. The list of revisions must + // have been ordered by this function. + bool findByRevision(QList<Svn::CommitSummary> summaries, const Revision& rRev, int& rIndex); +} Added: trunk/src/commit_summary_sort.cpp =================================================================== --- trunk/src/commit_summary_sort.cpp (rev 0) +++ trunk/src/commit_summary_sort.cpp 2006-12-22 17:06:17 UTC (rev 130) @@ -0,0 +1,89 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "commit_summary_sort.h" + +#include "svn/commit_summary.h" +#include "svn/revision.h" + +namespace +{ + int getRevisionTypeNumber(Revision::Type type) + { + switch (type) + { + case Revision::Uncommitted: return 2; + case Revision::Committed: return 0; + case Revision::Base: return 1; + case Revision::Head: return 3; + default: + GSVN_ASSERT(false); + return 0; + } + } +} + +bool isRevisionLessThan(const Revision& rLeft, const Revision& rRight) +{ + // Compare types first. + int leftTypeSort = getRevisionTypeNumber(rLeft.getType()); + int rightTypeSort = getRevisionTypeNumber(rRight.getType()); + if (leftTypeSort < rightTypeSort) + return true; + else if (leftTypeSort > rightTypeSort) + return false; + + // The types must match. Reverse-sort by revision number. + return (rLeft.getType() == Revision::Committed && + rLeft.getCommittedRevision() < rRight.getCommittedRevision()); +} + +bool isRevisionInRange(Revision rev, Revision min, Revision max) +{ + if (isRevisionLessThan(max, min)) + return isRevisionInRange(rev, max, min); + + return !isRevisionLessThan(rev, min) && !isRevisionLessThan(max, rev); +} + +namespace +{ + class CommitSummaryRevisionLessThan + { + public: + inline bool CommitSummaryRevisionLessThan::operator()(const Svn::CommitSummary& rLeft, const Svn::CommitSummary& rRight) const + { + return isRevisionLessThan(rRight.getRevision(), rLeft.getRevision()); + } + + inline bool CommitSummaryRevisionLessThan::operator()(const Svn::CommitSummary& rLeft, const Revision& rRight) const + { + return isRevisionLessThan(rRight, rLeft.getRevision()); + } + }; +} + +bool CommitSummaryFinder::findByRevision(QList<Svn::CommitSummary> summaries, const Revision& rRev, int& rIndex) +{ + CommitSummaryRevisionLessThan lessThan; + QList<Svn::CommitSummary>::iterator iter = qLowerBound(summaries.begin(), summaries.end(), rRev, lessThan); + rIndex = (iter - summaries.begin()); + return iter != summaries.end() && iter->getRevision() == rRev; +} Added: trunk/tests/commit_summary_sort_test.cpp =================================================================== --- trunk/tests/commit_summary_sort_test.cpp (rev 0) +++ trunk/tests/commit_summary_sort_test.cpp 2006-12-22 17:06:17 UTC (rev 130) @@ -0,0 +1,81 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "commit_summary_sort_test.h" + +#include "commit_summary_sort.h" +#include "svn/revision.h" + +#include <QtTest/QtTest> + +void CommitSummarySortTester::testRevisionCompareUncommitted() +{ + Revision rev = Revision::uncommitted(); + QVERIFY(!isRevisionLessThan(rev, Revision::uncommitted())); + QVERIFY(!isRevisionLessThan(rev, Revision::base())); + QVERIFY(isRevisionLessThan(rev, Revision::head())); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(0))); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(42))); +} + +void CommitSummarySortTester::testRevisionCompareCommitted() +{ + Revision rev = Revision::committed(7); + QVERIFY(isRevisionLessThan(rev, Revision::uncommitted())); + QVERIFY(isRevisionLessThan(rev, Revision::base())); + QVERIFY(isRevisionLessThan(rev, Revision::head())); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(0))); + QVERIFY(isRevisionLessThan(rev, Revision::committed(42))); +} + +void CommitSummarySortTester::testRevisionCompareBase() +{ + Revision rev = Revision::base(); + QVERIFY(isRevisionLessThan(rev, Revision::uncommitted())); + QVERIFY(!isRevisionLessThan(rev, Revision::base())); + QVERIFY(isRevisionLessThan(rev, Revision::head())); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(0))); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(42))); +} + +void CommitSummarySortTester::testRevisionCompareHead() +{ + Revision rev = Revision::head(); + QVERIFY(!isRevisionLessThan(rev, Revision::uncommitted())); + QVERIFY(!isRevisionLessThan(rev, Revision::base())); + QVERIFY(!isRevisionLessThan(rev, Revision::head())); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(0))); + QVERIFY(!isRevisionLessThan(rev, Revision::committed(42))); +} + +void CommitSummarySortTester::testRevisionRange() +{ + QVERIFY(isRevisionInRange(Revision::committed(0), Revision::committed(0), Revision::committed(0))); + QVERIFY(isRevisionInRange(Revision::committed(1), Revision::committed(0), Revision::committed(1))); + QVERIFY(isRevisionInRange(Revision::committed(1), Revision::committed(0), Revision::committed(2))); + QVERIFY(!isRevisionInRange(Revision::committed(0), Revision::committed(1), Revision::committed(2))); + QVERIFY(!isRevisionInRange(Revision::committed(3), Revision::committed(1), Revision::committed(2))); +} + +void CommitSummarySortTester::testRevisionRangeMaxMin() +{ + // should switch min/max appropriately + QVERIFY(isRevisionInRange(Revision::committed(7), Revision::committed(42), Revision::committed(0))); +} Added: trunk/tests/commit_summary_sort_test.h =================================================================== --- trunk/tests/commit_summary_sort_test.h (rev 0) +++ trunk/tests/commit_summary_sort_test.h 2006-12-22 17:06:17 UTC (rev 130) @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QObject> + +class CommitSummarySortTester : public QObject +{ + Q_OBJECT +private slots: + void testRevisionCompareUncommitted(); + void testRevisionCompareCommitted(); + void testRevisionCompareBase(); + void testRevisionCompareHead(); + void testRevisionRange(); + void testRevisionRangeMaxMin(); +}; Modified: trunk/tests/tests.cpp =================================================================== --- trunk/tests/tests.cpp 2006-12-22 15:15:46 UTC (rev 129) +++ trunk/tests/tests.cpp 2006-12-22 17:06:17 UTC (rev 130) @@ -20,6 +20,7 @@ #include "tests.h" #include "commandlinetest.h" +#include "commit_summary_sort_test.h" #include "nullable_test.h" #include "svn_test.h" @@ -38,6 +39,7 @@ { int result = 0; TEST(CommandLineTest); + TEST(CommitSummarySortTester); TEST(NullableTester); TEST(SvnTester); return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 17:29:51
|
Revision: 131 http://svn.sourceforge.net/grandmas-svn/?rev=131&view=rev Author: matthiasmiller Date: 2006-12-22 09:29:51 -0800 (Fri, 22 Dec 2006) Log Message: ----------- create an interface for caching commit summaries Modified Paths: -------------- trunk/grandmas_svn.pro Added Paths: ----------- trunk/include/commit_summary_cache.h trunk/src/commit_summary_cache.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-22 17:06:17 UTC (rev 130) +++ trunk/grandmas_svn.pro 2006-12-22 17:29:51 UTC (rev 131) @@ -187,6 +187,7 @@ RC_FILE = ui/icons/win32.rc HEADERS += include/commandline.h \ + include/commit_summary_cache.h \ include/commit_summary_sort.h \ include/debug.h \ include/dialogs/authentication.h \ @@ -218,6 +219,7 @@ src/grandmas_svn.h SOURCES += src/commandline.cpp \ + src/commit_summary_cache.cpp \ src/commit_summary_sort.cpp \ src/debug.cpp \ src/dialogs/authentication.cpp \ Added: trunk/include/commit_summary_cache.h =================================================================== --- trunk/include/commit_summary_cache.h (rev 0) +++ trunk/include/commit_summary_cache.h 2006-12-22 17:29:51 UTC (rev 131) @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <QObject> + +#include "svn/commit_summary.h" + +class CommitSummaryFetcherThread; +class Revision; + +class CommitSummaryCache : public QObject +{ + Q_OBJECT +public: + CommitSummaryCache(QString fullRepoPath); + ~CommitSummaryCache(); + + void fetchSummariesSync(Revision startRevision, Revision endRevision); + void fetchSummariesAsync(Revision startRevision, Revision endRevision); + + QList<Svn::CommitSummary> getCommitSummaries() const; + Svn::CommitSummary getCommitSummary(Revision rev) const; + bool didLastFetchSucceed(Revision rev, QString& rError) const; + +signals: + void beforeCommitSummaryAdded(Revision rev); + void afterCommitSummaryAdded(Revision rev); + void beforeCommitSummaryChanged(Revision rev); + void afterCommitSummaryChanged(Revision rev); + void fetchFailed(Revision startRevision, Revision endRevision, QString error); + +private slots: + void fetchedCommitSummaries(QString fullRepoPath, QList<Svn::CommitSummary> summaries); + void fetchCommitSummariesFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error); + +private: + QString mFullRepoPath; + CommitSummaryFetcherThread* mpThread; + QList<Svn::CommitSummary> mCommitSummaries; + struct FetchResult; + QList<FetchResult> mFetchResults; +}; Added: trunk/src/commit_summary_cache.cpp =================================================================== --- trunk/src/commit_summary_cache.cpp (rev 0) +++ trunk/src/commit_summary_cache.cpp 2006-12-22 17:29:51 UTC (rev 131) @@ -0,0 +1,141 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "commit_summary_cache.h" + +#include "commit_summary_sort.h" +#include "svn/commit_summary_thread.h" +#include "svn/revision.h" + +struct CommitSummaryCache::FetchResult +{ + Revision mStartRevision, mEndRevision; + bool mSuccess; + QString mError; +}; + + +CommitSummaryCache::CommitSummaryCache(QString fullRepoPath) +{ + mFullRepoPath = fullRepoPath; + + mpThread = new CommitSummaryFetcherThread; + connect(mpThread, SIGNAL(fetchedSummaries(QString,QList<Svn::CommitSummary>)), + this, SLOT(fetchedCommitSummaries(QString,QList<Svn::CommitSummary>))); + connect(mpThread, SIGNAL(failed(QString,Revision,Revision,QString)), + this, SLOT(fetchCommitSummariesFailed(QString,Revision,Revision,QString))); +} + +CommitSummaryCache::~CommitSummaryCache() +{ + mpThread->stop(); + delete mpThread; + mpThread = NULL; +} + +void CommitSummaryCache::fetchSummariesSync(Revision startRevision, Revision endRevision) +{ + return mpThread->fetchSummariesSync(mFullRepoPath, startRevision, endRevision); +} + +void CommitSummaryCache::fetchSummariesAsync(Revision startRevision, Revision endRevision) +{ + mpThread->fetchSummariesAsync(mFullRepoPath, startRevision, endRevision); +} + +QList<Svn::CommitSummary> CommitSummaryCache::getCommitSummaries() const +{ + return mCommitSummaries; +} + +Svn::CommitSummary CommitSummaryCache::getCommitSummary(Revision rev) const +{ + int index = -1; + if (!CommitSummaryFinder::findByRevision(mCommitSummaries, rev, index)) + { + GSVN_ASSERT(false); + return Svn::CommitSummary(); + } + + return mCommitSummaries.at(index); +} + +bool CommitSummaryCache::didLastFetchSucceed(Revision rev, QString& rError) const +{ + rError = QString(); + + Q_FOREACH(FetchResult result, mFetchResults) + { + if (isRevisionInRange(rev, result.mStartRevision, result.mEndRevision)) + { + rError = result.mError; + return result.mSuccess; + } + } + + GSVN_ASSERT(false); + return false; +} + +void CommitSummaryCache::fetchedCommitSummaries(QString fullRepoPath, QList<Svn::CommitSummary> summaries) +{ + Q_UNUSED(fullRepoPath); + + if (summaries.size() > 0) + { + FetchResult result; + result.mStartRevision = summaries.first().getRevision(); + result.mEndRevision = summaries.last().getRevision(); + result.mSuccess = true; + result.mError = QString(); + mFetchResults.push_front(result); + } + + Q_FOREACH(Svn::CommitSummary summary, summaries) + { + int index = -1; + if (CommitSummaryFinder::findByRevision(mCommitSummaries, summary.getRevision(), index)) + { + emit beforeCommitSummaryChanged(summary.getRevision()); + mCommitSummaries[index] = summary; + emit afterCommitSummaryChanged(summary.getRevision()); + } + else + { + emit beforeCommitSummaryAdded(summary.getRevision()); + mCommitSummaries.insert(index, summary); + emit afterCommitSummaryAdded(summary.getRevision()); + } + } +} + +void CommitSummaryCache::fetchCommitSummariesFailed(QString fullRepoPath, Revision startRevision, + Revision endRevision, QString error) +{ + Q_UNUSED(fullRepoPath); + + FetchResult result; + result.mStartRevision = startRevision; + result.mEndRevision = endRevision; + result.mSuccess = false; + result.mError = error; + mFetchResults.push_front(result); + + emit fetchFailed(startRevision, endRevision, error); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 17:57:14
|
Revision: 133 http://svn.sourceforge.net/grandmas-svn/?rev=133&view=rev Author: matthiasmiller Date: 2006-12-22 09:57:10 -0800 (Fri, 22 Dec 2006) Log Message: ----------- start compiling with MSVC's highest warning level Modified Paths: -------------- trunk/grandmas_svn.pro trunk/src/svn/revision.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-22 17:39:45 UTC (rev 132) +++ trunk/grandmas_svn.pro 2006-12-22 17:57:10 UTC (rev 133) @@ -150,6 +150,12 @@ # This is already defined in APR's header. DEFINES -= _CRT_SECURE_NO_DEPRECATE + + # Compile with warning level 4. Suppress the warnings that occur in Qt source code. + QMAKE_CFLAGS_WARN_ON = -W4 + QMAKE_CFLAGS_WARN_ON += -wd4127 # suppress warning: "conditional expression is constant" + QMAKE_CFLAGS_WARN_ON += -wd4512 # suppress warning: "assignment operator could not be generated" + QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON } # must set debug/release configuration immediately since it affects output directories. Modified: trunk/src/svn/revision.cpp =================================================================== --- trunk/src/svn/revision.cpp 2006-12-22 17:39:45 UTC (rev 132) +++ trunk/src/svn/revision.cpp 2006-12-22 17:57:10 UTC (rev 133) @@ -58,8 +58,6 @@ default: return uncommitted(); } - GSVN_ASSERT(false); - return uncommitted(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 18:01:03
|
Revision: 134 http://svn.sourceforge.net/grandmas-svn/?rev=134&view=rev Author: matthiasmiller Date: 2006-12-22 10:01:02 -0800 (Fri, 22 Dec 2006) Log Message: ----------- clean up some gcc warnings Modified Paths: -------------- trunk/src/dialogs/mainwindow.cpp trunk/tests/svn_test.cpp Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-22 17:57:10 UTC (rev 133) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-22 18:01:02 UTC (rev 134) @@ -299,16 +299,22 @@ void MainWindow::fetchedCommittedRevisions(QString fullRepoPath, QList<Svn::CommitSummary> summaries) { + Q_UNUSED(fullRepoPath); mpRevisionsModel->showCommittedRevisions(summaries); } void MainWindow::fetchCommittedRevisionsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error) { + Q_UNUSED(fullRepoPath); + Q_UNUSED(startRevision); + Q_UNUSED(endRevision); qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); } void MainWindow::fetchedModifications(QString fullRepoPath, QList<Svn::CommitSummary> summaries) { + Q_UNUSED(fullRepoPath); + GSVN_ASSERT(summaries.count() == 1); // Save the new modifications if showing an uncommitted revision to prevent @@ -324,6 +330,9 @@ void MainWindow::fetchModificationsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error) { + Q_UNUSED(fullRepoPath); + Q_UNUSED(startRevision); + Q_UNUSED(endRevision); mpModificationsModel->showError(error); } Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-22 17:57:10 UTC (rev 133) +++ trunk/tests/svn_test.cpp 2006-12-22 18:01:02 UTC (rev 134) @@ -51,6 +51,7 @@ return true; #else + Q_UNUSED(file); return false; //unimpl #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 19:23:50
|
Revision: 139 http://svn.sourceforge.net/grandmas-svn/?rev=139&view=rev Author: matthiasmiller Date: 2006-12-22 11:23:50 -0800 (Fri, 22 Dec 2006) Log Message: ----------- Start using the CommitSummaryCache in the modifications and revisions models. This prevents a lot of duplication of information between the main window, the modifications model, and the revisions model. This change also allows the correct revision to remain selected when new commit summaries are downloaded after an update or commit. Modified Paths: -------------- trunk/include/dialogs/commit.h trunk/include/dialogs/mainwindow.h trunk/include/dialogs/modificationsmodel.h trunk/include/dialogs/revisionsmodel.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/dialogs/revisionsmodel.cpp Modified: trunk/include/dialogs/commit.h =================================================================== --- trunk/include/dialogs/commit.h 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/include/dialogs/commit.h 2006-12-22 19:23:50 UTC (rev 139) @@ -25,6 +25,7 @@ #include <Qt> #include <QDialog> +class CommitSummaryCache; class ModificationsModel; class SvnOperationContext; class Ui_CommitDialog; @@ -49,6 +50,8 @@ Ui_CommitDialog* mpUi; + CommitSummaryCache* mpCommitSummaryCache; + SvnOperationContext* mpContext; QString mCommitMessage; QString mPath; Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/include/dialogs/mainwindow.h 2006-12-22 19:23:50 UTC (rev 139) @@ -25,7 +25,7 @@ #include "svn/commit_summary.h" #include "svn/revision.h" -class CommitSummaryFetcherThread; +class CommitSummaryCache; class ModificationsModel; class RevisionsModel; class SvnOperationContext; @@ -56,25 +56,21 @@ void add(); void move(); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); - void fetchedCommittedRevisions(QString fullRepoPath, QList<Svn::CommitSummary> summaries); - void fetchCommittedRevisionsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error); - void fetchedModifications(QString fullRepoPath, QList<Svn::CommitSummary> summaries); - void fetchModificationsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error); + void afterCommitSummaryAdded(Revision rev); private: - void reloadCommitSummaries(); - void reloadModifications(); + void reloadCommittedSummaries(); + void reloadUncommittedSummary(); + bool getSelectedCommitSummary(Svn::CommitSummary& rSummary); QList<int> getSelectedRows(QAbstractItemView* pView); QList<Modification> getSelectedModifications(); Ui_MainWindow* mpUi; SvnOperationContext* mpContext; QString mPath; + CommitSummaryCache* mpCommitSummaryCache; ModificationsModel* mpModificationsModel; - Svn::CommitSummary mDisplayedCommitSummary; RevisionsModel* mpRevisionsModel; - CommitSummaryFetcherThread* mpCommitSummaryThread; - CommitSummaryFetcherThread* mpModificationsThread; }; #endif Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/include/dialogs/modificationsmodel.h 2006-12-22 19:23:50 UTC (rev 139) @@ -17,23 +17,27 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include <QAbstractListModel> +#include "nullable.h" +#include "svn/revision.h" +class CommitSummaryCache; class Modification; -class Revision; class SvnOperationContext; class ModificationsModel : public QAbstractListModel { + Q_OBJECT public: - ModificationsModel(); + ModificationsModel(CommitSummaryCache* pCommitSummaryCache); virtual ~ModificationsModel(); - void showError(QString error); - void showModifications(QList<Modification> modifications); + void setRevision(Revision revision); + void clearRevision(); bool getModificationForRow(int row, Modification& rModification) const; - + virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; @@ -41,21 +45,34 @@ virtual bool setData(const QModelIndex& rcIndex, const QVariant& rcValue, int role); virtual Qt::ItemFlags flags(const QModelIndex& rcIndex) const; - + + void setShowUnversionedMods(bool showUnversionedMods); void setAllowSelections(bool allowSelections); QList<Modification> getSelectedModifications() const; bool hasCheckboxColumn() const; int getCheckboxColumn() const; - + private: bool isErrorColumn(int col) const; bool isCheckboxColumn(int col) const; bool isTypeColumn(int col) const; bool isPathColumn(int col) const; +private slots: + void afterCommitSummaryChanged(Revision rev); + +private: + void refresh(); + void setModifications(QList<Modification> modifications); + + CommitSummaryCache* mpCommitSummaryCache; + + Nullable<Revision> mRevision; + QString mError; QList<Modification> mAllModifications; QList<QString> mDeclinedPaths; + bool mShowUnversionedMods; bool mAllowSelections; }; Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/include/dialogs/revisionsmodel.h 2006-12-22 19:23:50 UTC (rev 139) @@ -17,24 +17,23 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + +#include "svn/revision.h" #include <QAbstractListModel> +class CommitSummaryCache; namespace Svn { class CommitSummary; }; -class Revision; class RevisionsModel : public QAbstractListModel { + Q_OBJECT public: - RevisionsModel(); + RevisionsModel(CommitSummaryCache* pCommitSummaryCache); virtual ~RevisionsModel(); - void showError(QString error); - void showUncommittedRevision(Svn::CommitSummary uncommittedRevision); - void showCommittedRevisions(QList<Svn::CommitSummary> committedRevisions); - bool getCommitSummaryForRow(int row, Svn::CommitSummary& rSummary) const; QModelIndex getUncommittedRevision() const; @@ -43,11 +42,17 @@ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex& rcIndex, int role = Qt::DisplayRole) const; +private slots: + void beforeCommitSummaryAdded(Revision rev); + void afterCommitSummaryAdded(Revision rev); + void afterCommitSummaryChanged(Revision rev); + void fetchFailed(Revision startRevision, Revision endRevision, QString error); + private: static QString getRevisionAsString(Revision rev); static QString getDateTimeAsString(QDateTime dateTime); + CommitSummaryCache* mpCommitSummaryCache; QString mError; - QList<Svn::CommitSummary> mUncommittedSummaries, mCommittedSummaries; }; Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/src/dialogs/commit.cpp 2006-12-22 19:23:50 UTC (rev 139) @@ -19,6 +19,8 @@ ***************************************************************************/ #include "dialogs/commit.h" + +#include "commit_summary_cache.h" #include "dialogs/modificationsmodel.h" #include "dialogs/progress.h" #include "dialogs/util.h" @@ -38,13 +40,16 @@ mCommitMessage = commitMessage; mPath = path; + mpCommitSummaryCache = new CommitSummaryCache(mPath); + mpUi = new Ui_CommitDialog(); mpUi->setupUi(this); #if QT_VERSION >= 0x040200 mpUi->changesTreeView->setAllColumnsShowFocus(true); #endif - mpModificationsModel = new ModificationsModel(); + mpModificationsModel = new ModificationsModel(mpCommitSummaryCache); + mpModificationsModel->setShowUnversionedMods(false); mpModificationsModel->setAllowSelections(true); mpUi->changesTreeView->setModel(mpModificationsModel); mpUi->changesTreeView->header()->setMovable(false); @@ -53,6 +58,7 @@ connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); reload(); + mpModificationsModel->setRevision(Revision::uncommitted()); #ifdef Q_WS_MAC exchangeWidgets(mpUi->hboxLayout, mpUi->commitButton, mpUi->cancelButton); @@ -67,6 +73,9 @@ delete mpUi; mpUi = NULL; + + delete mpCommitSummaryCache; + mpCommitSummaryCache = NULL; } void CommitDialog::changeEvent(QEvent* pEvent) @@ -75,7 +84,7 @@ if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) { - if (mpModificationsModel) + if (mpCommitSummaryCache) reload(); } } @@ -121,25 +130,8 @@ void CommitDialog::reload() { - Svn::CommitSummary summary; - Svn::CommitSummaryFetcher fetcher; - QString error; - if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), true, summary, error)) - { - // remove unversioned mods - QList<Modification> unversionedMods = summary.modifications(); - QMutableListIterator<Modification> i(unversionedMods); - while (i.hasNext()) - { - if (!Modification::isVersionedType(i.next().getType())) - i.remove(); - } + mpCommitSummaryCache->fetchSummariesSync(Revision::uncommitted(), Revision::uncommitted()); - mpModificationsModel->showModifications(summary.modifications()); - } - else - mpModificationsModel->showError(error); - if (mpModificationsModel->hasCheckboxColumn()) mpUi->changesTreeView->resizeColumnToContents(mpModificationsModel->getCheckboxColumn()); } Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-22 19:23:50 UTC (rev 139) @@ -20,6 +20,8 @@ #include "dialogs/mainwindow.h" + +#include "commit_summary_cache.h" #include "dialogs/authentication.h" #include "dialogs/commit.h" #include "dialogs/modificationsmodel.h" @@ -29,7 +31,6 @@ #include "diff.h" #include "svn/add.h" #include "svn/commit_summary.h" -#include "svn/commit_summary_thread.h" #include "svn/file_access.h" #include "svn/revert.h" #include "svn/revision.h" @@ -46,18 +47,10 @@ mpContext = pContext; mPath = path; - mpCommitSummaryThread = new CommitSummaryFetcherThread; - connect(mpCommitSummaryThread, SIGNAL(fetchedSummaries(QString,QList<Svn::CommitSummary>)), - this, SLOT(fetchedCommittedRevisions(QString,QList<Svn::CommitSummary>))); - connect(mpCommitSummaryThread, SIGNAL(failed(QString,Revision,Revision,QString)), - this, SLOT(fetchCommittedRevisionsFailed(QString,Revision,Revision,QString))); + mpCommitSummaryCache = new CommitSummaryCache(mPath); + connect(mpCommitSummaryCache, SIGNAL(afterCommitSummaryAdded(Revision)), + this, SLOT(afterCommitSummaryAdded(Revision))); - mpModificationsThread = new CommitSummaryFetcherThread; - connect(mpModificationsThread, SIGNAL(fetchedSummaries(QString,QList<Svn::CommitSummary>)), this, - SLOT(fetchedModifications(QString,QList<Svn::CommitSummary>))); - connect(mpModificationsThread, SIGNAL(failed(QString,Revision,Revision,QString)), - this, SLOT(fetchModificationsFailed(QString,Revision,Revision,QString))); - mpUi = new Ui_MainWindow(); mpUi->setupUi(this); #if QT_VERSION >= 0x040200 @@ -79,11 +72,11 @@ connect(mpUi->addButton, SIGNAL(clicked()), this, SLOT(add())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); - mpModificationsModel = new ModificationsModel(); + mpModificationsModel = new ModificationsModel(mpCommitSummaryCache); mpUi->changesTreeView->setModel(mpModificationsModel); mpUi->changesTreeView->header()->setMovable(false); - mpRevisionsModel = new RevisionsModel(); + mpRevisionsModel = new RevisionsModel(mpCommitSummaryCache); mpUi->revisionsTreeView->setModel(mpRevisionsModel); mpUi->revisionsTreeView->header()->setMovable(false); @@ -93,7 +86,9 @@ setWindowTitle(tr("%1 - %2").arg(QDir::convertSeparators(path)).arg(windowTitle())); - reloadCommitSummaries(); + // wait to load until the models have been instantiated + reloadUncommittedSummary(); + reloadCommittedSummaries(); } MainWindow::~MainWindow() @@ -111,14 +106,9 @@ delete mpUi; mpUi = NULL; - mpModificationsThread->stop(); - delete mpModificationsThread; - mpModificationsThread = NULL; + delete mpCommitSummaryCache; + mpCommitSummaryCache = NULL; - mpCommitSummaryThread->stop(); - delete mpCommitSummaryThread; - mpCommitSummaryThread = NULL; - mpContext = NULL; } @@ -129,8 +119,9 @@ if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) { // Refresh the modifications if it doesn't require server access. - if (mpModificationsModel && mDisplayedCommitSummary.getRevision().getType() == Revision::Uncommitted) - reloadModifications(); + Svn::CommitSummary summary; + if (getSelectedCommitSummary(summary) && summary.getRevision().getType() == Revision::Uncommitted) + reloadUncommittedSummary(); } } @@ -148,18 +139,22 @@ if (!Svn::update(*mpContext, mPath, Revision::head(), error)) QMessageBox::critical(this, "", error); mpContext->setStatus(NULL); - - reloadCommitSummaries(); + + reloadUncommittedSummary(); + reloadCommittedSummaries(); } void MainWindow::commit() { CommitDialog dlg(mpContext, mpUi->logEdit->toPlainText(), mPath, this); dlg.exec(); - reloadModifications(); + + // the commit dialog may have updated but not committed + reloadUncommittedSummary(); + reloadCommittedSummaries(); + if (dlg.result() == QDialog::Accepted) { - reloadCommitSummaries(); mpUi->logEdit->setReadOnly(false); mpUi->logEdit->document()->setPlainText(""); } @@ -213,7 +208,7 @@ return; } } - reloadModifications(); + reloadUncommittedSummary(); } void MainWindow::add() @@ -229,7 +224,7 @@ return; } } - reloadModifications(); + reloadUncommittedSummary(); } void MainWindow::move() @@ -238,41 +233,14 @@ dlg.exec(); } -void MainWindow::reloadCommitSummaries() +void MainWindow::reloadCommittedSummaries() { - // load uncommitted revisions - Svn::CommitSummaryFetcher fetcher; - Svn::CommitSummary uncommittedSummary; - QString error; - if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), false, uncommittedSummary, error)) - { - mpRevisionsModel->showUncommittedRevision(uncommittedSummary); - - // select the uncommitted revision if nothing is selected yet - QItemSelectionModel* pSelection = mpUi->revisionsTreeView->selectionModel(); - if (pSelection->selectedIndexes().count() == 0) - { - QModelIndex index = mpRevisionsModel->getUncommittedRevision(); - pSelection->select(index, QItemSelectionModel::Clear | QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows); - } - } - else - { - mpRevisionsModel->showError(error); - } - - // load committed revisions - mpCommitSummaryThread->fetchSummariesAsync(mPath, Revision::base(), Revision::committed(0)); + mpCommitSummaryCache->fetchSummariesAsync(Revision::base(), Revision::committed(0)); } -void MainWindow::reloadModifications() +void MainWindow::reloadUncommittedSummary() { - // Update immediately for all revisions, then post a background request to refresh uncommitted modifications. - mpModificationsModel->showModifications(mDisplayedCommitSummary.modifications()); - - Revision rev = mDisplayedCommitSummary.getRevision(); - if (rev.getType() == Revision::Uncommitted) - mpModificationsThread->fetchSummariesAsync(mPath, rev, rev); + mpCommitSummaryCache->fetchSummariesAsync(Revision::uncommitted(), Revision::uncommitted()); } void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) @@ -280,62 +248,50 @@ Q_UNUSED(rcSelected); Q_UNUSED(rcDeselected); - QList<int> rows = getSelectedRows(mpUi->revisionsTreeView); - if (rows.count() == 0) - return; - GSVN_ASSERT(rows.count() == 1); - Svn::CommitSummary commitSummary; - if (mpRevisionsModel->getCommitSummaryForRow(rows.at(0), commitSummary)) + if (getSelectedCommitSummary(commitSummary)) { - mDisplayedCommitSummary = commitSummary; + mpUi->logEdit->setReadOnly(commitSummary.getRevision().getType() != Revision::Uncommitted); + mpUi->logEdit->document()->setPlainText(commitSummary.getCommitLogMessage()); - mpUi->logEdit->setReadOnly(mDisplayedCommitSummary.getRevision().getType() != Revision::Uncommitted); - mpUi->logEdit->document()->setPlainText(mDisplayedCommitSummary.getCommitLogMessage()); + mpModificationsModel->setRevision(commitSummary.getRevision()); - reloadModifications(); + if (commitSummary.getRevision().getType() == Revision::Uncommitted) + reloadUncommittedSummary(); } + else + mpModificationsModel->clearRevision(); } -void MainWindow::fetchedCommittedRevisions(QString fullRepoPath, QList<Svn::CommitSummary> summaries) +void MainWindow::afterCommitSummaryAdded(Revision rev) { - Q_UNUSED(fullRepoPath); - mpRevisionsModel->showCommittedRevisions(summaries); + // select the uncommitted revision if nothing is selected yet + QItemSelectionModel* pSelection = mpUi->revisionsTreeView->selectionModel(); + if (pSelection->selectedIndexes().count() == 0) + { + QModelIndex index = mpRevisionsModel->getUncommittedRevision(); + if (index.isValid()) + pSelection->select(index, QItemSelectionModel::Clear | QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows); + } } -void MainWindow::fetchCommittedRevisionsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error) +bool MainWindow::getSelectedCommitSummary(Svn::CommitSummary& rSummary) { - Q_UNUSED(fullRepoPath); - Q_UNUSED(startRevision); - Q_UNUSED(endRevision); - qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); -} + rSummary = Svn::CommitSummary(); -void MainWindow::fetchedModifications(QString fullRepoPath, QList<Svn::CommitSummary> summaries) -{ - Q_UNUSED(fullRepoPath); + QList<int> rows = getSelectedRows(mpUi->revisionsTreeView); + if (rows.count() == 0) + return false; + GSVN_ASSERT(rows.count() == 1); - GSVN_ASSERT(summaries.count() == 1); + Svn::CommitSummary commitSummary; + if (!mpRevisionsModel->getCommitSummaryForRow(rows.at(0), commitSummary)) + return false; - // Save the new modifications if showing an uncommitted revision to prevent - // a refresh of stale data when the window receives focus. - if (mDisplayedCommitSummary.getRevision().getType() == Revision::Uncommitted && - summaries.at(0).getRevision().getType() == Revision::Uncommitted) - { - mDisplayedCommitSummary = summaries.at(0); - } - - mpModificationsModel->showModifications(summaries.at(0).modifications()); + rSummary = commitSummary; + return true; } -void MainWindow::fetchModificationsFailed(QString fullRepoPath, Revision startRevision, Revision endRevision, QString error) -{ - Q_UNUSED(fullRepoPath); - Q_UNUSED(startRevision); - Q_UNUSED(endRevision); - mpModificationsModel->showError(error); -} - QList<int> MainWindow::getSelectedRows(QAbstractItemView* pView) { // determine which rows are selected (remove duplicate rows, since an index is returned for each column) Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-22 19:23:50 UTC (rev 139) @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "dialogs/modificationsmodel.h" +#include "commit_summary_cache.h" #include "debug.h" #include "svn/modification.h" #include "svn/revision.h" @@ -37,24 +38,66 @@ } -ModificationsModel::ModificationsModel() : mAllowSelections(false) +ModificationsModel::ModificationsModel(CommitSummaryCache* pCommitSummaryCache) : mAllowSelections(false) { + mpCommitSummaryCache = pCommitSummaryCache; + connect(mpCommitSummaryCache, SIGNAL(afterCommitSummaryChanged(Revision)), + this, SLOT(afterCommitSummaryChanged(Revision))); + mShowUnversionedMods = true; + + refresh(); } ModificationsModel::~ModificationsModel() { } -void ModificationsModel::showError(QString error) +void ModificationsModel::afterCommitSummaryChanged(Revision rev) { - GSVN_ASSERT(!error.isNull()); - mError = error; - mAllModifications.clear(); - reset(); + if (mRevision.hasValue() && mRevision.getValue() == rev) + refresh(); } -void ModificationsModel::showModifications(QList<Modification> modifications) +void ModificationsModel::refresh() { + if (mRevision.hasValue()) + { + QString error; + if (mRevision.getValue().getType() == Revision::Uncommitted && + !mpCommitSummaryCache->didLastFetchSucceed(mRevision.getValue(), error)) + { + GSVN_ASSERT(!error.isNull()); + mError = error; + mAllModifications.clear(); + reset(); + } + else + { + Svn::CommitSummary summary = mpCommitSummaryCache->getCommitSummary(mRevision.getValue()); + setModifications(summary.modifications()); + } + } + else + { + mError = QString(); + mAllModifications.clear(); + reset(); + } +} + +void ModificationsModel::setModifications(QList<Modification> modifications) +{ + if (!mShowUnversionedMods) + { + // remove unversioned mods + QMutableListIterator<Modification> i(modifications); + while (i.hasNext()) + { + if (!Modification::isVersionedType(i.next().getType())) + i.remove(); + } + } + // Sort by file path to provide more consistent display and to better maintain selection. qSort(modifications.begin(), modifications.end(), ModificationPathLessThan()); @@ -131,6 +174,18 @@ GSVN_ASSERT(mAllModifications.size() == modifications.size()); } +void ModificationsModel::setRevision(Revision revision) +{ + mRevision = revision; + refresh(); +} + +void ModificationsModel::clearRevision() +{ + mRevision = Nullable<Revision>(); + refresh(); +} + bool ModificationsModel::getModificationForRow(int row, Modification& rModification) const { if (!mError.isEmpty()) @@ -280,9 +335,16 @@ return flags; } +void ModificationsModel::setShowUnversionedMods(bool showUnversionedMods) +{ + mShowUnversionedMods = showUnversionedMods; + refresh(); +} + void ModificationsModel::setAllowSelections(bool allowSelections) { mAllowSelections = allowSelections; + emit layoutChanged(); } QList<Modification> ModificationsModel::getSelectedModifications() const Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-12-22 19:04:57 UTC (rev 138) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-12-22 19:23:50 UTC (rev 139) @@ -19,41 +19,28 @@ ***************************************************************************/ #include "dialogs/revisionsmodel.h" +#include "commit_summary_cache.h" +#include "commit_summary_sort.h" #include "debug.h" #include "svn/commit_summary.h" -RevisionsModel::RevisionsModel() +RevisionsModel::RevisionsModel(CommitSummaryCache* pCommitSummaryCache) { + mpCommitSummaryCache = pCommitSummaryCache; + connect(mpCommitSummaryCache, SIGNAL(beforeCommitSummaryAdded(Revision)), + this, SLOT(beforeCommitSummaryAdded(Revision))); + connect(mpCommitSummaryCache, SIGNAL(afterCommitSummaryAdded(Revision)), + this, SLOT(afterCommitSummaryAdded(Revision))); + connect(mpCommitSummaryCache, SIGNAL(afterCommitSummaryChanged(Revision)), + this, SLOT(afterCommitSummaryChanged(Revision))); + connect(mpCommitSummaryCache, SIGNAL(fetchFailed(Revision,Revision,QString)), + this, SLOT(fetchFailed(Revision,Revision,QString))); } RevisionsModel::~RevisionsModel() { } -void RevisionsModel::showError(QString error) -{ - GSVN_ASSERT(!error.isNull()); - mError = error; - mUncommittedSummaries.clear(); - mCommittedSummaries.clear(); - emit layoutChanged(); -} - -void RevisionsModel::showUncommittedRevision(Svn::CommitSummary uncommittedRevision) -{ - mError = QString(); - mUncommittedSummaries.clear(); - mUncommittedSummaries.push_back(uncommittedRevision); - emit layoutChanged(); -} - -void RevisionsModel::showCommittedRevisions(QList<Svn::CommitSummary> committedRevisions) -{ - mError = QString(); - mCommittedSummaries = committedRevisions; - emit layoutChanged(); -} - QModelIndex RevisionsModel::getUncommittedRevision() const { Svn::CommitSummary summary; @@ -68,7 +55,7 @@ switch (rev.getType()) { case Revision::Uncommitted: return tr("(uncommitted)"); - case Revision::Committed: return tr("r%1").arg(QString::number(rev.getCommittedRevision())) ; + case Revision::Committed: return tr("r%1").arg(rev.getCommittedRevision()); case Revision::Base: return tr("(base)"); case Revision::Head: return tr("(head)"); default: @@ -108,7 +95,7 @@ if (!mError.isNull()) return 1; - return mUncommittedSummaries.count() + mCommittedSummaries.count(); + return mpCommitSummaryCache->getCommitSummaries().count(); } QVariant RevisionsModel::headerData(int section, Qt::Orientation orientation, int role) const @@ -170,24 +157,53 @@ if (!mError.isNull()) return false; - if (row < 0) - return false; - - // uncommitted revision? - if (row < mUncommittedSummaries.count()) + if (row >= 0 && row < mpCommitSummaryCache->getCommitSummaries().count()) { - rSummary = mUncommittedSummaries.at(row); + rSummary = mpCommitSummaryCache->getCommitSummaries().at(row); return true; } - // committed revision? - row -= mUncommittedSummaries.count(); - GSVN_ASSERT(row >= 0); - if (row < mCommittedSummaries.count()) + return false; +} + +void RevisionsModel::beforeCommitSummaryAdded(Revision rev) +{ + if (!mError.isNull()) { - rSummary = mCommittedSummaries.at(row); - return true; + mError = QString(); + reset(); } - return false; + int index = -1; + if (CommitSummaryFinder::findByRevision(mpCommitSummaryCache->getCommitSummaries(), rev, index)) + GSVN_ASSERT(false); + else + beginInsertRows(QModelIndex(), index, index); } + +void RevisionsModel::afterCommitSummaryAdded(Revision rev) +{ + endInsertRows(); +} + +void RevisionsModel::afterCommitSummaryChanged(Revision rev) +{ + GSVN_ASSERT(mError.isNull()); + + int row = -1; + if (CommitSummaryFinder::findByRevision(mpCommitSummaryCache->getCommitSummaries(), rev, row)) + emit dataChanged(index(row,0), index(row,columnCount())); + else + GSVN_ASSERT(false); +} + +void RevisionsModel::fetchFailed(Revision startRevision, Revision endRevision, QString error) +{ + Q_UNUSED(startRevision); + Q_UNUSED(endRevision); + if (mpCommitSummaryCache->getCommitSummaries().size() == 0) + { + mError = error; + reset(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-12-22 19:54:53
|
Revision: 141 http://svn.sourceforge.net/grandmas-svn/?rev=141&view=rev Author: highjinx Date: 2006-12-22 11:54:52 -0800 (Fri, 22 Dec 2006) Log Message: ----------- * Changed the commit summary fetcher to return modifications without a leading slash -- this is consistent with the official svn client * Fixed gcc compile error in commit_summary_sort.cpp * Fixed incorrect parameter name in getRepoUrlWithPath Modified Paths: -------------- trunk/include/svn/helpers.h trunk/include/svn/operation.h trunk/src/commit_summary_sort.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/helpers.cpp Modified: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h 2006-12-22 19:34:43 UTC (rev 140) +++ trunk/include/svn/helpers.h 2006-12-22 19:54:52 UTC (rev 141) @@ -32,4 +32,5 @@ QString formatSvnErrorMessage(svn_error_t* pError); bool removePrefixNoCase(QString& rString, QString prefix); + bool addSuffixUnlessExists(QString& rString, QString suffix); }; Modified: trunk/include/svn/operation.h =================================================================== --- trunk/include/svn/operation.h 2006-12-22 19:34:43 UTC (rev 140) +++ trunk/include/svn/operation.h 2006-12-22 19:54:52 UTC (rev 141) @@ -31,5 +31,5 @@ bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); bool getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError); - bool getRepoUrlWithPath(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError); + bool getRepoUrlWithPath(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rFullPath, QString fullRepoPath, QString& rError); }; Modified: trunk/src/commit_summary_sort.cpp =================================================================== --- trunk/src/commit_summary_sort.cpp 2006-12-22 19:34:43 UTC (rev 140) +++ trunk/src/commit_summary_sort.cpp 2006-12-22 19:54:52 UTC (rev 141) @@ -68,12 +68,12 @@ class CommitSummaryRevisionLessThan { public: - inline bool CommitSummaryRevisionLessThan::operator()(const Svn::CommitSummary& rLeft, const Svn::CommitSummary& rRight) const + inline bool operator()(const Svn::CommitSummary& rLeft, const Svn::CommitSummary& rRight) const { return isRevisionLessThan(rRight.getRevision(), rLeft.getRevision()); } - inline bool CommitSummaryRevisionLessThan::operator()(const Svn::CommitSummary& rLeft, const Revision& rRight) const + inline bool operator()(const Svn::CommitSummary& rLeft, const Revision& rRight) const { return isRevisionLessThan(rRight, rLeft.getRevision()); } Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-22 19:34:43 UTC (rev 140) +++ trunk/src/svn/commit_summary.cpp 2006-12-22 19:54:52 UTC (rev 141) @@ -47,7 +47,8 @@ { if (!Operation::getRepoCheckoutUrl(rContext, ctx, mRepoUrl, fullCanonPath, rError)) return false; - + addSuffixUnlessExists(mRepoUrl, "/"); + svn_opt_revision_t startRev = startRevision.getSvnRevision(); svn_opt_revision_t endRev = endRevision.getSvnRevision(); apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); @@ -66,8 +67,10 @@ else { mWcPath = fullCanonPath; + addSuffixUnlessExists(mWcPath, "/"); if (!Operation::getRepoUrlWithPath(rContext, ctx, mRepoUrl, fullCanonPath, rError)) return false; + addSuffixUnlessExists(mRepoUrl, "/"); if (mSummaries.size() == 0) { Modified: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp 2006-12-22 19:34:43 UTC (rev 140) +++ trunk/src/svn/helpers.cpp 2006-12-22 19:54:52 UTC (rev 141) @@ -67,3 +67,13 @@ return false; } +bool Svn::addSuffixUnlessExists(QString& rString, QString suffix) +{ + if (!rString.endsWith(suffix)) + { + rString += suffix; + return true; + } + return false; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 20:01:27
|
Revision: 142 http://svn.sourceforge.net/grandmas-svn/?rev=142&view=rev Author: matthiasmiller Date: 2006-12-22 12:01:27 -0800 (Fri, 22 Dec 2006) Log Message: ----------- Error conditions were not correctly being displayed. Allow the Revision object to be sent via the signal/slot mechanism (for real this time) and refresh the modifications model when a fetch fails. Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/include/svn/revision.h trunk/src/dialogs/modificationsmodel.cpp trunk/src/svn/commit_summary_thread.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-12-22 19:54:52 UTC (rev 141) +++ trunk/include/dialogs/modificationsmodel.h 2006-12-22 20:01:27 UTC (rev 142) @@ -61,6 +61,7 @@ private slots: void afterCommitSummaryChanged(Revision rev); + void fetchFailed(Revision startRevision, Revision endRevision, QString error); private: void refresh(); Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2006-12-22 19:54:52 UTC (rev 141) +++ trunk/include/svn/revision.h 2006-12-22 20:01:27 UTC (rev 142) @@ -22,7 +22,6 @@ #define _REVISION_H_ #include <Qt> -#include <QMetaType> #include <svn_wc.h> @@ -71,6 +70,5 @@ Type mType; int mCommittedRevision; }; -Q_DECLARE_METATYPE(Revision); #endif Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-12-22 19:54:52 UTC (rev 141) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-12-22 20:01:27 UTC (rev 142) @@ -43,6 +43,8 @@ mpCommitSummaryCache = pCommitSummaryCache; connect(mpCommitSummaryCache, SIGNAL(afterCommitSummaryChanged(Revision)), this, SLOT(afterCommitSummaryChanged(Revision))); + connect(mpCommitSummaryCache, SIGNAL(fetchFailed(Revision,Revision,QString)), + this, SLOT(fetchFailed(Revision,Revision,QString))); mShowUnversionedMods = true; refresh(); @@ -58,6 +60,11 @@ refresh(); } +void ModificationsModel::fetchFailed(Revision startRevision, Revision endRevision, QString error) +{ + refresh(); +} + void ModificationsModel::refresh() { if (mRevision.hasValue()) @@ -79,7 +86,7 @@ } else { - mError = QString(); + mError = QString(); mAllModifications.clear(); reset(); } Modified: trunk/src/svn/commit_summary_thread.cpp =================================================================== --- trunk/src/svn/commit_summary_thread.cpp 2006-12-22 19:54:52 UTC (rev 141) +++ trunk/src/svn/commit_summary_thread.cpp 2006-12-22 20:01:27 UTC (rev 142) @@ -61,6 +61,7 @@ } else { + qRegisterMetaType<Revision>("Revision"); emit failed(fullRepoPath, startRevision, endRevision, error); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 21:30:14
|
Revision: 143 http://svn.sourceforge.net/grandmas-svn/?rev=143&view=rev Author: matthiasmiller Date: 2006-12-22 13:30:09 -0800 (Fri, 22 Dec 2006) Log Message: ----------- * enable/disable buttons based on selected modifications * return focus to the modifications view when the buttons are clicked Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-12-22 20:01:27 UTC (rev 142) +++ trunk/include/dialogs/mainwindow.h 2006-12-22 21:30:09 UTC (rev 143) @@ -55,12 +55,15 @@ void revert(); void add(); void move(); + void modificationSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void afterCommitSummaryAdded(Revision rev); + void modelDataChanged(const QModelIndex&, const QModelIndex&); private: void reloadCommittedSummaries(); void reloadUncommittedSummary(); + void updateButtons(); bool getSelectedCommitSummary(Svn::CommitSummary& rSummary); QList<int> getSelectedRows(QAbstractItemView* pView); QList<Modification> getSelectedModifications(); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-22 20:01:27 UTC (rev 142) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-22 21:30:09 UTC (rev 143) @@ -73,13 +73,19 @@ connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); mpModificationsModel = new ModificationsModel(mpCommitSummaryCache); + connect(mpModificationsModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), + this, SLOT(modelDataChanged(const QModelIndex&,const QModelIndex&))); mpUi->changesTreeView->setModel(mpModificationsModel); mpUi->changesTreeView->header()->setMovable(false); + connect(mpUi->changesTreeView->selectionModel(), + SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), + this, SLOT(modificationSelectionChanged(const QItemSelection&, const QItemSelection&))); mpRevisionsModel = new RevisionsModel(mpCommitSummaryCache); + connect(mpRevisionsModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), + this, SLOT(modelDataChanged(const QModelIndex&,const QModelIndex&))); mpUi->revisionsTreeView->setModel(mpRevisionsModel); mpUi->revisionsTreeView->header()->setMovable(false); - connect(mpUi->revisionsTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(revisionSelectionChanged(const QItemSelection&, const QItemSelection&))); @@ -162,6 +168,8 @@ void MainWindow::diff() { + mpUi->changesTreeView->setFocus(); + QList<Modification> mods = getSelectedModifications(); Q_FOREACH(Modification mod, mods) { @@ -192,6 +200,8 @@ void MainWindow::revert() { + mpUi->changesTreeView->setFocus(); + int iResponse = QMessageBox::question(this, tr("Revert changes?"), tr("Are you sure that you want to revert the selected changes?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); if (iResponse != QMessageBox::Yes) @@ -213,6 +223,8 @@ void MainWindow::add() { + mpUi->changesTreeView->setFocus(); + QList<Modification> mods = getSelectedModifications(); Q_FOREACH(Modification mod, mods) { @@ -231,6 +243,8 @@ { MoveDialog dlg(this); dlg.exec(); + + mpUi->changesTreeView->setFocus(); } void MainWindow::reloadCommittedSummaries() @@ -243,6 +257,38 @@ mpCommitSummaryCache->fetchSummariesAsync(Revision::uncommitted(), Revision::uncommitted()); } +void MainWindow::updateButtons() +{ + // check whether the uncommitted revision is selected + Svn::CommitSummary summary; + bool isUncommitted = getSelectedCommitSummary(summary) && + summary.getRevision().getType() == Revision::Uncommitted; + + // check for versioned/unversioned mods + bool hasVersionedMod = false, hasUnversionedMod = false; + Q_FOREACH(Modification mod, getSelectedModifications()) + { + if (Modification::isVersionedType(mod.getType())) + hasVersionedMod = true; + else + hasUnversionedMod = true; + } + + mpUi->diffButton->setEnabled(true); + mpUi->revertButton->setEnabled(isUncommitted && hasVersionedMod); + mpUi->addButton->setEnabled(isUncommitted && hasUnversionedMod); + mpUi->deleteButton->setEnabled(false); + mpUi->moveButton->setEnabled(false); +} + +void MainWindow::modificationSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) +{ + Q_UNUSED(rcSelected); + Q_UNUSED(rcDeselected); + + updateButtons(); +} + void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) { Q_UNUSED(rcSelected); @@ -261,6 +307,8 @@ } else mpModificationsModel->clearRevision(); + + updateButtons(); } void MainWindow::afterCommitSummaryAdded(Revision rev) @@ -275,6 +323,11 @@ } } +void MainWindow::modelDataChanged(const QModelIndex&, const QModelIndex&) +{ + updateButtons(); +} + bool MainWindow::getSelectedCommitSummary(Svn::CommitSummary& rSummary) { rSummary = Svn::CommitSummary(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-12-22 21:39:43
|
Revision: 144 http://svn.sourceforge.net/grandmas-svn/?rev=144&view=rev Author: highjinx Date: 2006-12-22 13:39:43 -0800 (Fri, 22 Dec 2006) Log Message: ----------- * Clean up the canonicalizing of paths * Fix tests on windows Modified Paths: -------------- trunk/include/svn/file_access.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/svn/add.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/file_access.cpp trunk/tests/svn_test.cpp Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/include/svn/file_access.h 2006-12-22 21:39:43 UTC (rev 144) @@ -27,7 +27,6 @@ class RepoFileAccess { public: - static QString getCanonicalPath(SvnOperationContext& rContext, QString workingCopy, QString filePath); static bool getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError); static bool getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); }; Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/src/dialogs/commit.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -103,7 +103,7 @@ QStringList files; foreach(Modification mod, mpModificationsModel->getSelectedModifications()) { - files.push_back(RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath())); + files.push_back(mod.getFilePath()); } QString error; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -175,8 +175,7 @@ { // Generate each side of the diff QString error, leftPath, rightPath; - QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); - if (!RepoFileAccess::getDiffFiles(*mpContext, fullFilePath, mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) + if (!RepoFileAccess::getDiffFiles(*mpContext, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) { QMessageBox::critical(this, "", error); return; @@ -211,8 +210,7 @@ Q_FOREACH(Modification mod, mods) { QString error; - QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); - if (!Svn::revert(*mpContext, fullFilePath, error)) + if (!Svn::revert(*mpContext, mod.getFilePath(), error)) { QMessageBox::critical(this, "", error); return; @@ -229,8 +227,7 @@ Q_FOREACH(Modification mod, mods) { QString error; - QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); - if (!Svn::add(*mpContext, fullFilePath, error)) + if (!Svn::add(*mpContext, mod.getFilePath(), error)) { QMessageBox::critical(this, "", error); return; Modified: trunk/src/svn/add.cpp =================================================================== --- trunk/src/svn/add.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/src/svn/add.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -31,7 +31,8 @@ bool Svn::add(SvnOperationContext& rContext, const QString& filePath, QString& rError) { - const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/src/svn/commit_summary.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -35,7 +35,8 @@ { mSummaries.clear(); rError = ""; - const char* fullCanonPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(fullRepoPath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/src/svn/file_access.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -37,7 +37,6 @@ while (true) { QString testPath = dirPath + QDir::separator() + filePrefix+randString+"."+fileExtension; - testPath = svn_path_canonicalize(testPath.toAscii(), rContext.getAprPool()); if (!QFile::exists(testPath)) { rFilePath = testPath; @@ -50,12 +49,6 @@ } } -QString RepoFileAccess::getCanonicalPath(SvnOperationContext& rContext, QString workingCopy, QString filePath) -{ - QString path = workingCopy + QDir::separator() + filePath; - return svn_path_canonicalize(path.toAscii(), rContext.getAprPool()); -} - bool RepoFileAccess::getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError) { if (rev.getType() == Revision::Uncommitted) @@ -88,7 +81,10 @@ return false; svn_opt_revision_t svnRev = rev.getSvnRevision(); - svn_error_t* pError = svn_client_cat(pStream, fullRepoPath.toAscii(), &svnRev, pCtx, rContext.getAprPool()); + + const char* svnPath = svn_path_internal_style(fullRepoPath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); + svn_error_t* pError = svn_client_cat(pStream, fullCanonPath, &svnRev, pCtx, rContext.getAprPool()); if (pError) { rError = Svn::formatSvnErrorMessage(pError); Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-22 21:30:09 UTC (rev 143) +++ trunk/tests/svn_test.cpp 2006-12-22 21:39:43 UTC (rev 144) @@ -181,11 +181,6 @@ void SvnTester::init() { -#ifdef Q_WS_WIN - // force these tests to fail early on Windows since they interfere - // with the working copy in the current directory. - QVERIFY(false); -#endif } @@ -228,11 +223,11 @@ assertModsMatch(getWcPath(), Revision::uncommitted(), QList<Modification>() << Modification::creation("first.txt")); - GSVN_VERIFY(Svn::add(*mpContext, getWcPath()+"/first.txt", error)); + GSVN_VERIFY(Svn::add(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), error)); assertModsMatch(getWcPath(), Revision::uncommitted(), QList<Modification>() << Modification::addition("first.txt", Revision::uncommitted())); - GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << getWcPath()+"/first.txt", error)); + GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << QDir::convertSeparators(getWcPath()+"/first.txt"), error)); assertModsMatch(getWcPath(), Revision::committed(1), QList<Modification>() << Modification::addition("first.txt", Revision::committed(1))); } @@ -244,19 +239,19 @@ // Test committed file QString error; QVERIFY(touchFile("first.txt", "This is the first file")); - GSVN_VERIFY(Svn::add(*mpContext, getWcPath()+"/first.txt", error)); - GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << getWcPath()+"/first.txt", error)); + GSVN_VERIFY(Svn::add(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), error)); + GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << QDir::convertSeparators(getWcPath()+"/first.txt"), error)); QString filePath; GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), Revision::committed(1), filePath, error)); QCOMPARE(getFileContents(filePath), QString("This is the first file")); - QVERIFY(filePath != getWcPath()+"/first.txt"); // We should not overwrite the WC copy! + QVERIFY(filePath != QDir::convertSeparators(getWcPath()+"/first.txt")); // We should not overwrite the WC copy! // Test uncommitted file QVERIFY(touchFile("second.txt", "This is the second file")); - GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/second.txt"), Revision::uncommitted(), filePath, error)); + GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(QDir::convertSeparators(getWcPath()+"/second.txt")), Revision::uncommitted(), filePath, error)); - QCOMPARE(filePath, getWcPath()+"/second.txt"); // We should return the WC file path directly if working on uncommitted revisions + QCOMPARE(filePath, QDir::convertSeparators(getWcPath()+"/second.txt")); // We should return the WC file path directly if working on uncommitted revisions QCOMPARE(getFileContents(filePath), QString("This is the second file")); // Test both committed and uncommitted files This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-22 22:02:27
|
Revision: 145 http://svn.sourceforge.net/grandmas-svn/?rev=145&view=rev Author: matthiasmiller Date: 2006-12-22 14:02:27 -0800 (Fri, 22 Dec 2006) Log Message: ----------- * enable Windows console in debug mode * remove stub authentication prompt in update * by default update working copy on commit Modified Paths: -------------- trunk/grandmas_svn.pro trunk/src/dialogs/mainwindow.cpp trunk/ui/commit.ui Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-22 21:39:43 UTC (rev 144) +++ trunk/grandmas_svn.pro 2006-12-22 22:02:27 UTC (rev 145) @@ -172,6 +172,11 @@ UI_DIR = tmp/$${build_conf()}/ui RCC_DIR = tmp/$${build_conf()}/rcc +# Use console to facilitate debugging on Windows. +win32:is_debug_conf() { + CONFIG += console +} + CONFIG += embed_manifest_exe \ warn_on \ qt \ Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-22 21:39:43 UTC (rev 144) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-22 22:02:27 UTC (rev 145) @@ -134,9 +134,11 @@ void MainWindow::update() { // BEGIN HARDCODE - prompt for username/password + /* SvnUiAuthentication auth(this); if (!auth.getAuthentication(tr("default_username"))) return; + */ // END HARDCODE ProgressDialog progress(this, tr("Updating Working Copy")); Modified: trunk/ui/commit.ui =================================================================== --- trunk/ui/commit.ui 2006-12-22 21:39:43 UTC (rev 144) +++ trunk/ui/commit.ui 2006-12-22 22:02:27 UTC (rev 145) @@ -78,6 +78,9 @@ <property name="text" > <string>&Also update this working copy.</string> </property> + <property name="checked" > + <bool>true</bool> + </property> </widget> </item> <item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-13 18:39:39
|
Revision: 151 http://svn.sourceforge.net/grandmas-svn/?rev=151&view=rev Author: highjinx Date: 2007-01-13 10:39:40 -0800 (Sat, 13 Jan 2007) Log Message: ----------- Adding cleanup option on menubar Modified Paths: -------------- trunk/include/svn/wc_operations.h trunk/src/svn/wc_operations.cpp trunk/ui/mainwindow.ui Modified: trunk/include/svn/wc_operations.h =================================================================== --- trunk/include/svn/wc_operations.h 2007-01-13 17:49:02 UTC (rev 150) +++ trunk/include/svn/wc_operations.h 2007-01-13 18:39:40 UTC (rev 151) @@ -28,6 +28,7 @@ namespace Svn { bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); + bool cleanup(SvnOperationContext& rContext, const QString& filePath, QString& rError); bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); bool remove(SvnOperationContext& rContext, const QString& filePath, QString& rError); // equivalent to svn del bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-13 17:49:02 UTC (rev 150) +++ trunk/src/svn/wc_operations.cpp 2007-01-13 18:39:40 UTC (rev 151) @@ -93,18 +93,15 @@ return true; } - -bool Svn::remove(SvnOperationContext& rContext, const QString& filePath, QString& rError) +bool Svn::cleanup(SvnOperationContext& rContext, const QString& filePath, QString& rError) { const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); - - apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); - svn_client_commit_info_t* pResultingInfo = NULL; - svn_error_t* pError = svn_client_delete(&pResultingInfo, array, false, ctx, rContext.getAprPool()); + + svn_error_t* pError = svn_client_cleanup(fullCanonPath, ctx, rContext.getAprPool()); if (pError) { rError = formatSvnErrorMessage(pError); @@ -120,6 +117,26 @@ return comitter.commit(rContext, commitMessage, filePaths, rError); } +bool Svn::remove(SvnOperationContext& rContext, const QString& filePath, QString& rError) +{ + const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + + apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); + svn_client_commit_info_t* pResultingInfo = NULL; + svn_error_t* pError = svn_client_delete(&pResultingInfo, array, false, ctx, rContext.getAprPool()); + if (pError) + { + rError = formatSvnErrorMessage(pError); + return false; + } + + return true; +} + bool Svn::revert(SvnOperationContext& rContext, const QString& filePath, QString& rError) { const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2007-01-13 17:49:02 UTC (rev 150) +++ trunk/ui/mainwindow.ui 2007-01-13 18:39:40 UTC (rev 151) @@ -330,6 +330,7 @@ </property> <addaction name="actionUpdate_Path_to_Revision" /> <addaction name="action_Annotate" /> + <addaction name="action_Cleanup" /> </widget> <widget class="QMenu" name="menu_File" > <property name="title" > @@ -357,14 +358,19 @@ <property name="shortcut" > <string>Ctrl+Shift+U</string> </property> - </action> - <action name="action_Annotate" > +</action> +<action name="action_Annotate" > <property name="text" > - <string>&Annotate</string> + <string>&Annotate</string> </property> <property name="shortcut" > - <string>Ctrl+T</string> + <string>Ctrl+T</string> </property> +</action> +<action name="action_Cleanup" > + <property name="text" > + <string>&Cleanup</string> + </property> </action> </widget> <tabstops> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-15 18:46:16
|
Revision: 154 http://svn.sourceforge.net/grandmas-svn/?rev=154&view=rev Author: highjinx Date: 2007-01-15 10:46:13 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Adding support for username/password prompt for authentication Modified Paths: -------------- trunk/include/dialogs/authentication.h trunk/include/svn/server_access.h trunk/src/dialogs/authentication.cpp trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/svn/wc_operations.cpp trunk/ui/authentication.ui Modified: trunk/include/dialogs/authentication.h =================================================================== --- trunk/include/dialogs/authentication.h 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/include/dialogs/authentication.h 2007-01-15 18:46:13 UTC (rev 154) @@ -29,11 +29,12 @@ Q_OBJECT public: - AuthenticationDialog(QWidget* pParent, QString username, QString password); + AuthenticationDialog(QWidget* pParent, QString realm, QString username); virtual ~AuthenticationDialog(); QString getUsername() const; QString getPassword() const; + bool maySavePassword() const; private: Ui_AuthenticationDialog* mpUi; @@ -47,6 +48,6 @@ using SvnAuthentication::getAuthentication; private: - virtual bool getAuthentication(QString& rUsername, QString& rPassword); + virtual bool derived_GetAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*OUT*/bool& rbMaySavePassword); QWidget* mpParent; }; Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/include/svn/server_access.h 2007-01-15 18:46:13 UTC (rev 154) @@ -67,30 +67,35 @@ public: virtual ~SvnAuthentication() {} - bool getAuthentication(QString defaultUsername) + bool getAuthentication(QString realm, QString defaultUsername) { mUsername = defaultUsername; mPassword = ""; - return getAuthentication(mUsername, mPassword); + mMaySavePassword = true; + return derived_GetAuthentication(realm, mUsername, mPassword, mMaySavePassword); } const char* getUsername() { return mUsername.toAscii(); } const char* getPassword() { return mPassword.toAscii(); } + bool maySavePassword() { return mMaySavePassword; } protected: - virtual bool getAuthentication(QString& rUsername, QString& rPassword)=0; + virtual bool derived_GetAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*IN OUT*/bool& rbMaySavePassword)=0; QString mUsername; QString mPassword; + bool mMaySavePassword; }; class SvnAuthenticationUnimpl : public SvnAuthentication { public: virtual ~SvnAuthenticationUnimpl() {} - virtual bool getAuthentication(QString& rUserName, QString& rPassword) + virtual bool getAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*IN OUT*/bool& rbMaySavePassword) { - Q_UNUSED(rUserName); + Q_UNUSED(realm); + Q_UNUSED(rUsername); Q_UNUSED(rPassword); + Q_UNUSED(rbMaySavePassword); return false; } }; @@ -104,8 +109,9 @@ // used by svn layer apr_pool_t* getAprPool() const { return mpSubPool; } void setStatus(SvnOperationStatus* pStatus) { mpStatus = pStatus; } + void setAuthentication(SvnAuthentication* pAuth) { mpAuthentication = pAuth; } SvnOperationStatus* getStatus() const { return mpStatus; } - SvnAuthentication* getAuthenticationCallback() const { return mpAuthentication; } + SvnAuthentication* getAuthentication() const { return mpAuthentication; } private: apr_pool_t* mpSubPool; Modified: trunk/src/dialogs/authentication.cpp =================================================================== --- trunk/src/dialogs/authentication.cpp 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/src/dialogs/authentication.cpp 2007-01-15 18:46:13 UTC (rev 154) @@ -21,12 +21,13 @@ #include "dialogs/util.h" #include "ui_authentication.h" -AuthenticationDialog::AuthenticationDialog(QWidget* pParent, QString username, QString password) : QDialog(pParent, Qt::Sheet) +AuthenticationDialog::AuthenticationDialog(QWidget* pParent, QString realm, QString username) : QDialog(pParent, Qt::Sheet) { mpUi = new Ui_AuthenticationDialog; mpUi->setupUi(this); mpUi->usernameEdit->setText(username); - mpUi->passwordEdit->setText(password); + mpUi->passwordEdit->setText(""); + mpUi->realmLabel->setText(mpUi->realmLabel->text() + realm); #ifdef Q_WS_MAC exchangeWidgets(mpUi->hboxLayout, mpUi->okButton, mpUi->cancelButton); @@ -49,18 +50,24 @@ return mpUi->passwordEdit->text(); } +bool AuthenticationDialog::maySavePassword() const +{ + return (mpUi->saveAuthCheckBox->checkState() == Qt::Checked); +} + SvnUiAuthentication::SvnUiAuthentication(QWidget* pParent) { mpParent = pParent; } -bool SvnUiAuthentication::getAuthentication(QString& rUsername, QString& rPassword) +bool SvnUiAuthentication::derived_GetAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*OUT*/bool& rbMaySavePassword) { - AuthenticationDialog dialog(mpParent, rUsername, rPassword); + AuthenticationDialog dialog(mpParent, realm, rUsername); if (dialog.exec() != QDialog::Accepted) return false; rUsername = dialog.getUsername(); rPassword = dialog.getPassword(); + rbMaySavePassword = dialog.maySavePassword();; return true; } Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/src/dialogs/commit.cpp 2007-01-15 18:46:13 UTC (rev 154) @@ -21,6 +21,7 @@ #include "dialogs/commit.h" #include "commit_summary_cache.h" +#include "dialogs/authentication.h" #include "dialogs/modificationsmodel.h" #include "dialogs/progress.h" #include "dialogs/util.h" @@ -98,6 +99,8 @@ { ProgressDialog progress(this, tr("Committing changes")); mpContext->setStatus(&progress); + SvnUiAuthentication auth(this); + mpContext->setAuthentication(&auth); QStringList files; foreach(Modification mod, mpModificationsModel->getSelectedModifications()) Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-15 18:46:13 UTC (rev 154) @@ -132,16 +132,10 @@ void MainWindow::update() { - // BEGIN HARDCODE - prompt for username/password - /* - SvnUiAuthentication auth(this); - if (!auth.getAuthentication(tr("default_username"))) - return; - */ - // END HARDCODE - ProgressDialog progress(this, tr("Updating Working Copy")); mpContext->setStatus(&progress); + SvnUiAuthentication auth(this); + mpContext->setAuthentication(&auth); QString error; if (!Svn::update(*mpContext, mPath, Revision::head(), error)) QMessageBox::critical(this, "", error); Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/src/svn/wc_operations.cpp 2007-01-15 18:46:13 UTC (rev 154) @@ -157,20 +157,18 @@ return true; } -svn_error_t* simpleAuthPrompt(svn_auth_cred_simple_t **cred, void *baton, const char * /*realm*/, const char *username, svn_boolean_t /*_may_save*/, apr_pool_t *pool) +svn_error_t* simpleAuthPrompt(svn_auth_cred_simple_t **cred, void *baton, const char * realm, const char *username, svn_boolean_t /*_may_save*/, apr_pool_t *pool) { QString promptUsername = username; QString promptPassword; SvnAuthentication* pAuth = ((SvnAuthentication*)baton); - if (!pAuth->getAuthentication(promptUsername)) + if (!pAuth->getAuthentication(realm, promptUsername)) return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); svn_auth_cred_simple_t* lcred = (svn_auth_cred_simple_t*)apr_palloc(pool, sizeof (svn_auth_cred_simple_t)); lcred->username = pAuth->getUsername(); lcred->password = pAuth->getPassword(); - - // tell svn if the credentials need to be saved - lcred->may_save = true; + lcred->may_save = pAuth->maySavePassword(); *cred = lcred; return SVN_NO_ERROR; @@ -200,7 +198,7 @@ svn_client_get_ssl_client_cert_pw_file_provider(&provider, rContext.getAprPool()); APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider; - svn_client_get_simple_prompt_provider(&provider, simpleAuthPrompt, rContext.getAuthenticationCallback(), 100000000, rContext.getAprPool()); + svn_client_get_simple_prompt_provider(&provider, simpleAuthPrompt, rContext.getAuthentication(), 100000000, rContext.getAprPool()); APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; svn_auth_baton_t *authBaton; Modified: trunk/ui/authentication.ui =================================================================== --- trunk/ui/authentication.ui 2007-01-13 20:18:10 UTC (rev 153) +++ trunk/ui/authentication.ui 2007-01-15 18:46:13 UTC (rev 154) @@ -1,15 +1,12 @@ <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> <class>AuthenticationDialog</class> <widget class="QDialog" name="AuthenticationDialog" > <property name="geometry" > <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>126</height> + <width>450</width> + <height>174</height> </rect> </property> <property name="windowTitle" > @@ -23,6 +20,23 @@ <number>6</number> </property> <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="realmLabel" > + <property name="text" > + <string>Realm: </string> + </property> + </widget> + </item> + </layout> + </item> + <item> <layout class="QGridLayout" > <property name="margin" > <number>0</number> @@ -102,7 +116,6 @@ </item> </layout> </widget> - <pixmapfunction></pixmapfunction> <tabstops> <tabstop>usernameEdit</tabstop> <tabstop>passwordEdit</tabstop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2007-01-15 22:31:47
|
Revision: 155 http://svn.sourceforge.net/grandmas-svn/?rev=155&view=rev Author: matthiasmiller Date: 2007-01-15 14:31:47 -0800 (Mon, 15 Jan 2007) Log Message: ----------- fix compile errors Modified Paths: -------------- trunk/include/svn/server_access.h trunk/tests/svn_test.h Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2007-01-15 18:46:13 UTC (rev 154) +++ trunk/include/svn/server_access.h 2007-01-15 22:31:47 UTC (rev 155) @@ -90,7 +90,9 @@ { public: virtual ~SvnAuthenticationUnimpl() {} - virtual bool getAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*IN OUT*/bool& rbMaySavePassword) + +private: + virtual bool derived_GetAuthentication(QString realm, /*IN OUT*/QString& rUsername, /*OUT*/QString& rPassword, /*IN OUT*/bool& rbMaySavePassword) { Q_UNUSED(realm); Q_UNUSED(rUsername); Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2007-01-15 18:46:13 UTC (rev 154) +++ trunk/tests/svn_test.h 2007-01-15 22:31:47 UTC (rev 155) @@ -32,21 +32,6 @@ struct svn_client_ctx_t; struct svn_info_t; -class NoOperationStatus : public SvnOperationStatus -{ -public: - virtual ~NoOperationStatus() {} - virtual void update(QString textToAdd) { textToAdd=textToAdd; } - - virtual bool shouldCancel() { return false; } -}; - -class NoAuthentication : public SvnAuthentication -{ -protected: - virtual bool getAuthentication(QString& /*rUsername*/, QString& /*rPassword*/) { return false; } -}; - class SvnTester : public QObject { Q_OBJECT @@ -78,8 +63,8 @@ void testCommitSummary(); private: - NoOperationStatus mStatus; - NoAuthentication mAuthentication; + SvnOperationStatusUnimpl mStatus; + SvnAuthenticationUnimpl mAuthentication; SvnOperationContext* mpContext; svn_client_ctx_t* mpCtx; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-19 22:07:17
|
Revision: 157 http://svn.sourceforge.net/grandmas-svn/?rev=157&view=rev Author: highjinx Date: 2007-01-19 14:07:12 -0800 (Fri, 19 Jan 2007) Log Message: ----------- * Separate the concept of a repo path and a relative file path in the Svn api. This should fix diffing, etc. Modified Paths: -------------- trunk/include/svn/file_access.h trunk/include/svn/helpers.h trunk/include/svn/wc_operations.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/dialogs/revisionsmodel.cpp trunk/src/svn/file_access.cpp trunk/src/svn/helpers.cpp trunk/src/svn/svn_commit.cpp trunk/src/svn/wc_operations.cpp trunk/tests/svn_test.cpp Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/include/svn/file_access.h 2007-01-19 22:07:12 UTC (rev 157) @@ -27,7 +27,9 @@ class RepoFileAccess { public: - static bool getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError); - static bool getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); + static bool getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, + Revision rev, QString& rCreatedFilePath, QString& rError); + static bool getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, + Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); }; Modified: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/include/svn/helpers.h 2007-01-19 22:07:12 UTC (rev 157) @@ -28,11 +28,15 @@ namespace Svn { + // Subversion-specific helpers apr_array_header_t* aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool); QString formatSvnErrorMessage(svn_error_t* pError); + // Misc file, dir and string helpers bool removePrefixNoCase(QString& rString, QString prefix); bool addSuffixUnlessExists(QString& rString, QString suffix); bool removeDirectory(QString dirPath); + + QString combinePaths(QString path, QString addition); }; Modified: trunk/include/svn/wc_operations.h =================================================================== --- trunk/include/svn/wc_operations.h 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/include/svn/wc_operations.h 2007-01-19 22:07:12 UTC (rev 157) @@ -27,12 +27,12 @@ namespace Svn { - bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); - bool cleanup(SvnOperationContext& rContext, const QString& filePath, QString& rError); - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); - bool remove(SvnOperationContext& rContext, const QString& filePath, QString& rError); // equivalent to svn del - bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); - bool revert(SvnOperationContext& rContext, const QString& filePath, QString& rError); + bool add(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); + bool cleanup(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); + bool commit(SvnOperationContext& rContext, QString commitMessage, const QString& repoPath, const QStringList& relFilePaths, QString& rError); + bool remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); // equivalent to svn del + bool update(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, const Revision& revision, QString& rError); + bool revert(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); } Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/dialogs/commit.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -109,21 +109,21 @@ } QString error; - if (bUpdate && !Svn::update(*mpContext, mPath, Revision::head(), error)) + if (bUpdate && !Svn::update(*mpContext, mPath, "", Revision::head(), error)) { QMessageBox::critical(this, tr("Update Error"), error); reject(); return; } - if (!Svn::commit(*mpContext, mCommitMessage, files, error)) + if (!Svn::commit(*mpContext, mCommitMessage, mPath, files, error)) { QMessageBox::critical(this, tr("Commit Error"), error); reject(); return; } - if (bUpdate && !Svn::update(*mpContext, mPath, Revision::head(), error)) + if (bUpdate && !Svn::update(*mpContext, mPath, "", Revision::head(), error)) { QMessageBox::critical(this, tr("Update Error"), error); reject(); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -137,7 +137,7 @@ SvnUiAuthentication auth(this); mpContext->setAuthentication(&auth); QString error; - if (!Svn::update(*mpContext, mPath, Revision::head(), error)) + if (!Svn::update(*mpContext, mPath, "", Revision::head(), error)) QMessageBox::critical(this, "", error); mpContext->setStatus(NULL); @@ -148,7 +148,7 @@ void MainWindow::cleanup() { QString error; - if (!Svn::cleanup(*mpContext, mPath, error)) + if (!Svn::cleanup(*mpContext, mPath, "", error)) QMessageBox::critical(this, "", error); } @@ -177,7 +177,7 @@ { // Generate each side of the diff QString error, leftPath, rightPath; - if (!RepoFileAccess::getDiffFiles(*mpContext, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) + if (!RepoFileAccess::getDiffFiles(*mpContext, mPath, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) { QMessageBox::critical(this, "", error); return; @@ -212,7 +212,7 @@ Q_FOREACH(Modification mod, mods) { QString error; - if (!Svn::revert(*mpContext, mod.getFilePath(), error)) + if (!Svn::revert(*mpContext, mPath, mod.getFilePath(), error)) { QMessageBox::critical(this, "", error); return; @@ -229,7 +229,7 @@ Q_FOREACH(Modification mod, mods) { QString error; - if (!Svn::add(*mpContext, mod.getFilePath(), error)) + if (!Svn::add(*mpContext, mPath, mod.getFilePath(), error)) { QMessageBox::critical(this, "", error); return; @@ -246,7 +246,7 @@ Q_FOREACH(Modification mod, mods) { QString error; - if (!Svn::remove(*mpContext, mod.getFilePath(), error)) + if (!Svn::remove(*mpContext, mPath, mod.getFilePath(), error)) { QMessageBox::critical(this, "", error); return; @@ -327,7 +327,7 @@ updateButtons(); } -void MainWindow::afterCommitSummaryAdded(Revision rev) +void MainWindow::afterCommitSummaryAdded(Revision /*rev*/) { // select the uncommitted revision if nothing is selected yet QItemSelectionModel* pSelection = mpUi->revisionsTreeView->selectionModel(); Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/dialogs/modificationsmodel.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -60,7 +60,7 @@ refresh(); } -void ModificationsModel::fetchFailed(Revision startRevision, Revision endRevision, QString error) +void ModificationsModel::fetchFailed(Revision /*startRevision*/, Revision /*endRevision*/, QString /*error*/) { refresh(); } Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/dialogs/revisionsmodel.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -181,7 +181,7 @@ beginInsertRows(QModelIndex(), index, index); } -void RevisionsModel::afterCommitSummaryAdded(Revision rev) +void RevisionsModel::afterCommitSummaryAdded(Revision /*rev*/) { endInsertRows(); } Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/svn/file_access.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -50,16 +50,18 @@ } } -bool RepoFileAccess::getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError) +bool RepoFileAccess::getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, + Revision rev, QString& rCreatedFilePath, QString& rError) { + QString fullLocalPath = Svn::combinePaths(repoPath, relFilePath); if (rev.getType() == Revision::Uncommitted) { - rCreatedFilePath = fullRepoPath; + rCreatedFilePath = fullLocalPath; return true; } // create a new file and suppose we only want // this user to be able to read and write to the file - QFileInfo info(fullRepoPath); + QFileInfo info(fullLocalPath); apr_file_t* pAprFile = NULL; if (!getRandomFilePath(QDir::tempPath(), info.baseName(), info.completeSuffix(), rCreatedFilePath) || apr_file_open(&pAprFile, rCreatedFilePath.toAscii(), APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY, APR_OS_DEFAULT, rContext.getAprPool())) @@ -83,7 +85,7 @@ svn_opt_revision_t svnRev = rev.getSvnRevision(); - const char* svnPath = svn_path_internal_style(fullRepoPath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(fullLocalPath.toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_error_t* pError = svn_client_cat(pStream, fullCanonPath, &svnRev, pCtx, rContext.getAprPool()); if (pError) @@ -98,8 +100,9 @@ return true; } -bool RepoFileAccess::getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError) +bool RepoFileAccess::getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, + Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError) { - return getFile(rContext, fullRepoPath, leftRevision, rLeftFilePath, rError) && getFile(rContext, fullRepoPath, rightRevision, rRightFilePath, rError); + return getFile(rContext, repoPath, relFilePath, leftRevision, rLeftFilePath, rError) && getFile(rContext, repoPath, relFilePath, rightRevision, rRightFilePath, rError); } Modified: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/svn/helpers.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -128,3 +128,9 @@ return true; } + +QString Svn::combinePaths(QString path, QString addition) +{ + return path + QDir::separator() + addition; +} + Modified: trunk/src/svn/svn_commit.cpp =================================================================== --- trunk/src/svn/svn_commit.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/svn/svn_commit.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -1,33 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Matthias Miller * - * ad...@gr... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "dialogs/commit.h" -#include "dialogs/modificationsmodel.h" -#include "dialogs/util.h" -#include "svn/commit_summary.h" -#include "svn/helpers.h" -#include "svn/operation.h" -#include "svn/revision.h" -#include "ui_commit.h" - -#include <QHeaderView> - -#include <svn_client.h> - Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/src/svn/wc_operations.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -38,7 +38,7 @@ class Updater { public: - bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); + bool update(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, const Revision& revision, QString& rError); private: static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t *pool); @@ -52,7 +52,7 @@ Committer() { mpContext = NULL; } ~Committer() {} - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); + bool commit(SvnOperationContext& rContext, QString commitMessage, const QString& repoPath, const QStringList& relFilePaths, QString& rError); private: static svn_error_t* getLogMessage(const char **log_msg, const char ** /*tmp_file*/, const apr_array_header_t * /*commit_items*/, void *baton, apr_pool_t * /*pool*/) @@ -73,9 +73,9 @@ }; } -bool Svn::add(SvnOperationContext& rContext, const QString& filePath, QString& rError) +bool Svn::add(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError) { - const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; @@ -93,9 +93,9 @@ return true; } -bool Svn::cleanup(SvnOperationContext& rContext, const QString& filePath, QString& rError) +bool Svn::cleanup(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError) { - const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; @@ -111,15 +111,15 @@ return true; } -bool Svn::commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) +bool Svn::commit(SvnOperationContext& rContext, QString commitMessage, const QString& repoPath, const QStringList& relFilePaths, QString& rError) { Committer comitter; - return comitter.commit(rContext, commitMessage, filePaths, rError); + return comitter.commit(rContext, commitMessage, repoPath, relFilePaths, rError); } -bool Svn::remove(SvnOperationContext& rContext, const QString& filePath, QString& rError) +bool Svn::remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError) { - const char* svnPath = svn_path_internal_style(filePath.toAscii(), rContext.getAprPool()); + const char* svnPath = svn_path_internal_style(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_client_ctx_t* ctx; @@ -137,9 +137,9 @@ return true; } -bool Svn::revert(SvnOperationContext& rContext, const QString& filePath, QString& rError) +bool Svn::revert(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError) { - const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); @@ -208,13 +208,11 @@ return true; } -bool Svn::Updater::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) +bool Svn::Updater::update(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, const Revision& revision, QString& rError) { rError = ""; mpContext = &rContext; - const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); - svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); if (!initAuthProviders(rContext, ctx, rError)) @@ -225,6 +223,7 @@ svn_opt_revision_t svnRev = revision.getSvnRevision(); + const char* fullCanonPath = svn_path_canonicalize(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); apr_array_header_t *paths = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); svn_error_t* pError = svn_client_update2(NULL, paths, &svnRev, true, false, ctx, rContext.getAprPool()); if (pError) @@ -242,13 +241,13 @@ pThis->mpContext->getStatus()->update(QObject::tr("Updating %1...").arg(notify->path)); } -bool Svn::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) +bool Svn::update(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, const Revision& revision, QString& rError) { Svn::Updater updater; - return updater.update(rContext, filePath, revision, rError); + return updater.update(rContext, repoPath, relFilePath, revision, rError); } -bool Svn::Committer::commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) +bool Svn::Committer::commit(SvnOperationContext& rContext, QString commitMessage, const QString& repoPath, const QStringList& relFilePaths, QString& rError) { mLogMessage = commitMessage; mpContext = &rContext; @@ -265,7 +264,10 @@ ctx->notify_func2 = updateNotifyCallback; ctx->notify_baton2 = this; - apr_array_header_t *filesArray = aprArrayFromQStringList(filePaths, rContext.getAprPool()); + QStringList fullFilePaths; + for (int i = 0; i < relFilePaths.size(); i++) + fullFilePaths << combinePaths(repoPath, relFilePaths[i]); + apr_array_header_t *filesArray = aprArrayFromQStringList(fullFilePaths, rContext.getAprPool()); svn_commit_info_t* pResultingInfo = NULL; svn_error_t* pError = svn_client_commit3(&pResultingInfo, filesArray, true, true, ctx, rContext.getAprPool()); Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2007-01-15 23:43:00 UTC (rev 156) +++ trunk/tests/svn_test.cpp 2007-01-19 22:07:12 UTC (rev 157) @@ -175,11 +175,11 @@ assertModsMatch(getWcPath(), Revision::uncommitted(), QList<Modification>() << Modification::creation("first.txt")); - GSVN_VERIFY(Svn::add(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), error)); + GSVN_VERIFY(Svn::add(*mpContext, getWcPath(), "first.txt", error)); assertModsMatch(getWcPath(), Revision::uncommitted(), QList<Modification>() << Modification::addition("first.txt", Revision::uncommitted())); - GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << QDir::convertSeparators(getWcPath()+"/first.txt"), error)); + GSVN_VERIFY(Svn::commit(*mpContext, "test", getWcPath(), QStringList() << "first.txt", error)); assertModsMatch(getWcPath(), Revision::committed(1), QList<Modification>() << Modification::addition("first.txt", Revision::committed(1))); } @@ -191,26 +191,26 @@ // Test committed file QString error; QVERIFY(touchFile("first.txt", "This is the first file")); - GSVN_VERIFY(Svn::add(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), error)); - GSVN_VERIFY(Svn::commit(*mpContext, "test", QStringList() << QDir::convertSeparators(getWcPath()+"/first.txt"), error)); + GSVN_VERIFY(Svn::add(*mpContext, getWcPath(), "first.txt", error)); + GSVN_VERIFY(Svn::commit(*mpContext, "test", getWcPath(), QStringList() << "first.txt", error)); QString filePath; - GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), Revision::committed(1), filePath, error)); + GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, getWcPath(), "first.txt", Revision::committed(1), filePath, error)); QCOMPARE(getFileContents(filePath), QString("This is the first file")); - QVERIFY(filePath != QDir::convertSeparators(getWcPath()+"/first.txt")); // We should not overwrite the WC copy! + QVERIFY(filePath != getWcPath()+"/first.txt"); // We should not overwrite the WC copy! // Test uncommitted file QVERIFY(touchFile("second.txt", "This is the second file")); - GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(QDir::convertSeparators(getWcPath()+"/second.txt")), Revision::uncommitted(), filePath, error)); + GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, getWcPath(), "second.txt", Revision::uncommitted(), filePath, error)); - QCOMPARE(filePath, QDir::convertSeparators(getWcPath()+"/second.txt")); // We should return the WC file path directly if working on uncommitted revisions + QCOMPARE(filePath, getWcPath()+"/second.txt"); // We should return the WC file path directly if working on uncommitted revisions QCOMPARE(getFileContents(filePath), QString("This is the second file")); // Test both committed and uncommitted files QVERIFY(touchFile("first.txt", "This is the first file, now modified")); QString oldFilePath, newFilePath; - GSVN_VERIFY(RepoFileAccess::getDiffFiles(*mpContext, getWcPath()+"/first.txt", Revision::committed(1), Revision::uncommitted(), oldFilePath, newFilePath, error)); + GSVN_VERIFY(RepoFileAccess::getDiffFiles(*mpContext, getWcPath(), "first.txt", Revision::committed(1), Revision::uncommitted(), oldFilePath, newFilePath, error)); QCOMPARE(getFileContents(oldFilePath), QString("This is the first file")); QCOMPARE(getFileContents(newFilePath), QString("This is the first file, now modified")); } @@ -223,8 +223,8 @@ // Test committed file QString error; QVERIFY(touchFile("first.txt", "This is the first file")); - GSVN_VERIFY(Svn::add(*mpContext, getWcPath()+"/first.txt", error)); - GSVN_VERIFY(Svn::commit(*mpContext, "test message", QStringList() << getWcPath()+"/first.txt", error)); + GSVN_VERIFY(Svn::add(*mpContext, getWcPath(), "first.txt", error)); + GSVN_VERIFY(Svn::commit(*mpContext, "test message", getWcPath(), QStringList() << "first.txt", error)); Svn::CommitSummary summary; Svn::CommitSummaryFetcher fetcher; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-20 01:48:17
|
Revision: 158 http://svn.sourceforge.net/grandmas-svn/?rev=158&view=rev Author: highjinx Date: 2007-01-19 17:48:18 -0800 (Fri, 19 Jan 2007) Log Message: ----------- * Allow deleting of unversioned files Modified Paths: -------------- trunk/include/svn/wc_operations.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/wc_operations.cpp Modified: trunk/include/svn/wc_operations.h =================================================================== --- trunk/include/svn/wc_operations.h 2007-01-19 22:07:12 UTC (rev 157) +++ trunk/include/svn/wc_operations.h 2007-01-20 01:48:18 UTC (rev 158) @@ -30,7 +30,7 @@ bool add(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); bool cleanup(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); bool commit(SvnOperationContext& rContext, QString commitMessage, const QString& repoPath, const QStringList& relFilePaths, QString& rError); - bool remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); // equivalent to svn del + bool remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, bool force, QString& rError); // equivalent to svn del bool update(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, const Revision& revision, QString& rError); bool revert(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-19 22:07:12 UTC (rev 157) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-20 01:48:18 UTC (rev 158) @@ -245,8 +245,17 @@ QList<Modification> mods = getSelectedModifications(); Q_FOREACH(Modification mod, mods) { + // If the file was just created, but not added to the repository, just delete it off disk + if (mod.getType() == Modification::Type_Creation) + { + if (QMessageBox::question(this, tr("Delete file?"), tr("Are you sure that you want to delete %1? This will permanently delete the file, with no way to recover.").arg(mod.getFilePath()), + QMessageBox::Yes|QMessageBox::No, QMessageBox::NoButton) != QMessageBox::Yes) + { + continue; + } + } QString error; - if (!Svn::remove(*mpContext, mPath, mod.getFilePath(), error)) + if (!Svn::remove(*mpContext, mPath, mod.getFilePath(), true, error)) { QMessageBox::critical(this, "", error); return; Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-19 22:07:12 UTC (rev 157) +++ trunk/src/svn/wc_operations.cpp 2007-01-20 01:48:18 UTC (rev 158) @@ -117,7 +117,7 @@ return comitter.commit(rContext, commitMessage, repoPath, relFilePaths, rError); } -bool Svn::remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, QString& rError) +bool Svn::remove(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, bool force, QString& rError) { const char* svnPath = svn_path_internal_style(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); @@ -127,7 +127,7 @@ apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); svn_client_commit_info_t* pResultingInfo = NULL; - svn_error_t* pError = svn_client_delete(&pResultingInfo, array, false, ctx, rContext.getAprPool()); + svn_error_t* pError = svn_client_delete(&pResultingInfo, array, force, ctx, rContext.getAprPool()); if (pError) { rError = formatSvnErrorMessage(pError); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-20 02:15:58
|
Revision: 159 http://svn.sourceforge.net/grandmas-svn/?rev=159&view=rev Author: highjinx Date: 2007-01-19 18:15:57 -0800 (Fri, 19 Jan 2007) Log Message: ----------- * Changed the svn file access functions from a class into the Svn namespace Modified Paths: -------------- trunk/include/svn/file_access.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/file_access.cpp trunk/tests/svn_test.cpp Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2007-01-20 01:48:18 UTC (rev 158) +++ trunk/include/svn/file_access.h 2007-01-20 02:15:57 UTC (rev 159) @@ -24,12 +24,11 @@ #include <QString> -class RepoFileAccess +namespace Svn { -public: - static bool getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, - Revision rev, QString& rCreatedFilePath, QString& rError); - static bool getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, - Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); + bool getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, + Revision rev, QString& rCreatedFilePath, QString& rError); + bool getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, + Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-20 01:48:18 UTC (rev 158) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-20 02:15:57 UTC (rev 159) @@ -175,13 +175,19 @@ QList<Modification> mods = getSelectedModifications(); Q_FOREACH(Modification mod, mods) { - // Generate each side of the diff QString error, leftPath, rightPath; - if (!RepoFileAccess::getDiffFiles(*mpContext, mPath, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) + if (mod.getType() == Modification::Type_Addition) { - QMessageBox::critical(this, "", error); - return; } + else + { + // Generate each side of the diff + if (!Svn::getDiffFiles(*mpContext, mPath, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), leftPath, rightPath, error)) + { + QMessageBox::critical(this, "", error); + return; + } + } // Launch the diff bool allowMerge = mod.getRevision().getType() == Revision::Uncommitted; Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2007-01-20 01:48:18 UTC (rev 158) +++ trunk/src/svn/file_access.cpp 2007-01-20 02:15:57 UTC (rev 159) @@ -50,10 +50,10 @@ } } -bool RepoFileAccess::getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, +bool Svn::getFile(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision rev, QString& rCreatedFilePath, QString& rError) { - QString fullLocalPath = Svn::combinePaths(repoPath, relFilePath); + QString fullLocalPath = combinePaths(repoPath, relFilePath); if (rev.getType() == Revision::Uncommitted) { rCreatedFilePath = fullLocalPath; @@ -80,7 +80,7 @@ svn_client_ctx_t* pCtx = NULL; svn_client_create_context(&pCtx, rContext.getAprPool()); - if (!Svn::initAuthProviders(rContext, pCtx, rError)) + if (!initAuthProviders(rContext, pCtx, rError)) return false; svn_opt_revision_t svnRev = rev.getSvnRevision(); @@ -90,7 +90,7 @@ svn_error_t* pError = svn_client_cat(pStream, fullCanonPath, &svnRev, pCtx, rContext.getAprPool()); if (pError) { - rError = Svn::formatSvnErrorMessage(pError); + rError = formatSvnErrorMessage(pError); return false; } @@ -100,7 +100,7 @@ return true; } -bool RepoFileAccess::getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, +bool Svn::getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, const QString& relFilePath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError) { return getFile(rContext, repoPath, relFilePath, leftRevision, rLeftFilePath, rError) && getFile(rContext, repoPath, relFilePath, rightRevision, rRightFilePath, rError); Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2007-01-20 01:48:18 UTC (rev 158) +++ trunk/tests/svn_test.cpp 2007-01-20 02:15:57 UTC (rev 159) @@ -195,13 +195,13 @@ GSVN_VERIFY(Svn::commit(*mpContext, "test", getWcPath(), QStringList() << "first.txt", error)); QString filePath; - GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, getWcPath(), "first.txt", Revision::committed(1), filePath, error)); + GSVN_VERIFY(Svn::getFile(*mpContext, getWcPath(), "first.txt", Revision::committed(1), filePath, error)); QCOMPARE(getFileContents(filePath), QString("This is the first file")); QVERIFY(filePath != getWcPath()+"/first.txt"); // We should not overwrite the WC copy! // Test uncommitted file QVERIFY(touchFile("second.txt", "This is the second file")); - GSVN_VERIFY(RepoFileAccess::getFile(*mpContext, getWcPath(), "second.txt", Revision::uncommitted(), filePath, error)); + GSVN_VERIFY(Svn::getFile(*mpContext, getWcPath(), "second.txt", Revision::uncommitted(), filePath, error)); QCOMPARE(filePath, getWcPath()+"/second.txt"); // We should return the WC file path directly if working on uncommitted revisions QCOMPARE(getFileContents(filePath), QString("This is the second file")); @@ -210,7 +210,7 @@ QVERIFY(touchFile("first.txt", "This is the first file, now modified")); QString oldFilePath, newFilePath; - GSVN_VERIFY(RepoFileAccess::getDiffFiles(*mpContext, getWcPath(), "first.txt", Revision::committed(1), Revision::uncommitted(), oldFilePath, newFilePath, error)); + GSVN_VERIFY(Svn::getDiffFiles(*mpContext, getWcPath(), "first.txt", Revision::committed(1), Revision::uncommitted(), oldFilePath, newFilePath, error)); QCOMPARE(getFileContents(oldFilePath), QString("This is the first file")); QCOMPARE(getFileContents(newFilePath), QString("This is the first file, now modified")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-20 02:49:30
|
Revision: 161 http://svn.sourceforge.net/grandmas-svn/?rev=161&view=rev Author: highjinx Date: 2007-01-19 18:49:31 -0800 (Fri, 19 Jan 2007) Log Message: ----------- * Allow subversion to correctly cache authentication credentials Modified Paths: -------------- trunk/include/svn/server_access.h trunk/src/svn/wc_operations.cpp Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2007-01-20 02:33:28 UTC (rev 160) +++ trunk/include/svn/server_access.h 2007-01-20 02:49:31 UTC (rev 161) @@ -74,8 +74,8 @@ mMaySavePassword = true; return derived_GetAuthentication(realm, mUsername, mPassword, mMaySavePassword); } - const char* getUsername() { return mUsername.toAscii(); } - const char* getPassword() { return mPassword.toAscii(); } + QString getUsername() { return mUsername; } + QString getPassword() { return mPassword; } bool maySavePassword() { return mMaySavePassword; } protected: Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-20 02:33:28 UTC (rev 160) +++ trunk/src/svn/wc_operations.cpp 2007-01-20 02:49:31 UTC (rev 161) @@ -166,8 +166,8 @@ return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); svn_auth_cred_simple_t* lcred = (svn_auth_cred_simple_t*)apr_palloc(pool, sizeof (svn_auth_cred_simple_t)); - lcred->username = pAuth->getUsername(); - lcred->password = pAuth->getPassword(); + lcred->username = apr_pstrdup(pool, pAuth->getUsername().toAscii()); + lcred->password = apr_pstrdup(pool, pAuth->getPassword().toAscii()); lcred->may_save = pAuth->maySavePassword(); *cred = lcred; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-20 21:02:06
|
Revision: 163 http://svn.sourceforge.net/grandmas-svn/?rev=163&view=rev Author: highjinx Date: 2007-01-20 13:02:02 -0800 (Sat, 20 Jan 2007) Log Message: ----------- Add progress display when diffing historical revisions Modified Paths: -------------- trunk/include/svn/revision.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/file_access.cpp trunk/src/svn/revision.cpp Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2007-01-20 20:59:20 UTC (rev 162) +++ trunk/include/svn/revision.h 2007-01-20 21:02:02 UTC (rev 163) @@ -61,6 +61,8 @@ Type getType() const; int getCommittedRevision() const; + + QString getRevisionString(); // svn wrapper functions public: Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-20 20:59:20 UTC (rev 162) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-20 21:02:02 UTC (rev 163) @@ -172,6 +172,9 @@ { mpUi->changesTreeView->setFocus(); + ProgressDialog progress(this, tr("Retrieving files to diff")); + mpContext->setStatus(&progress); + QList<Modification> mods = getSelectedModifications(); Q_FOREACH(Modification mod, mods) { Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2007-01-20 20:59:20 UTC (rev 162) +++ trunk/src/svn/file_access.cpp 2007-01-20 21:02:02 UTC (rev 163) @@ -85,6 +85,7 @@ svn_opt_revision_t svnRev = rev.getSvnRevision(); + rContext.getStatus()->update(QString("Retrieving %1, %2...").arg(relFilePath, QString(rev.getRevisionString()))); const char* svnPath = svn_path_internal_style(fullLocalPath.toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); svn_error_t* pError = svn_client_cat(pStream, fullCanonPath, &svnRev, pCtx, rContext.getAprPool()); Modified: trunk/src/svn/revision.cpp =================================================================== --- trunk/src/svn/revision.cpp 2007-01-20 20:59:20 UTC (rev 162) +++ trunk/src/svn/revision.cpp 2007-01-20 21:02:02 UTC (rev 163) @@ -65,7 +65,7 @@ { svn_opt_revision_t svnRev; svnRev.value.number = mCommittedRevision; - switch (mType) + switch (getType()) { case Uncommitted: svnRev.kind = svn_opt_revision_working; @@ -83,3 +83,19 @@ return svnRev; } +QString Revision::getRevisionString() +{ + switch(getType()) + { + case Uncommitted: + return "working copy"; + case Committed: + return "r" + QString::number(getCommittedRevision()); + case Base: + return "BASE"; + case Head: + return "HEAD"; + } + Q_ASSERT(false); + return ""; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |