grandmas-svn-commit Mailing List for Grandma's SVN
Brought to you by:
matthiasmiller
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
(3) |
Aug
(15) |
Sep
(8) |
Oct
(36) |
Nov
(26) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(18) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mat...@us...> - 2007-03-01 17:55:05
|
Revision: 167 http://svn.sourceforge.net/grandmas-svn/?rev=167&view=rev Author: matthiasmiller Date: 2007-03-01 09:55:02 -0800 (Thu, 01 Mar 2007) Log Message: ----------- Mock up the UI for the search Modified Paths: -------------- trunk/ui/mainwindow.ui Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2007-03-01 17:25:47 UTC (rev 166) +++ trunk/ui/mainwindow.ui 2007-03-01 17:55:02 UTC (rev 167) @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>639</width> - <height>512</height> + <width>718</width> + <height>626</height> </rect> </property> <property name="windowTitle" > @@ -103,7 +103,7 @@ </sizepolicy> </property> <property name="text" > - <string>Commit Log Entry:</string> + <string>Log Message:</string> </property> <property name="buddy" > <cstring>logEdit</cstring> @@ -167,19 +167,6 @@ </property> </widget> </item> - <item row="2" column="0" > - <widget class="QTreeView" name="changesTreeView" > - <property name="selectionMode" > - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - <property name="indentation" > - <number>0</number> - </property> - <property name="itemsExpandable" > - <bool>false</bool> - </property> - </widget> - </item> <item row="2" column="1" > <layout class="QVBoxLayout" > <property name="margin" > @@ -247,6 +234,13 @@ </widget> </item> <item> + <widget class="QPushButton" name="moveButton" > + <property name="text" > + <string>&Move/Rename...</string> + </property> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Vertical</enum> @@ -260,58 +254,126 @@ </spacer> </item> <item> - <widget class="QPushButton" name="moveButton" > + <widget class="QPushButton" name="toggleSearchButton" > + <property name="enabled" > + <bool>false</bool> + </property> <property name="text" > - <string>&Move/Rename...</string> + <string>S&how Search ></string> </property> </widget> </item> + </layout> + </item> + <item row="2" column="0" > + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> <item> + <widget class="QTreeView" name="changesTreeView" > + <property name="selectionMode" > + <enum>QAbstractItemView::ExtendedSelection</enum> + </property> + <property name="indentation" > + <number>0</number> + </property> + <property name="itemsExpandable" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="revisionsLabel" > + <property name="text" > + <string>Recent Activity:</string> + </property> + <property name="buddy" > + <cstring>revisionsTreeView</cstring> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0" > + <widget class="QTreeView" name="revisionsTreeView" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>100</height> + </size> + </property> + <property name="selectionMode" > + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="indentation" > + <number>0</number> + </property> + <property name="rootIsDecorated" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="1" > + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Search For:</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="lineEdit" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Vertical</enum> </property> + <property name="sizeType" > + <enum>QSizePolicy::MinimumExpanding</enum> + </property> <property name="sizeHint" > <size> <width>20</width> - <height>40</height> + <height>10</height> </size> </property> </spacer> </item> + <item> + <widget class="QPushButton" name="searchButton" > + <property name="text" > + <string>&Search</string> + </property> + </widget> + </item> </layout> </item> </layout> </item> - <item> - <widget class="QLabel" name="revisionsLabel" > - <property name="text" > - <string>Recent Activity:</string> - </property> - <property name="buddy" > - <cstring>revisionsTreeView</cstring> - </property> - </widget> - </item> - <item> - <widget class="QTreeView" name="revisionsTreeView" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>100</height> - </size> - </property> - <property name="selectionMode" > - <enum>QAbstractItemView::SingleSelection</enum> - </property> - <property name="indentation" > - <number>0</number> - </property> - <property name="rootIsDecorated" > - <bool>true</bool> - </property> - </widget> - </item> </layout> </widget> <widget class="QStatusBar" name="statusbar" /> @@ -320,7 +382,7 @@ <rect> <x>0</x> <y>0</y> - <width>639</width> + <width>718</width> <height>29</height> </rect> </property> @@ -375,7 +437,6 @@ </widget> <tabstops> <tabstop>logEdit</tabstop> - <tabstop>changesTreeView</tabstop> <tabstop>diffButton</tabstop> <tabstop>revertButton</tabstop> <tabstop>addButton</tabstop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-03-01 17:25:55
|
Revision: 166 http://svn.sourceforge.net/grandmas-svn/?rev=166&view=rev Author: highjinx Date: 2007-03-01 09:25:47 -0800 (Thu, 01 Mar 2007) Log Message: ----------- * Fix crash when updating to revision Modified Paths: -------------- trunk/src/dialogs/updateToRevision.cpp Modified: trunk/src/dialogs/updateToRevision.cpp =================================================================== --- trunk/src/dialogs/updateToRevision.cpp 2007-03-01 17:18:06 UTC (rev 165) +++ trunk/src/dialogs/updateToRevision.cpp 2007-03-01 17:25:47 UTC (rev 166) @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "dialogs/progress.h" #include "dialogs/updateToRevision.h" #include "dialogs/util.h" #include "svn/helpers.h" @@ -94,5 +95,7 @@ bool UpdateToRevisionDialog::updateToRevision(QString relDirPath, Revision rev, QString& rError) { + ProgressDialog progress(this, tr("Updating to revision")); + mpContext->setStatus(&progress); return Svn::update(*mpContext, mRepoPath, relDirPath, rev, rError); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-03-01 17:18:29
|
Revision: 165 http://svn.sourceforge.net/grandmas-svn/?rev=165&view=rev Author: highjinx Date: 2007-03-01 09:18:06 -0800 (Thu, 01 Mar 2007) Log Message: ----------- * Implemented Update to Revision functionality * Improved error messages when we are unable to get commit summary history * Update .kdevelop project to 3.4 Modified Paths: -------------- trunk/grandmas_svn.kdevelop trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/include/dialogs/revisionsmodel.h trunk/include/svn/wc_info.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/revisionsmodel.cpp trunk/src/svn/wc_info.cpp trunk/src/svn/wc_operations.cpp trunk/ui/mainwindow.ui Added Paths: ----------- trunk/include/dialogs/updateToRevision.h trunk/src/dialogs/updateToRevision.cpp trunk/ui/updateToRevision.ui Modified: trunk/grandmas_svn.kdevelop =================================================================== --- trunk/grandmas_svn.kdevelop 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/grandmas_svn.kdevelop 2007-03-01 17:18:06 UTC (rev 165) @@ -12,8 +12,9 @@ <ignoreparts/> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description></description> + <description/> <versioncontrol/> + <projectname>grandmas_svn</projectname> </general> <kdevfileview> <groups> @@ -69,16 +70,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></configGdbScript> - <runShellScript></runShellScript> - <runGdbScript></runGdbScript> + <configGdbScript/> + <runShellScript/> + <runGdbScript/> </general> <display> <staticmembers>false</staticmembers> @@ -90,7 +91,7 @@ <kdevtrollproject> <run> <mainprogram>bin/debug/grandmas-svn</mainprogram> - <programargs></programargs> + <programargs/> <directoryradio>build</directoryradio> <customdirectory>/</customdirectory> <terminal>false</terminal> @@ -105,7 +106,7 @@ <runmultiplejobs>false</runmultiplejobs> <numberofjobs>1</numberofjobs> <dontact>false</dontact> - <makebin></makebin> + <makebin/> <prio>0</prio> <envvars/> </make> @@ -155,14 +156,34 @@ <codeCompletionDelay>250</codeCompletionDelay> <argumentsHintDelay>400</argumentsHintDelay> <headerCompletionDelay>250</headerCompletionDelay> + <showOnlyAccessibleItems>false</showOnlyAccessibleItems> + <completionBoxItemOrder>0</completionBoxItemOrder> + <howEvaluationContextMenu>true</howEvaluationContextMenu> + <showCommentWithArgumentHint>true</showCommentWithArgumentHint> + <statusBarTypeEvaluation>false</statusBarTypeEvaluation> + <namespaceAliases>std=_GLIBCXX_STD;__gnu_cxx=std</namespaceAliases> + <processPrimaryTypes>true</processPrimaryTypes> + <processFunctionArguments>false</processFunctionArguments> + <preProcessAllHeaders>false</preProcessAllHeaders> + <parseMissingHeaders>false</parseMissingHeaders> + <resolveIncludePaths>true</resolveIncludePaths> + <alwaysParseInBackground>true</alwaysParseInBackground> + <usePermanentCaching>true</usePermanentCaching> + <alwaysIncludeNamespaces>false</alwaysIncludeNamespaces> + <includePaths>.;</includePaths> </codecompletion> <qt> <used>true</used> <version>4</version> - <root></root> + <root>/usr/lib/qt4</root> + <includestyle>3</includestyle> + <designerintegration>ExternalDesigner</designerintegration> + <qmake>/usr/bin/qmake-qt4</qmake> + <designer>/usr/bin/designer-qt4</designer> + <designerpluginpaths/> </qt> <creategettersetter> - <prefixGet></prefixGet> + <prefixGet/> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/grandmas_svn.pro 2007-03-01 17:18:06 UTC (rev 165) @@ -192,6 +192,7 @@ ui/move.ui \ ui/open.ui \ ui/progress.ui \ + ui/updateToRevision.ui ICON = ui/icons/mac.icns RESOURCES = ui/grandmas-svn.qrc @@ -209,6 +210,7 @@ include/dialogs/open.h \ include/dialogs/progress.h \ include/dialogs/revisionsmodel.h \ + include/dialogs/updateToRevision.h \ include/dialogs/util.h \ include/diff.h \ include/nullable.h \ @@ -238,6 +240,7 @@ src/dialogs/open.cpp \ src/dialogs/progress.cpp \ src/dialogs/revisionsmodel.cpp \ + src/dialogs/updateToRevision.cpp \ src/dialogs/util.cpp \ src/diff.cpp \ src/settings/userpaths.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/include/dialogs/mainwindow.h 2007-03-01 17:18:06 UTC (rev 165) @@ -57,12 +57,13 @@ void remove(); void revert(); void update(); + void updateToRevision(); 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(); @@ -77,6 +78,8 @@ CommitSummaryCache* mpCommitSummaryCache; ModificationsModel* mpModificationsModel; RevisionsModel* mpRevisionsModel; + + bool mUncommittedRevSelected; }; #endif Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/include/dialogs/revisionsmodel.h 2007-03-01 17:18:06 UTC (rev 165) @@ -22,6 +22,7 @@ #include <QAbstractListModel> class CommitSummaryCache; +class QStringList; namespace Svn { class CommitSummary; @@ -51,8 +52,11 @@ private: static QString getRevisionAsString(Revision rev); static QString getDateTimeAsString(QDateTime dateTime); + + QStringList getFetchErrors() const; CommitSummaryCache* mpCommitSummaryCache; - QString mError; + QString mCommittedFetchError; + QString mUncommittedFetchError; }; Added: trunk/include/dialogs/updateToRevision.h =================================================================== --- trunk/include/dialogs/updateToRevision.h (rev 0) +++ trunk/include/dialogs/updateToRevision.h 2007-03-01 17:18:06 UTC (rev 165) @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + + +#ifndef DIALOGS_UPDATETOREVISION_H_ +#define DIALOGS_UPDATETOREVISION_H_ + +#include <Qt> +#include <QDialog> + +#include "svn/revision.h" + +class SvnOperationContext; +class Ui_UpdateToRevisionDialog; + +class UpdateToRevisionDialog : public QDialog +{ + Q_OBJECT + +public: + UpdateToRevisionDialog(SvnOperationContext* pContext, QString repoPath, QWidget* pParent); + ~UpdateToRevisionDialog(); + +private slots: + void browse(); + void update(); + +protected: + bool updateToRevision(QString relDirPath, Revision rev, QString& error); + +private: + Ui_UpdateToRevisionDialog* mpUi; + + SvnOperationContext* mpContext; + QString mRepoPath; + QString mDirPath; +}; + +#endif Modified: trunk/include/svn/wc_info.h =================================================================== --- trunk/include/svn/wc_info.h 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/include/svn/wc_info.h 2007-03-01 17:18:06 UTC (rev 165) @@ -29,4 +29,6 @@ // Functions to get information about the working copy 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& rFullPath, QString fullRepoPath, QString& rError); + + bool getRepoBaseRevision(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString fullRepoPath, int& riRevision, QString& rError); } Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/src/dialogs/mainwindow.cpp 2007-03-01 17:18:06 UTC (rev 165) @@ -28,10 +28,12 @@ #include "dialogs/move.h" #include "dialogs/progress.h" #include "dialogs/revisionsmodel.h" +#include "dialogs/updateToRevision.h" #include "diff.h" #include "svn/commit_summary.h" #include "svn/file_access.h" #include "svn/revision.h" +#include "svn/wc_info.h" #include "svn/wc_operations.h" #include "ui_mainwindow.h" @@ -70,7 +72,7 @@ connect(mpUi->addButton, SIGNAL(clicked()), this, SLOT(add())); connect(mpUi->deleteButton, SIGNAL(clicked()), this, SLOT(remove())); 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&))); @@ -145,6 +147,16 @@ reloadCommittedSummaries(); } +void MainWindow::updateToRevision() +{ + // Display dialog + UpdateToRevisionDialog dlg(mpContext, mPath, this); + dlg.exec(); + + reloadUncommittedSummary(); + reloadCommittedSummaries(); +} + void MainWindow::cleanup() { QString error; @@ -289,8 +301,17 @@ { // check whether the uncommitted revision is selected Svn::CommitSummary summary; - bool isUncommitted = getSelectedCommitSummary(summary) && - summary.getRevision().getType() == Revision::Uncommitted; + if (!getSelectedCommitSummary(summary)) + { + mpUi->diffButton->setEnabled(false); + mpUi->revertButton->setEnabled(false); + mpUi->addButton->setEnabled(false); + mpUi->deleteButton->setEnabled(false); + mpUi->moveButton->setEnabled(false); + return; + } + + bool isUncommitted = summary.getRevision().getType() == Revision::Uncommitted; // check for versioned/unversioned mods bool hasVersionedMod = false, hasUnversionedMod = false; @@ -321,17 +342,34 @@ { Q_UNUSED(rcSelected); Q_UNUSED(rcDeselected); - + Svn::CommitSummary commitSummary; if (getSelectedCommitSummary(commitSummary)) { - mpUi->logEdit->setReadOnly(commitSummary.getRevision().getType() != Revision::Uncommitted); + bool uncommittedNowSelected = commitSummary.getRevision().getType() != Revision::Uncommitted; + bool loadCommitSummary = false; + { + // If we're moving from an uncommitted message to a committed one, save the log message. + // If vice-versa, load the log message + + if (uncommittedNowSelected && mUncommittedRevSelected) + Svn::CommitSummary::SaveUncommittedLogMessage(mPath, mpUi->logEdit->toPlainText()); + else if (uncommittedNowSelected && mUncommittedRevSelected) + loadCommitSummary = true; + } + mpUi->logEdit->setReadOnly(uncommittedNowSelected); mpUi->logEdit->document()->setPlainText(commitSummary.getCommitLogMessage()); mpModificationsModel->setRevision(commitSummary.getRevision()); if (commitSummary.getRevision().getType() == Revision::Uncommitted) reloadUncommittedSummary(); + + if (loadCommitSummary) + { + //Svn::CommitSummary::LoadUncommittedLogMessage + } + mUncommittedRevSelected = uncommittedNowSelected; } else mpModificationsModel->clearRevision(); Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/src/dialogs/revisionsmodel.cpp 2007-03-01 17:18:06 UTC (rev 165) @@ -24,6 +24,8 @@ #include "debug.h" #include "svn/commit_summary.h" +#include <QStringList> + RevisionsModel::RevisionsModel(CommitSummaryCache* pCommitSummaryCache) { mpCommitSummaryCache = pCommitSummaryCache; @@ -82,7 +84,7 @@ { Q_UNUSED(rcParent); - if (!mError.isNull()) + if (getFetchErrors().size() > 0) return 1; return 4; @@ -92,8 +94,9 @@ { Q_UNUSED(rcParent); - if (!mError.isNull()) - return 1; + // TODO: think through uncommitted fetch error + if (getFetchErrors().size() > 0) + return getFetchErrors().size() + mpCommitSummaryCache->getCommitSummaries().count(); return mpCommitSummaryCache->getCommitSummaries().count(); } @@ -104,8 +107,8 @@ if (role == Qt::DisplayRole) { - if (!mError.isNull()) - return QVariant(); + if (getFetchErrors().size() > 0) + return section == 0 ? "Error:" : QVariant(); switch (section) { @@ -125,8 +128,13 @@ if (role == Qt::DisplayRole) { // display the error - if (!mError.isNull()) - return mError; + if (getFetchErrors().size() > 0) + { + if (rcIndex.row() == 0 && !mUncommittedFetchError.isNull()) + return mUncommittedFetchError; + if (rcIndex.row() == 1 && !mCommittedFetchError.isNull()) + return mCommittedFetchError; + } Svn::CommitSummary summary; if (!rcIndex.isValid() || !getCommitSummaryForRow(rcIndex.row(), summary)) @@ -154,8 +162,10 @@ bool RevisionsModel::getCommitSummaryForRow(int row, Svn::CommitSummary& rSummary) const { // showing error? - if (!mError.isNull()) + if (row == 0 && !mUncommittedFetchError.isNull()) return false; + if (row == 1 && !mCommittedFetchError.isNull()) + return false; if (row >= 0 && row < mpCommitSummaryCache->getCommitSummaries().count()) { @@ -168,11 +178,17 @@ void RevisionsModel::beforeCommitSummaryAdded(Revision rev) { - if (!mError.isNull()) + bool revIsCommitted = rev.getType() != Revision::Uncommitted; + if (revIsCommitted && !mCommittedFetchError.isNull()) { - mError = QString(); + mCommittedFetchError = QString(); reset(); } + if (!revIsCommitted && !mUncommittedFetchError.isNull()) + { + mUncommittedFetchError = QString(); + reset(); + } int index = -1; if (CommitSummaryFinder::findByRevision(mpCommitSummaryCache->getCommitSummaries(), rev, index)) @@ -188,8 +204,6 @@ 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())); @@ -201,9 +215,19 @@ { Q_UNUSED(startRevision); Q_UNUSED(endRevision); - if (mpCommitSummaryCache->getCommitSummaries().size() == 0) - { - mError = error; - reset(); - } + if (startRevision.getType() == Revision::Uncommitted || endRevision.getType() == Revision::Uncommitted) + mUncommittedFetchError = error; + else + mCommittedFetchError = error; + reset(); } + +QStringList RevisionsModel::getFetchErrors() const +{ + QStringList errors; + if (!mCommittedFetchError.isNull()) + errors.push_back(mCommittedFetchError); + if (!mUncommittedFetchError.isNull()) + errors.push_back(mUncommittedFetchError); + return errors; +} Added: trunk/src/dialogs/updateToRevision.cpp =================================================================== --- trunk/src/dialogs/updateToRevision.cpp (rev 0) +++ trunk/src/dialogs/updateToRevision.cpp 2007-03-01 17:18:06 UTC (rev 165) @@ -0,0 +1,98 @@ +/*************************************************************************** + * 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/updateToRevision.h" +#include "dialogs/util.h" +#include "svn/helpers.h" +#include "svn/wc_info.h" +#include "svn/wc_operations.h" + +#include "ui_updateToRevision.h" + +#include <QFileDialog> +#include <QMessageBox> + +UpdateToRevisionDialog::UpdateToRevisionDialog(SvnOperationContext* pContext, QString repoPath, QWidget* pParent) : QDialog(pParent) +{ + mpUi = new Ui_UpdateToRevisionDialog(); + mpUi->setupUi(this); + + mpContext = pContext; + mRepoPath = repoPath; + mDirPath = ""; + + connect(mpUi->browseButton, SIGNAL(clicked()), this, SLOT(browse())); + connect(mpUi->updateButton, SIGNAL(clicked()), this, SLOT(update())); + + // Misc UI beautification + QString pathLabel = mpUi->pathLabel->text(); + pathLabel.replace("%s", mRepoPath); + mpUi->pathLabel->setText(pathLabel); + + int baseRevision; + QString error; + if (!Svn::getRepoBaseRevision(*mpContext, NULL, mRepoPath, baseRevision, error)) + { + QMessageBox::critical(this, "", error); + return; + } + mpUi->revisionsSpin->setValue(baseRevision); + mpUi->revisionsSpin->setMaximum(baseRevision); + + +#ifdef Q_WS_MAC + exchangeWidgets(mpUi->hboxLayout1, mpUi->updateButton, mpUi->cancelButton); +#endif +} + +UpdateToRevisionDialog::~UpdateToRevisionDialog() +{ + delete mpUi; + mpUi = NULL; +} + +void UpdateToRevisionDialog::browse() +{ + QString pathToUpdate = QFileDialog::getExistingDirectory(this, tr("Select directory to update"), + mRepoPath, QFileDialog::ShowDirsOnly); + if (pathToUpdate != "") + { + if (Svn::removePrefixNoCase(pathToUpdate, mRepoPath)) + mpUi->pathEdit->setText(pathToUpdate); + else + QMessageBox::critical(this, "Invalid path", "The selected directory is not part of the active repository."); + } +} + +void UpdateToRevisionDialog::update() +{ + QString relDirPath = mpUi->pathEdit->text(); + int revisionNum = mpUi->revisionsSpin->value(); + QString error; + if (updateToRevision(relDirPath, Revision::committed(revisionNum), error)) + accept(); + else + QMessageBox::critical(this, "Update failed", error); +} + +bool UpdateToRevisionDialog::updateToRevision(QString relDirPath, Revision rev, QString& rError) +{ + return Svn::update(*mpContext, mRepoPath, relDirPath, rev, rError); +} Modified: trunk/src/svn/wc_info.cpp =================================================================== --- trunk/src/svn/wc_info.cpp 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/src/svn/wc_info.cpp 2007-03-01 17:18:06 UTC (rev 165) @@ -22,6 +22,7 @@ #include "svn/helpers.h" #include "svn/server_access.h" +#include "svn/wc_operations.h" #include <svn_client.h> #include <svn_path.h> @@ -33,8 +34,21 @@ class SvnInfo { public: - bool getRepoUrls(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelCheckoutPath, QString& rRepoUrlWithPath, QString& rError) + struct RepoInfo { + QString mRelCheckoutPath; + QString mRepoUrlWithPath; + int mBaseRevision; + }; + bool getRepoInfo(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, RepoInfo& rRepoInfo, QString& rError) + { + if (!ctx) + { + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Svn::initAuthProviders(rContext, ctx, rError)) + return false; + } + 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()); if (pError) @@ -42,8 +56,7 @@ rError = Svn::formatSvnErrorMessage(pError); return false; } - rRelCheckoutPath = mRelativeRepoUrl; - rRepoUrlWithPath = mRepoUrlWithPath; + rRepoInfo = mInfo; return true; } @@ -52,35 +65,55 @@ { SvnInfo* pThis = (SvnInfo*)baton; + // Repo URL information QString sRootUrl = info->repos_root_URL; QString sRepoUrl = info->URL; if (!sRepoUrl.startsWith(sRootUrl)) return svn_error_create(SVN_ERR_INCOMPLETE_DATA, NULL, "Invalid repository information."); - pThis->mRepoUrlWithPath = sRepoUrl; + pThis->mInfo.mRepoUrlWithPath = sRepoUrl; sRepoUrl.remove(0, sRootUrl.length()); - pThis->mRelativeRepoUrl = sRepoUrl; + pThis->mInfo.mRelCheckoutPath = sRepoUrl; + + // Repo revision information + pThis->mInfo.mBaseRevision = info->rev; + return NULL; } - QString mRelativeRepoUrl; - QString mRepoUrlWithPath; + RepoInfo mInfo; }; bool Svn::getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError) { - SvnInfo info; - QString ignored; - return info.getRepoUrls(rContext, fullRepoPath, ctx, rRelPath, ignored, rError); + SvnInfo getter; + SvnInfo::RepoInfo info; + if (!getter.getRepoInfo(rContext, fullRepoPath, ctx, info, rError)) + return false; + rRelPath = info.mRelCheckoutPath; + return true; } bool Svn::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); + SvnInfo getter; + SvnInfo::RepoInfo info; + if (!getter.getRepoInfo(rContext, fullRepoPath, ctx, info, rError)) + return false; + rRelPath = info.mRepoUrlWithPath; + return true; } +bool Svn::getRepoBaseRevision(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString fullRepoPath, int& riBaseRevision, QString& rError) +{ + SvnInfo getter; + SvnInfo::RepoInfo info; + if (!getter.getRepoInfo(rContext, fullRepoPath, ctx, info, rError)) + return false; + riBaseRevision = info.mBaseRevision; + return true; +} + Modified: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/src/svn/wc_operations.cpp 2007-03-01 17:18:06 UTC (rev 165) @@ -43,6 +43,15 @@ private: static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t *pool); + static svn_error_t* cancelCallback(void *cancel_baton) + { + Svn::Updater* pThis = (Svn::Updater*)cancel_baton; + if (pThis->mpContext->getStatus()->shouldCancel()) + return svn_error_create(SVN_ERR_CANCELLED, NULL, "User cancelled."); ; + + return SVN_NO_ERROR; + } + SvnOperationContext* mpContext; }; @@ -220,6 +229,8 @@ ctx->notify_func2 = updateNotifyCallback; ctx->notify_baton2 = this; + ctx->cancel_func = cancelCallback; + ctx->cancel_baton = this; svn_opt_revision_t svnRev = revision.getSvnRevision(); Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2007-01-30 04:23:58 UTC (rev 164) +++ trunk/ui/mainwindow.ui 2007-03-01 17:18:06 UTC (rev 165) @@ -321,9 +321,15 @@ <x>0</x> <y>0</y> <width>639</width> - <height>21</height> + <height>29</height> </rect> </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="actionExit" /> + </widget> <widget class="QMenu" name="menuAdvanced" > <property name="title" > <string>Ad&vanced</string> @@ -332,12 +338,6 @@ <addaction name="action_Annotate" /> <addaction name="action_Cleanup" /> </widget> - <widget class="QMenu" name="menu_File" > - <property name="title" > - <string>&File</string> - </property> - <addaction name="actionExit" /> - </widget> <addaction name="menu_File" /> <addaction name="menuAdvanced" /> </widget> @@ -358,18 +358,18 @@ <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" > + </action> + <action name="action_Cleanup" > <property name="text" > - <string>&Cleanup</string> + <string>&Cleanup</string> </property> </action> </widget> @@ -404,9 +404,9 @@ <y>285</y> </hint> </hints> -</connection> -<connection> - <sender>action_Cleanup</sender> + </connection> + <connection> + <sender>action_Cleanup</sender> <signal>triggered()</signal> <receiver>MainWindow</receiver> <slot>cleanup()</slot> @@ -421,5 +421,21 @@ </hint> </hints> </connection> + <connection> + <sender>actionUpdate_Path_to_Revision</sender> + <signal>triggered()</signal> + <receiver>MainWindow</receiver> + <slot>updateToRevision()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>319</x> + <y>295</y> + </hint> + </hints> + </connection> </connections> </ui> Added: trunk/ui/updateToRevision.ui =================================================================== --- trunk/ui/updateToRevision.ui (rev 0) +++ trunk/ui/updateToRevision.ui 2007-03-01 17:18:06 UTC (rev 165) @@ -0,0 +1,152 @@ +<ui version="4.0" > + <class>UpdateToRevisionDialog</class> + <widget class="QDialog" name="UpdateToRevisionDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>349</width> + <height>140</height> + </rect> + </property> + <property name="windowTitle" > + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="pathLabel" > + <property name="lineWidth" > + <number>0</number> + </property> + <property name="text" > + <string>Path (relative to %s):</string> + </property> + <property name="margin" > + <number>-2</number> + </property> + <property name="indent" > + <number>3</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLineEdit" name="pathEdit" /> + </item> + <item> + <widget class="QPushButton" name="browseButton" > + <property name="text" > + <string>Browse...</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Revision:</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="revisionsSpin" > + <property name="minimumSize" > + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximum" > + <number>1000000</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="updateButton" > + <property name="text" > + <string>Update</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton" > + <property name="text" > + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>UpdateToRevisionDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>301</x> + <y>116</y> + </hint> + <hint type="destinationlabel" > + <x>174</x> + <y>69</y> + </hint> + </hints> + </connection> + </connections> +</ui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-30 04:24:00
|
Revision: 164 http://svn.sourceforge.net/grandmas-svn/?rev=164&view=rev Author: highjinx Date: 2007-01-29 20:23:58 -0800 (Mon, 29 Jan 2007) Log Message: ----------- Adding API for annotate feature. No UI tie-in as of yet. Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/svn/revision.h trunk/src/svn/revision.cpp Added Paths: ----------- trunk/include/svn/annotate.h trunk/src/svn/annotate.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2007-01-20 21:02:02 UTC (rev 163) +++ trunk/grandmas_svn.pro 2007-01-30 04:23:58 UTC (rev 164) @@ -213,6 +213,7 @@ include/diff.h \ include/nullable.h \ include/settings/userpaths.h \ + include/svn/annotate.h \ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ @@ -240,6 +241,7 @@ src/dialogs/util.cpp \ src/diff.cpp \ src/settings/userpaths.cpp \ + src/svn/annotate.cpp \ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ Added: trunk/include/svn/annotate.h =================================================================== --- trunk/include/svn/annotate.h (rev 0) +++ trunk/include/svn/annotate.h 2007-01-30 04:23:58 UTC (rev 164) @@ -0,0 +1,54 @@ +/*************************************************************************** + * 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 <Qt> +#include <QDateTime> +#include <QString> + +#include "svn/revision.h" +#include "svn/server_access.h" + +namespace Svn +{ + class AnnotateLine + { + public: + AnnotateLine(); + AnnotateLine(QString author, Revision revision, QDateTime date, QString line); + + bool annotateInfoAvailable(); + + QString getAuthor(); + Revision getRevision(); + QDateTime getDate(); + + QString getLine(); + + protected: + bool mInformationAvailable; + QString mAuthor; + Revision mRevision; + QDateTime mDate; + QString mLine; + }; + + bool getAnnotateInformation(SvnOperationContext& rContext, QString repoPath, QString relFilePath, Revision startRevision, + Revision endRevision, QList<AnnotateLine>& rAnnotateInfo, QString& rError); +} Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2007-01-20 21:02:02 UTC (rev 163) +++ trunk/include/svn/revision.h 2007-01-30 04:23:58 UTC (rev 164) @@ -36,6 +36,7 @@ static Revision base() { Revision rev; rev.mType = Base; rev.mCommittedRevision = 0; return rev; } static Revision head() { Revision rev; rev.mType = Head; rev.mCommittedRevision = 0; return rev; } static Revision fromSvn(svn_opt_revision_t revision); + static Revision fromSvn(svn_revnum_t revision); enum Type { Added: trunk/src/svn/annotate.cpp =================================================================== --- trunk/src/svn/annotate.cpp (rev 0) +++ trunk/src/svn/annotate.cpp 2007-01-30 04:23:58 UTC (rev 164) @@ -0,0 +1,132 @@ +/*************************************************************************** + * 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 "svn/annotate.h" + +#include "svn/helpers.h" +#include "svn/wc_operations.h" + +#include <svn_client.h> +#include <svn_path.h> +#include <QList> + +Svn::AnnotateLine::AnnotateLine() +{ + mInformationAvailable = false; +} + +Svn::AnnotateLine::AnnotateLine(QString author, Revision revision, QDateTime date, QString line) +{ + mInformationAvailable = true; + + mAuthor = author; + mRevision = revision; + mDate = date; + mLine = line; +} + +bool Svn::AnnotateLine::annotateInfoAvailable() +{ + return mInformationAvailable; +} + +QString Svn::AnnotateLine::getAuthor() +{ + Q_ASSERT(annotateInfoAvailable()); + + return mAuthor; +} + +Revision Svn::AnnotateLine::getRevision() +{ + Q_ASSERT(annotateInfoAvailable()); + + return mRevision; +} + +QDateTime Svn::AnnotateLine::getDate() +{ + Q_ASSERT(annotateInfoAvailable()); + + return mDate; +} + +QString Svn::AnnotateLine::getLine() +{ + Q_ASSERT(annotateInfoAvailable()); + + return mLine; +} + +namespace Svn +{ + class AnnotateInfoFetcher + { + public: + AnnotateInfoFetcher() {} + + bool getAnnotateInformation(SvnOperationContext& rContext, QString repoPath, QString relFilePath, + Revision startRevision, Revision endRevision, QList<AnnotateLine>& rAnnotateInfo, QString& rError) + { + const char* svnPath = svn_path_internal_style(combinePaths(repoPath, relFilePath).toAscii(), rContext.getAprPool()); + const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); + + svn_opt_revision_t pegRevision = endRevision.getSvnRevision(); + pegRevision.kind = svn_opt_revision_unspecified; + svn_opt_revision_t svnStartRevision = startRevision.getSvnRevision(); + svn_opt_revision_t svnEndRevision = endRevision.getSvnRevision(); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!initAuthProviders(rContext, ctx, rError)) + return false; + + svn_error_t* pError = svn_client_blame2(fullCanonPath, &pegRevision, &svnStartRevision, &svnEndRevision, annotateInfoCallback, this, ctx, rContext.getAprPool()); + if (pError) + { + rError = formatSvnErrorMessage(pError); + return false; + } + rAnnotateInfo = mAnnotateInfo; + return true; + } + + protected: + static svn_error_t* annotateInfoCallback(void *baton, apr_int64_t line_no, svn_revnum_t revision, + const char *author, const char *date, const char *line, apr_pool_t */*pool*/) + { + AnnotateInfoFetcher* pThis = (AnnotateInfoFetcher*)baton; + + Q_ASSERT(line_no == pThis->mAnnotateInfo.size()); + + pThis->mAnnotateInfo.push_back(AnnotateLine(author, Revision::fromSvn(revision), QDateTime::fromString(date, Qt::ISODate), line)); + return NULL; + } + + QList<AnnotateLine> mAnnotateInfo; + }; +} + +bool Svn::getAnnotateInformation(SvnOperationContext& rContext, QString repoPath, QString relFilePath, Revision startRevision, + Revision endRevision, QList<AnnotateLine>& rAnnotateInfo, QString& rError) +{ + AnnotateInfoFetcher fetcher; + return fetcher.getAnnotateInformation(rContext, repoPath, relFilePath, startRevision, endRevision, rAnnotateInfo, rError); +} Modified: trunk/src/svn/revision.cpp =================================================================== --- trunk/src/svn/revision.cpp 2007-01-20 21:02:02 UTC (rev 163) +++ trunk/src/svn/revision.cpp 2007-01-30 04:23:58 UTC (rev 164) @@ -83,6 +83,11 @@ return svnRev; } +Revision Revision::fromSvn(svn_revnum_t revision) +{ + return committed(revision); +} + QString Revision::getRevisionString() { switch(getType()) 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. |
From: <hig...@us...> - 2007-01-20 20:59:19
|
Revision: 162 http://svn.sourceforge.net/grandmas-svn/?rev=162&view=rev Author: highjinx Date: 2007-01-20 12:59:20 -0800 (Sat, 20 Jan 2007) Log Message: ----------- Display new text in the progress immediately by flushing message queues Modified Paths: -------------- trunk/src/dialogs/progress.cpp Modified: trunk/src/dialogs/progress.cpp =================================================================== --- trunk/src/dialogs/progress.cpp 2007-01-20 02:49:31 UTC (rev 161) +++ trunk/src/dialogs/progress.cpp 2007-01-20 20:59:20 UTC (rev 162) @@ -33,6 +33,12 @@ mpUi->statusLabel->setText(title); show(); + + // Force title and description to be displayed immediately + repaint(); + QApplication::flush(); + QApplication::sendPostedEvents(NULL, 0); + QApplication::processEvents(); } ProgressDialog::~ProgressDialog() @@ -48,7 +54,15 @@ QApplication::processEvents(); if (textToAdd != "") + { mpUi->statusTextEdit->append(textToAdd); + + // Force new text to display immediately + repaint(); + QApplication::flush(); + QApplication::sendPostedEvents(NULL, 0); + QApplication::processEvents(); + } } bool ProgressDialog::shouldCancel() 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 02:33:28
|
Revision: 160 http://svn.sourceforge.net/grandmas-svn/?rev=160&view=rev Author: highjinx Date: 2007-01-19 18:33:28 -0800 (Fri, 19 Jan 2007) Log Message: ----------- * Numerous fixes/improvements to diffing modifications Modified Paths: -------------- trunk/include/svn/file_access.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/file_access.cpp trunk/src/svn/modification.cpp Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2007-01-20 02:15:57 UTC (rev 159) +++ trunk/include/svn/file_access.h 2007-01-20 02:33:28 UTC (rev 160) @@ -30,5 +30,8 @@ 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); + + bool getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, Modification mod, + QString& rLeftFilePath, QString& rRightFilePath, QString& rError); }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-20 02:15:57 UTC (rev 159) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-20 02:33:28 UTC (rev 160) @@ -176,18 +176,12 @@ Q_FOREACH(Modification mod, mods) { QString error, leftPath, rightPath; - if (mod.getType() == Modification::Type_Addition) + // Generate each side of the diff + if (!Svn::getDiffFiles(*mpContext, mPath, mod, leftPath, rightPath, error)) { + 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 02:15:57 UTC (rev 159) +++ trunk/src/svn/file_access.cpp 2007-01-20 02:33:28 UTC (rev 160) @@ -103,6 +103,36 @@ 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); + return getFile(rContext, repoPath, relFilePath, leftRevision, rLeftFilePath, rError) && + getFile(rContext, repoPath, relFilePath, rightRevision, rRightFilePath, rError); } +bool Svn::getDiffFiles(SvnOperationContext& rContext, const QString& repoPath, Modification mod, + QString& rLeftFilePath, QString& rRightFilePath, QString& rError) +{ + switch (mod.getType()) + { + case Modification::Type_FileModification: + return getDiffFiles(rContext, repoPath, mod.getFilePath(), mod.fileModification_getOldRevision(), mod.getRevision(), rLeftFilePath, rRightFilePath, rError); + case Modification::Type_Addition: + if (!mod.isAddedWithHistory()) + rLeftFilePath = ""; + else + { + if (!getFile(rContext, repoPath, mod.getHistoryFilePath(), mod.getHistoryRevision(), rLeftFilePath, rError)) + return false; + } + return getFile(rContext, repoPath, mod.getFilePath(), mod.getRevision(), rRightFilePath, rError); + case Modification::Type_Deletion: + rRightFilePath = ""; + return getFile(rContext, repoPath, mod.getFilePath(), mod.getRevision(), rLeftFilePath, rError); + case Modification::Type_PropertyModification: + case Modification::Type_Conflict: + case Modification::Type_Creation: + case Modification::Type_Missing: + break; + } + + rError = "This modification type is not diffable at this time."; + return false; +} Modified: trunk/src/svn/modification.cpp =================================================================== --- trunk/src/svn/modification.cpp 2007-01-20 02:15:57 UTC (rev 159) +++ trunk/src/svn/modification.cpp 2007-01-20 02:33:28 UTC (rev 160) @@ -122,6 +122,12 @@ return mHistoryFilePath; } +Revision Modification::getHistoryRevision() const +{ + Q_ASSERT(isAddedWithHistory()); + return mHistoryRevision; +} + Revision Modification::fileModification_getOldRevision() const { return mOldRevision; 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 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-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: <mat...@us...> - 2007-01-15 23:43:00
|
Revision: 156 http://svn.sourceforge.net/grandmas-svn/?rev=156&view=rev Author: matthiasmiller Date: 2007-01-15 15:43:00 -0800 (Mon, 15 Jan 2007) Log Message: ----------- correction to r150: remove unused headers Removed Paths: ------------- trunk/include/svn/operation_internal.h trunk/include/svn/operations.h Deleted: trunk/include/svn/operation_internal.h =================================================================== --- trunk/include/svn/operation_internal.h 2007-01-15 22:31:47 UTC (rev 155) +++ trunk/include/svn/operation_internal.h 2007-01-15 23:43:00 UTC (rev 156) @@ -1,40 +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 <QString> - -class SvnOperationContext; -struct svn_client_ctx_t; -struct svn_error_t; -struct svn_info_t; -struct apr_pool_t; - -class RelativeRepoRetriever -{ -public: - bool getRelativeRepoUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString fullRepoUrl, QString& rRelRepoUrl, QString& rError); - -protected: - static svn_error_t* infoCallback(void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool); - -private: - QString mRelPath; -}; - Deleted: trunk/include/svn/operations.h =================================================================== --- trunk/include/svn/operations.h 2007-01-15 22:31:47 UTC (rev 155) +++ trunk/include/svn/operations.h 2007-01-15 23:43:00 UTC (rev 156) @@ -1,38 +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. * - ***************************************************************************/ - - -class SvnOperationContext; -class QString; - -namespace Svn -{ - // operations performed on a working-copy - bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); - bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); - bool revert(SvnOperationContext& rContext, const QString& filePath, QString& rError); - - // Functions to retrieve information about a working copy - 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& rFullPath, QString fullRepoPath, QString& rError); - - bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); - 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-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: <hig...@us...> - 2007-01-13 20:18:10
|
Revision: 153 http://svn.sourceforge.net/grandmas-svn/?rev=153&view=rev Author: highjinx Date: 2007-01-13 12:18:10 -0800 (Sat, 13 Jan 2007) Log Message: ----------- Minor function documentation Modified Paths: -------------- trunk/include/svn/wc_info.h Modified: trunk/include/svn/wc_info.h =================================================================== --- trunk/include/svn/wc_info.h 2007-01-13 20:00:32 UTC (rev 152) +++ trunk/include/svn/wc_info.h 2007-01-13 20:18:10 UTC (rev 153) @@ -26,6 +26,7 @@ namespace Svn { + // Functions to get information about the working copy 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& rFullPath, QString fullRepoPath, QString& rError); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-13 20:00:34
|
Revision: 152 http://svn.sourceforge.net/grandmas-svn/?rev=152&view=rev Author: highjinx Date: 2007-01-13 12:00:32 -0800 (Sat, 13 Jan 2007) Log Message: ----------- * Save commit log if the commit fails * Connect the "Cleanup" menu action to the actual functionality Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/ui/mainwindow.ui Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2007-01-13 18:39:40 UTC (rev 151) +++ trunk/include/dialogs/mainwindow.h 2007-01-13 20:00:32 UTC (rev 152) @@ -48,14 +48,16 @@ virtual void changeEvent(QEvent* pEvent); private slots: - void update(); + void add(); + void cleanup(); void commit(); void diff(); void diff(const QModelIndex& rcIndex); + void move(); + void remove(); void revert(); - void add(); - void remove(); - void move(); + void update(); + void modificationSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void afterCommitSummaryAdded(Revision rev); Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2007-01-13 18:39:40 UTC (rev 151) +++ trunk/src/dialogs/commit.cpp 2007-01-13 20:00:32 UTC (rev 152) @@ -110,18 +110,21 @@ { QMessageBox::critical(this, tr("Update Error"), error); reject(); + return; } if (!Svn::commit(*mpContext, mCommitMessage, files, error)) { QMessageBox::critical(this, tr("Commit Error"), error); reject(); + return; } if (bUpdate && !Svn::update(*mpContext, mPath, Revision::head(), error)) { QMessageBox::critical(this, tr("Update Error"), error); reject(); + return; } accept(); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-13 18:39:40 UTC (rev 151) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-13 20:00:32 UTC (rev 152) @@ -151,6 +151,13 @@ reloadCommittedSummaries(); } +void MainWindow::cleanup() +{ + QString error; + if (!Svn::cleanup(*mpContext, mPath, error)) + QMessageBox::critical(this, "", error); +} + void MainWindow::commit() { CommitDialog dlg(mpContext, mpUi->logEdit->toPlainText(), mPath, this); Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2007-01-13 18:39:40 UTC (rev 151) +++ trunk/ui/mainwindow.ui 2007-01-13 20:00:32 UTC (rev 152) @@ -404,6 +404,22 @@ <y>285</y> </hint> </hints> +</connection> +<connection> + <sender>action_Cleanup</sender> + <signal>triggered()</signal> + <receiver>MainWindow</receiver> + <slot>cleanup()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>323</x> + <y>301</y> + </hint> + </hints> </connection> </connections> </ui> 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-13 17:49:05
|
Revision: 150 http://svn.sourceforge.net/grandmas-svn/?rev=150&view=rev Author: highjinx Date: 2007-01-13 09:49:02 -0800 (Sat, 13 Jan 2007) Log Message: ----------- * Add delete functionality * Consolidate a bunch of little svn operation files into two files, wc_operations and wc_info Modified Paths: -------------- trunk/grandmas_svn.kdevelop trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/file_access.cpp trunk/src/svn/svn_commit.cpp trunk/tests/svn_test.cpp trunk/ui/mainwindow.ui Added Paths: ----------- trunk/include/svn/operations.h trunk/include/svn/wc_info.h trunk/include/svn/wc_operations.h trunk/src/svn/wc_info.cpp trunk/src/svn/wc_operations.cpp Removed Paths: ------------- trunk/include/svn/add.h trunk/include/svn/delete.h trunk/include/svn/operation.h trunk/include/svn/revert.h trunk/include/svn/svn_commit.h trunk/include/svn/update.h trunk/src/svn/add.cpp trunk/src/svn/delete.cpp trunk/src/svn/operation.cpp trunk/src/svn/operation_internal.cpp trunk/src/svn/revert.cpp trunk/src/svn/update.cpp Modified: trunk/grandmas_svn.kdevelop =================================================================== --- trunk/grandmas_svn.kdevelop 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/grandmas_svn.kdevelop 2007-01-13 17:49:02 UTC (rev 150) @@ -90,7 +90,7 @@ <kdevtrollproject> <run> <mainprogram>bin/debug/grandmas-svn</mainprogram> - <programargs>-t</programargs> + <programargs></programargs> <directoryradio>build</directoryradio> <customdirectory>/</customdirectory> <terminal>false</terminal> Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/grandmas_svn.pro 2007-01-13 17:49:02 UTC (rev 150) @@ -213,20 +213,16 @@ include/diff.h \ include/nullable.h \ include/settings/userpaths.h \ - include/svn/add.h \ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ include/svn/helpers.h \ include/svn/modification.h \ - include/svn/operation.h \ - include/svn/operation_internal.h \ include/svn/pool.h \ - include/svn/revert.h \ include/svn/revision.h \ include/svn/server_access.h \ - include/svn/svn_commit.h \ - include/svn/update.h \ + include/svn/wc_info.h \ + include/svn/wc_operations.h \ src/grandmas_svn.h SOURCES += src/commandline.cpp \ @@ -244,20 +240,16 @@ src/dialogs/util.cpp \ src/diff.cpp \ src/settings/userpaths.cpp \ - src/svn/add.cpp \ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ src/svn/helpers.cpp \ src/svn/modification.cpp \ - src/svn/operation.cpp \ - src/svn/operation_internal.cpp \ src/svn/pool.cpp \ - src/svn/revert.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ - src/svn/svn_commit.cpp \ - src/svn/update.cpp \ + src/svn/wc_info.cpp \ + src/svn/wc_operations.cpp \ src/grandmas_svn.cpp \ src/main.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/dialogs/mainwindow.h 2007-01-13 17:49:02 UTC (rev 150) @@ -54,6 +54,7 @@ void diff(const QModelIndex& rcIndex); void revert(); void add(); + void remove(); void move(); void modificationSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); Deleted: trunk/include/svn/add.h =================================================================== --- trunk/include/svn/add.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/svn/add.h 2007-01-13 17:49:02 UTC (rev 150) @@ -1,27 +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. * - ***************************************************************************/ - -class SvnOperationContext; -class QString; - -namespace Svn -{ - bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); -}; Deleted: trunk/include/svn/delete.h =================================================================== Deleted: trunk/include/svn/operation.h =================================================================== --- trunk/include/svn/operation.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/svn/operation.h 2007-01-13 17:49:02 UTC (rev 150) @@ -1,35 +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. * - ***************************************************************************/ - -struct svn_client_ctx_t; -struct svn_error_t; -struct svn_info_t; -struct apr_pool_t; - -class SvnOperationContext; -class QString; - -namespace Operation -{ - 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& rFullPath, QString fullRepoPath, QString& rError); -}; Added: trunk/include/svn/operations.h =================================================================== --- trunk/include/svn/operations.h (rev 0) +++ trunk/include/svn/operations.h 2007-01-13 17:49:02 UTC (rev 150) @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + + +class SvnOperationContext; +class QString; + +namespace Svn +{ + // operations performed on a working-copy + bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); + bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); + bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); + bool revert(SvnOperationContext& rContext, const QString& filePath, QString& rError); + + // Functions to retrieve information about a working copy + 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& rFullPath, QString fullRepoPath, QString& rError); + + bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); + Deleted: trunk/include/svn/revert.h =================================================================== --- trunk/include/svn/revert.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/svn/revert.h 2007-01-13 17:49:02 UTC (rev 150) @@ -1,27 +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. * - ***************************************************************************/ - -class QString; -class SvnOperationContext; - -namespace Svn -{ - bool revert(SvnOperationContext& rContext, const QString& filePath, QString& rError); -}; Deleted: trunk/include/svn/svn_commit.h =================================================================== --- trunk/include/svn/svn_commit.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/svn/svn_commit.h 2007-01-13 17:49:02 UTC (rev 150) @@ -1,5 +0,0 @@ - -namespace Svn -{ - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError); -} Deleted: trunk/include/svn/update.h =================================================================== --- trunk/include/svn/update.h 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/include/svn/update.h 2007-01-13 17:49:02 UTC (rev 150) @@ -1,28 +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. * - ***************************************************************************/ - -class QString; -class SvnOperationContext; -class Revision; - -namespace Svn -{ - bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); -}; Added: trunk/include/svn/wc_info.h =================================================================== --- trunk/include/svn/wc_info.h (rev 0) +++ trunk/include/svn/wc_info.h 2007-01-13 17:49:02 UTC (rev 150) @@ -0,0 +1,31 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + + +class SvnOperationContext; +class QString; + +struct svn_client_ctx_t; + +namespace Svn +{ + 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& rFullPath, QString fullRepoPath, QString& rError); +} Added: trunk/include/svn/wc_operations.h =================================================================== --- trunk/include/svn/wc_operations.h (rev 0) +++ trunk/include/svn/wc_operations.h 2007-01-13 17:49:02 UTC (rev 150) @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + + +class SvnOperationContext; +class QString; +class QStringList; +class Revision; +struct svn_client_ctx_t; + +namespace Svn +{ + bool add(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 initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); +} + Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/dialogs/commit.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -27,8 +27,7 @@ #include "svn/commit_summary.h" #include "svn/file_access.h" #include "svn/revision.h" -#include "svn/svn_commit.h" -#include "svn/update.h" +#include "svn/wc_operations.h" #include "ui_commit.h" #include <QHeaderView> Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/dialogs/mainwindow.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -29,12 +29,10 @@ #include "dialogs/progress.h" #include "dialogs/revisionsmodel.h" #include "diff.h" -#include "svn/add.h" #include "svn/commit_summary.h" #include "svn/file_access.h" -#include "svn/revert.h" #include "svn/revision.h" -#include "svn/update.h" +#include "svn/wc_operations.h" #include "ui_mainwindow.h" #include <QDir> @@ -70,6 +68,7 @@ connect(mpUi->diffButton, SIGNAL(clicked()), this, SLOT(diff())); connect(mpUi->revertButton, SIGNAL(clicked()), this, SLOT(revert())); connect(mpUi->addButton, SIGNAL(clicked()), this, SLOT(add())); + connect(mpUi->deleteButton, SIGNAL(clicked()), this, SLOT(remove())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); mpModificationsModel = new ModificationsModel(mpCommitSummaryCache); @@ -238,6 +237,23 @@ reloadUncommittedSummary(); } +void MainWindow::remove() +{ + mpUi->changesTreeView->setFocus(); + + QList<Modification> mods = getSelectedModifications(); + Q_FOREACH(Modification mod, mods) + { + QString error; + if (!Svn::remove(*mpContext, mod.getFilePath(), error)) + { + QMessageBox::critical(this, "", error); + return; + } + } + reloadUncommittedSummary(); +} + void MainWindow::move() { MoveDialog dlg(this); @@ -276,7 +292,7 @@ mpUi->diffButton->setEnabled(true); mpUi->revertButton->setEnabled(isUncommitted && hasVersionedMod); mpUi->addButton->setEnabled(isUncommitted && hasUnversionedMod); - mpUi->deleteButton->setEnabled(false); + mpUi->deleteButton->setEnabled(isUncommitted); // TODO: yes, this is too loose mpUi->moveButton->setEnabled(false); } Deleted: trunk/src/svn/add.cpp =================================================================== --- trunk/src/svn/add.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/add.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -1,50 +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 "svn/add.h" - -#include "svn/helpers.h" -#include "svn/operation.h" -#include "svn/server_access.h" - -#include <svn_client.h> -#include <svn_path.h> -#include <Qt> - - -bool Svn::add(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()); - if (!Operation::initAuthProviders(rContext, ctx, rError)) - return false; - - svn_error_t* pError = svn_client_add2(fullCanonPath, true, false, ctx, rContext.getAprPool()); - if (pError) - { - rError = formatSvnErrorMessage(pError); - return false; - } - - return true; -} Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/commit_summary.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -20,7 +20,8 @@ #include "svn/commit_summary.h" #include "svn/helpers.h" -#include "svn/operation.h" +#include "svn/wc_info.h" +#include "svn/wc_operations.h" #include <svn_client.h> #include <svn_path.h> @@ -75,13 +76,13 @@ svn_client_ctx_t* ctx; svn_client_create_context(&ctx, rContext.getAprPool()); - if (!Operation::initAuthProviders(rContext, ctx, rError)) + if (!initAuthProviders(rContext, ctx, rError)) return false; svn_error_t* pError = NULL; if (startRevision.getType() != Revision::Uncommitted) { - if (!Operation::getRepoCheckoutUrl(rContext, ctx, mRepoUrl, fullCanonPath, rError)) + if (!getRepoCheckoutUrl(rContext, ctx, mRepoUrl, fullCanonPath, rError)) return false; addSuffixUnlessExists(mRepoUrl, "/"); @@ -104,7 +105,7 @@ { mWcPath = fullCanonPath; addSuffixUnlessExists(mWcPath, "/"); - if (!Operation::getRepoUrlWithPath(rContext, ctx, mRepoUrl, fullCanonPath, rError)) + if (!getRepoUrlWithPath(rContext, ctx, mRepoUrl, fullCanonPath, rError)) return false; addSuffixUnlessExists(mRepoUrl, "/"); Deleted: trunk/src/svn/delete.cpp =================================================================== Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/file_access.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -20,7 +20,8 @@ #include "svn/file_access.h" #include "svn/helpers.h" -#include "svn/operation.h" +#include "svn/wc_info.h" +#include "svn/wc_operations.h" #include <svn_client.h> #include <svn_path.h> @@ -77,7 +78,7 @@ svn_client_ctx_t* pCtx = NULL; svn_client_create_context(&pCtx, rContext.getAprPool()); - if (!Operation::initAuthProviders(rContext, pCtx, rError)) + if (!Svn::initAuthProviders(rContext, pCtx, rError)) return false; svn_opt_revision_t svnRev = rev.getSvnRevision(); Deleted: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/operation.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -1,138 +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 "svn/helpers.h" -#include "svn/operation.h" -#include "svn/server_access.h" - -#include <svn_client.h> -#include <svn_path.h> -#include <apr_pools.h> - -#include <QString> - -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)) - 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; - *cred = lcred; - - return SVN_NO_ERROR; - } - - -bool Operation::initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& /*rError*/) -{ - apr_array_header_t *providers = apr_array_make(rContext.getAprPool(), 7, sizeof(svn_auth_provider_object_t *)); - - svn_auth_provider_object_t *provider; - -#ifdef WIN32 - svn_client_get_windows_simple_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; -#endif - // TODO: keychain provider? - svn_client_get_simple_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - svn_client_get_username_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - - // The server-cert, client-cert, and client-cert-password providers. - svn_client_get_ssl_server_trust_file_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider; - svn_client_get_ssl_client_cert_file_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider; - 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()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - - svn_auth_baton_t *authBaton; - svn_auth_open(&authBaton, providers, rContext.getAprPool()); - - context->auth_baton = authBaton; - return true; -} - -class SvnInfo -{ -public: - 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()); - if (pError) - { - rError = Svn::formatSvnErrorMessage(pError); - return false; - } - rRelCheckoutPath = mRelativeRepoUrl; - rRepoUrlWithPath = mRepoUrlWithPath; - return true; - } - -protected: - static svn_error_t* infoCallback(void *baton, const char * /*path*/, const svn_info_t *info, apr_pool_t * /*pool*/) - { - SvnInfo* pThis = (SvnInfo*)baton; - - QString sRootUrl = info->repos_root_URL; - QString sRepoUrl = info->URL; - - 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; - 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); -} - Deleted: trunk/src/svn/operation_internal.cpp =================================================================== --- trunk/src/svn/operation_internal.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/operation_internal.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -1,21 +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 <svn/operation_internal.h> Deleted: trunk/src/svn/revert.cpp =================================================================== --- trunk/src/svn/revert.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/revert.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -1,51 +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 "svn/revert.h" - -#include "svn/helpers.h" -#include "svn/operation.h" -#include "svn/server_access.h" - -#include <svn_client.h> -#include <svn_path.h> -#include <QStringList> -#include <Qt> - - -bool Svn::revert(SvnOperationContext& rContext, const QString& filePath, QString& rError) -{ - const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); - - svn_client_ctx_t* ctx; - svn_client_create_context(&ctx, rContext.getAprPool()); - if (!Operation::initAuthProviders(rContext, ctx, rError)) - return false; - - apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); - svn_error_t* pError = svn_client_revert(array, true, ctx, rContext.getAprPool()); - if (pError) - { - rError = formatSvnErrorMessage(pError); - return false; - } - - return true; -} Modified: trunk/src/svn/svn_commit.cpp =================================================================== --- trunk/src/svn/svn_commit.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/svn_commit.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -31,66 +31,3 @@ #include <svn_client.h> -namespace Svn -{ - class Committer - { - public: - Committer() { mpContext = NULL; } - ~Committer() {} - - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) - { - mLogMessage = commitMessage; - mpContext = &rContext; - - mpContext->getStatus()->update(QObject::tr("Connecting to server to commit changes...")); - - svn_client_ctx_t* ctx = NULL; - svn_client_create_context(&ctx, rContext.getAprPool()); - if (!Operation::initAuthProviders(rContext, ctx, rError)) - return false; - - ctx->log_msg_func2 = getLogMessage; - ctx->log_msg_baton2 = this; - ctx->notify_func2 = updateNotifyCallback; - ctx->notify_baton2 = this; - - apr_array_header_t *filesArray = aprArrayFromQStringList(filePaths, rContext.getAprPool()); - - svn_commit_info_t* pResultingInfo = NULL; - svn_error_t* pError = svn_client_commit3(&pResultingInfo, filesArray, true, true, ctx, rContext.getAprPool()); - if (pError) - { - rError = formatSvnErrorMessage(pError); - return false; - } - - return true; - } - - 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*/) - { - Svn::Committer* pThis = (Svn::Committer*)baton; - *log_msg = apr_pstrdup(pThis->mpContext->getAprPool(), pThis->mLogMessage.toAscii()); - return NULL; - } - - static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t * /*pool*/) - { - Svn::Committer* pThis = (Svn::Committer*)baton; - pThis->mpContext->getStatus()->update(QObject::tr("Committing %1...").arg(notify->path)); - } - - SvnOperationContext* mpContext; - QString mLogMessage; - }; - - - bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) - { - Svn::Committer comitter; - return comitter.commit(rContext, commitMessage, filePaths, rError); - } -}; Deleted: trunk/src/svn/update.cpp =================================================================== --- trunk/src/svn/update.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/src/svn/update.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -1,85 +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 "svn/update.h" - -#include "svn/helpers.h" -#include "svn/operation.h" -#include "svn/revision.h" -#include "svn/server_access.h" - -#include <svn_client.h> -#include <svn_path.h> -#include <QObject> -#include <QStringList> - -namespace Svn -{ - class Updater - { - public: - bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); - - private: - static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t *pool); - - SvnOperationContext* mpContext; - }; -} - -bool Svn::Updater::update(SvnOperationContext& rContext, const QString& filePath, 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 (!Operation::initAuthProviders(rContext, ctx, rError)) - return false; - - ctx->notify_func2 = updateNotifyCallback; - ctx->notify_baton2 = this; - - svn_opt_revision_t svnRev = revision.getSvnRevision(); - - 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) - { - rError = formatSvnErrorMessage(pError); - return false; - } - - return true; -} - -void Svn::Updater::updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t * /*pool*/) -{ - Svn::Updater* pThis = (Svn::Updater*)baton; - pThis->mpContext->getStatus()->update(QObject::tr("Updating %1...").arg(notify->path)); -} - -bool Svn::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) -{ - Svn::Updater updater; - return updater.update(rContext, filePath, revision, rError); -} Added: trunk/src/svn/wc_info.cpp =================================================================== --- trunk/src/svn/wc_info.cpp (rev 0) +++ trunk/src/svn/wc_info.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -0,0 +1,86 @@ +/*************************************************************************** + * 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 "svn/wc_info.h" + +#include "svn/helpers.h" +#include "svn/server_access.h" + +#include <svn_client.h> +#include <svn_path.h> +#include <apr_pools.h> + +#include <QString> + + +class SvnInfo +{ +public: + 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()); + if (pError) + { + rError = Svn::formatSvnErrorMessage(pError); + return false; + } + rRelCheckoutPath = mRelativeRepoUrl; + rRepoUrlWithPath = mRepoUrlWithPath; + return true; + } + +protected: + static svn_error_t* infoCallback(void *baton, const char * /*path*/, const svn_info_t *info, apr_pool_t * /*pool*/) + { + SvnInfo* pThis = (SvnInfo*)baton; + + QString sRootUrl = info->repos_root_URL; + QString sRepoUrl = info->URL; + + 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 Svn::getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError) +{ + SvnInfo info; + QString ignored; + return info.getRepoUrls(rContext, fullRepoPath, ctx, rRelPath, ignored, rError); +} + +bool Svn::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); +} + Added: trunk/src/svn/wc_operations.cpp =================================================================== --- trunk/src/svn/wc_operations.cpp (rev 0) +++ trunk/src/svn/wc_operations.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -0,0 +1,264 @@ +/*************************************************************************** + * 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 "svn/wc_operations.h" + +#include "svn/helpers.h" +#include "svn/revision.h" +#include "svn/server_access.h" +#include "svn/wc_info.h" + +#include <svn_client.h> +#include <svn_path.h> + +#include <Qt> +#include <QObject> +#include <QStringList> + + +namespace Svn +{ + class Updater + { + public: + bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); + + private: + static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t *pool); + + SvnOperationContext* mpContext; + }; + + class Committer + { + public: + Committer() { mpContext = NULL; } + ~Committer() {} + + bool commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, 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*/) + { + Svn::Committer* pThis = (Svn::Committer*)baton; + *log_msg = apr_pstrdup(pThis->mpContext->getAprPool(), pThis->mLogMessage.toAscii()); + return NULL; + } + + static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t * /*pool*/) + { + Svn::Committer* pThis = (Svn::Committer*)baton; + pThis->mpContext->getStatus()->update(QObject::tr("Committing %1...").arg(notify->path)); + } + + SvnOperationContext* mpContext; + QString mLogMessage; + }; +} + +bool Svn::add(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()); + if (!initAuthProviders(rContext, ctx, rError)) + return false; + + svn_error_t* pError = svn_client_add2(fullCanonPath, true, false, ctx, rContext.getAprPool()); + if (pError) + { + rError = formatSvnErrorMessage(pError); + return false; + } + + return true; +} + + +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::commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) +{ + Committer comitter; + return comitter.commit(rContext, commitMessage, filePaths, rError); +} + +bool Svn::revert(SvnOperationContext& rContext, const QString& filePath, QString& rError) +{ + 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)) + return false; + + apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); + svn_error_t* pError = svn_client_revert(array, true, ctx, rContext.getAprPool()); + if (pError) + { + rError = formatSvnErrorMessage(pError); + return false; + } + + 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) +{ + QString promptUsername = username; + QString promptPassword; + SvnAuthentication* pAuth = ((SvnAuthentication*)baton); + if (!pAuth->getAuthentication(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; + *cred = lcred; + + return SVN_NO_ERROR; +} + +bool Svn::initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& /*rError*/) +{ + apr_array_header_t *providers = apr_array_make(rContext.getAprPool(), 7, sizeof(svn_auth_provider_object_t *)); + + svn_auth_provider_object_t *provider; + +#ifdef WIN32 + svn_client_get_windows_simple_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; +#endif + // TODO: keychain provider? + svn_client_get_simple_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + svn_client_get_username_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + + // The server-cert, client-cert, and client-cert-password providers. + svn_client_get_ssl_server_trust_file_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider; + svn_client_get_ssl_client_cert_file_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider; + 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()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + + svn_auth_baton_t *authBaton; + svn_auth_open(&authBaton, providers, rContext.getAprPool()); + + context->auth_baton = authBaton; + return true; +} + +bool Svn::Updater::update(SvnOperationContext& rContext, const QString& filePath, 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)) + return false; + + ctx->notify_func2 = updateNotifyCallback; + ctx->notify_baton2 = this; + + svn_opt_revision_t svnRev = revision.getSvnRevision(); + + 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) + { + rError = formatSvnErrorMessage(pError); + return false; + } + + return true; +} + +void Svn::Updater::updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t * /*pool*/) +{ + Svn::Updater* pThis = (Svn::Updater*)baton; + pThis->mpContext->getStatus()->update(QObject::tr("Updating %1...").arg(notify->path)); +} + +bool Svn::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) +{ + Svn::Updater updater; + return updater.update(rContext, filePath, revision, rError); +} + +bool Svn::Committer::commit(SvnOperationContext& rContext, QString commitMessage, const QStringList& filePaths, QString& rError) +{ + mLogMessage = commitMessage; + mpContext = &rContext; + + mpContext->getStatus()->update(QObject::tr("Connecting to server to commit changes...")); + + svn_client_ctx_t* ctx = NULL; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Svn::initAuthProviders(rContext, ctx, rError)) + return false; + + ctx->log_msg_func2 = getLogMessage; + ctx->log_msg_baton2 = this; + ctx->notify_func2 = updateNotifyCallback; + ctx->notify_baton2 = this; + + apr_array_header_t *filesArray = aprArrayFromQStringList(filePaths, rContext.getAprPool()); + + svn_commit_info_t* pResultingInfo = NULL; + svn_error_t* pError = svn_client_commit3(&pResultingInfo, filesArray, true, true, ctx, rContext.getAprPool()); + if (pError) + { + rError = formatSvnErrorMessage(pError); + return false; + } + + return true; +} Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/tests/svn_test.cpp 2007-01-13 17:49:02 UTC (rev 150) @@ -20,13 +20,11 @@ #include "svn_test.h" -#include "svn/add.h" -#include "svn/svn_commit.h" #include "svn/commit_summary.h" #include "svn/file_access.h" #include "svn/helpers.h" #include "svn/modification.h" -#include "svn/operation.h" +#include "svn/wc_operations.h" #include <svn_client.h> #include <svn_repos.h> @@ -68,7 +66,7 @@ svn_client_create_context(&mpCtx, mpContext->getAprPool()); QString rIgnoredError; - Q_ASSERT(Operation::initAuthProviders(*mpContext, mpCtx, rIgnoredError)); + Q_ASSERT(Svn::initAuthProviders(*mpContext, mpCtx, rIgnoredError)); } SvnTester::~SvnTester() Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2007-01-13 04:40:39 UTC (rev 149) +++ trunk/ui/mainwindow.ui 2007-01-13 17:49:02 UTC (rev 150) @@ -242,7 +242,7 @@ <item> <widget class="QPushButton" name="deleteButton" > <property name="text" > - <string>Delete...</string> + <string>D&elete...</string> </property> </widget> </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 04:40:39
|
Revision: 149 http://svn.sourceforge.net/grandmas-svn/?rev=149&view=rev Author: highjinx Date: 2007-01-12 20:40:39 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Fix to r148 - actually display all revisions, not just the last one Modified Paths: -------------- trunk/src/svn/commit_summary.cpp trunk/src/svn/commit_summary_thread.cpp Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2007-01-12 17:31:28 UTC (rev 148) +++ trunk/src/svn/commit_summary.cpp 2007-01-13 04:40:39 UTC (rev 149) @@ -142,7 +142,7 @@ Revision revision, bool fetchModifications, CommitSummary& rSummary, QString& rError) { QList<CommitSummary> summaries; - if (!fetchSummaries(rContext, fullRepoPath, revision, revision, -1, fetchModifications, summaries, rError)) + if (!fetchSummaries(rContext, fullRepoPath, revision, revision, 0, fetchModifications, summaries, rError)) return false; GSVN_ASSERT(summaries.size() == 1); Modified: trunk/src/svn/commit_summary_thread.cpp =================================================================== --- trunk/src/svn/commit_summary_thread.cpp 2007-01-12 17:31:28 UTC (rev 148) +++ trunk/src/svn/commit_summary_thread.cpp 2007-01-13 04:40:39 UTC (rev 149) @@ -54,7 +54,7 @@ Svn::CommitSummaryFetcher fetcher; QList<Svn::CommitSummary> summaries; QString error; - if (fetcher.fetchSummaries(context, fullRepoPath, startRevision, endRevision, true, -1, summaries, error)) + if (fetcher.fetchSummaries(context, fullRepoPath, startRevision, endRevision, 0, true, summaries, error)) { qRegisterMetaType<QList<Svn::CommitSummary> >("QList<Svn::CommitSummary>"); emit fetchedSummaries(fullRepoPath, summaries); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-12 17:31:31
|
Revision: 148 http://svn.sourceforge.net/grandmas-svn/?rev=148&view=rev Author: highjinx Date: 2007-01-12 09:31:28 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Adding interface to limit number of returned commit summaries Modified Paths: -------------- trunk/include/svn/commit_summary.h trunk/src/svn/commit_summary.cpp trunk/src/svn/commit_summary_thread.cpp trunk/src/svn/file_access.cpp Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2007-01-12 17:26:51 UTC (rev 147) +++ trunk/include/svn/commit_summary.h 2007-01-12 17:31:28 UTC (rev 148) @@ -68,7 +68,7 @@ { public: // Must be passed a working copy path (TODO: support full repo path) - // iLimitToNumRevisions may be -1, to indicate no limit + // iLimitToNumRevisions may be 0, to indicate no limit bool fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, Revision startRevision, Revision endRevision, int iLimitToNumRevisions, bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError); Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2007-01-12 17:26:51 UTC (rev 147) +++ trunk/src/svn/commit_summary.cpp 2007-01-12 17:31:28 UTC (rev 148) @@ -62,11 +62,14 @@ } bool Svn::CommitSummaryFetcher::fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, - Revision startRevision, Revision endRevision, bool fetchModifications, - QList<CommitSummary>& rSummaries, QString& rError) + Revision startRevision, Revision endRevision, int iLimitToNumRevisions, + bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError) { mSummaries.clear(); rError = ""; + + Q_ASSERT(iLimitToNumRevisions >= 0); + const char* svnPath = svn_path_internal_style(fullRepoPath.toAscii(), rContext.getAprPool()); const char* fullCanonPath = svn_path_canonicalize(svnPath, rContext.getAprPool()); @@ -89,7 +92,7 @@ pError = svn_client_log2(array, &startRev, &endRev, - 0/*limit*/, + iLimitToNumRevisions/*limit*/, fetchModifications/*discover_changed_paths*/, false/*strict_node_history*/, logCallback, @@ -139,7 +142,7 @@ Revision revision, bool fetchModifications, CommitSummary& rSummary, QString& rError) { QList<CommitSummary> summaries; - if (!fetchSummaries(rContext, fullRepoPath, revision, revision, fetchModifications, summaries, rError)) + if (!fetchSummaries(rContext, fullRepoPath, revision, revision, -1, fetchModifications, summaries, rError)) return false; GSVN_ASSERT(summaries.size() == 1); Modified: trunk/src/svn/commit_summary_thread.cpp =================================================================== --- trunk/src/svn/commit_summary_thread.cpp 2007-01-12 17:26:51 UTC (rev 147) +++ trunk/src/svn/commit_summary_thread.cpp 2007-01-12 17:31:28 UTC (rev 148) @@ -54,7 +54,7 @@ Svn::CommitSummaryFetcher fetcher; QList<Svn::CommitSummary> summaries; QString error; - if (fetcher.fetchSummaries(context, fullRepoPath, startRevision, endRevision, true, summaries, error)) + if (fetcher.fetchSummaries(context, fullRepoPath, startRevision, endRevision, true, -1, summaries, error)) { qRegisterMetaType<QList<Svn::CommitSummary> >("QList<Svn::CommitSummary>"); emit fetchedSummaries(fullRepoPath, summaries); Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2007-01-12 17:26:51 UTC (rev 147) +++ trunk/src/svn/file_access.cpp 2007-01-12 17:31:28 UTC (rev 148) @@ -31,7 +31,7 @@ namespace { - bool getRandomFilePath(QString dirPath, QString filePrefix, QString fileExtension, QString& rFilePath, SvnOperationContext& rContext) + bool getRandomFilePath(QString dirPath, QString filePrefix, QString fileExtension, QString& rFilePath) { QString randString; while (true) @@ -60,7 +60,7 @@ // this user to be able to read and write to the file QFileInfo info(fullRepoPath); apr_file_t* pAprFile = NULL; - if (!getRandomFilePath(QDir::tempPath(), info.baseName(), info.completeSuffix(), rCreatedFilePath, rContext) || + 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())) { rError = "Unable to create temporary file."; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2007-01-12 17:26:51
|
Revision: 147 http://svn.sourceforge.net/grandmas-svn/?rev=147&view=rev Author: highjinx Date: 2007-01-12 09:26:51 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Add interface to save commit log message Modified Paths: -------------- trunk/include/svn/commit_summary.h trunk/include/svn/helpers.h trunk/src/svn/commit_summary.cpp trunk/src/svn/helpers.cpp trunk/tests/svn_test.cpp trunk/tests/svn_test.h Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/include/svn/commit_summary.h 2007-01-12 17:26:51 UTC (rev 147) @@ -51,6 +51,10 @@ // This function may be called for working copy revision QList<Modification> modifications() const { return mModifications; } + static bool SaveUncommittedLogMessage(QString fullRepoPath, QString message); + static bool LoadUncommittedLogMessage(QString fullRepoPath, QString& rMessage); + static bool RemoveUncommittedLogMessage(QString fullRepoPath); + protected: friend class CommitSummaryFetcher; QString mAuthor; @@ -64,9 +68,10 @@ { public: // Must be passed a working copy path (TODO: support full repo path) + // iLimitToNumRevisions may be -1, to indicate no limit bool fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, - Revision startRevision, Revision endRevision, bool fetchModifications, - QList<CommitSummary>& rSummaries, QString& rError); + Revision startRevision, Revision endRevision, int iLimitToNumRevisions, + bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError); bool fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, bool fetchModifications, CommitSummary& rSummary, QString& rError); Modified: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/include/svn/helpers.h 2007-01-12 17:26:51 UTC (rev 147) @@ -33,4 +33,6 @@ bool removePrefixNoCase(QString& rString, QString prefix); bool addSuffixUnlessExists(QString& rString, QString suffix); + + bool removeDirectory(QString dirPath); }; Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/src/svn/commit_summary.cpp 2007-01-12 17:26:51 UTC (rev 147) @@ -25,10 +25,42 @@ #include <svn_client.h> #include <svn_path.h> +#include <QDir> +#include <QFile> #include <QStringList> +#include <QTextStream> using namespace Svn; + +bool Svn::CommitSummary::SaveUncommittedLogMessage(QString fullRepoPath, QString message) +{ + QFile file(QDir::convertSeparators(fullRepoPath+"/svn-commit.tmp")); + if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) + return false; + + QTextStream messageWriter(&file); + messageWriter << message; + return file.error() == QFile::NoError; +} + +bool Svn::CommitSummary::LoadUncommittedLogMessage(QString fullRepoPath, QString& rMessage) +{ + QFile file(QDir::convertSeparators(fullRepoPath+"/svn-commit.tmp")); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + return false; + + QTextStream messageReader(&file); + rMessage = messageReader.readAll(); + return file.error() == QFile::NoError; +} + +bool Svn::CommitSummary::RemoveUncommittedLogMessage(QString fullRepoPath) +{ + QFile file(QDir::convertSeparators(fullRepoPath+"/svn-commit.tmp")); + return file.remove(); +} + bool Svn::CommitSummaryFetcher::fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError) Modified: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/src/svn/helpers.cpp 2007-01-12 17:26:51 UTC (rev 147) @@ -20,6 +20,7 @@ #include "svn/helpers.h" +#include <QDir> #include <QString> #include <QStringList> @@ -31,6 +32,32 @@ using namespace Svn; + +namespace +{ + bool clearReadOnlyFlag(QFileInfo file) + { +#ifdef Q_WS_WIN + const wchar_t* path = (const wchar_t*)file.absoluteFilePath().utf16(); + DWORD dwAttr = ::GetFileAttributes(path); + if (dwAttr == (DWORD)~0) + return false; + + if ((dwAttr & FILE_ATTRIBUTE_READONLY) != 0) + { + dwAttr &= ~FILE_ATTRIBUTE_READONLY; + if (!::SetFileAttributes(path, dwAttr)) + return false; + } + + return true; +#else + Q_UNUSED(file); + return false; //unimpl +#endif + } +} + apr_array_header_t* Svn::aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool) { apr_array_header_t* array = apr_array_make(pPool, rList.size(), sizeof(const char*)); @@ -77,3 +104,27 @@ return false; } +bool Svn::removeDirectory(QString dirPath) +{ + QDir dir(dirPath); + QFileInfoList entries = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::Hidden|QDir::System|QDir::AllDirs|QDir::Files); + foreach(QFileInfo entry, entries) + { + if (entry.isDir()) + { + if (!removeDirectory(entry.absoluteFilePath())) + return false; + } + else + { + clearReadOnlyFlag(entry); + if (!QFile::remove(entry.absoluteFilePath())) + return false; + } + } + if (dir.exists() && !dir.rmdir(dirPath)) + return false; + + return true; +} + Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/tests/svn_test.cpp 2007-01-12 17:26:51 UTC (rev 147) @@ -22,9 +22,10 @@ #include "svn/add.h" #include "svn/svn_commit.h" -#include <svn/commit_summary.h> -#include <svn/file_access.h> -#include <svn/modification.h> +#include "svn/commit_summary.h" +#include "svn/file_access.h" +#include "svn/helpers.h" +#include "svn/modification.h" #include "svn/operation.h" #include <svn_client.h> @@ -57,31 +58,7 @@ } while (0) -namespace -{ - bool clearReadOnlyFlag(QFileInfo file) - { -#ifdef Q_WS_WIN - const wchar_t* path = (const wchar_t*)file.absoluteFilePath().utf16(); - DWORD dwAttr = ::GetFileAttributes(path); - if (dwAttr == (DWORD)~0) - return false; - if ((dwAttr & FILE_ATTRIBUTE_READONLY) != 0) - { - dwAttr &= ~FILE_ATTRIBUTE_READONLY; - if (!::SetFileAttributes(path, dwAttr)) - return false; - } - - return true; -#else - Q_UNUSED(file); - return false; //unimpl -#endif - } -} - SvnTester::SvnTester() { apr_pool_t* pool; @@ -114,29 +91,6 @@ return true; } -bool SvnTester::removeDirectory(QString filePath) -{ - QDir dir(filePath); - QFileInfoList entries = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::Hidden|QDir::System|QDir::AllDirs|QDir::Files); - foreach(QFileInfo entry, entries) - { - if (entry.isDir()) - { - if (!removeDirectory(entry.absoluteFilePath())) - return false; - } - else - { - clearReadOnlyFlag(entry); - if (!QFile::remove(entry.absoluteFilePath())) - return false; - } - } - if (dir.exists() && !dir.rmdir(filePath)) - return false; - - return true; -} QString SvnTester::getFileContents(QString filePath) { @@ -186,8 +140,8 @@ void SvnTester::cleanup() { - QVERIFY(removeDirectory(getRepoPath())); - QVERIFY(removeDirectory(getWcPath())); + QVERIFY(Svn::removeDirectory(getRepoPath())); + QVERIFY(Svn::removeDirectory(getWcPath())); } void SvnTester::assertModsMatch(QString wcPath, Revision rev, QList<Modification> mods) Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2006-12-29 15:16:22 UTC (rev 146) +++ trunk/tests/svn_test.h 2007-01-12 17:26:51 UTC (rev 147) @@ -61,7 +61,6 @@ bool touchFile(QString relFilePath, QString fileText); // fails if the file exists - bool removeDirectory(QString filePath); QString getFileContents(QString filePath); void createRepoAndWc(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-29 15:16:23
|
Revision: 146 http://svn.sourceforge.net/grandmas-svn/?rev=146&view=rev Author: matthiasmiller Date: 2006-12-29 07:16:22 -0800 (Fri, 29 Dec 2006) Log Message: ----------- reduce flicker in progress dialog Modified Paths: -------------- trunk/src/dialogs/progress.cpp Modified: trunk/src/dialogs/progress.cpp =================================================================== --- trunk/src/dialogs/progress.cpp 2006-12-22 22:02:27 UTC (rev 145) +++ trunk/src/dialogs/progress.cpp 2006-12-29 15:16:22 UTC (rev 146) @@ -48,20 +48,7 @@ QApplication::processEvents(); if (textToAdd != "") - { - // append the text - QTextEdit* pEdit = mpUi->statusTextEdit; - QString text = pEdit->document()->toPlainText(); - if (text != "") - text += tr("\n"); - text += textToAdd; - pEdit->document()->setPlainText(text); - - // scroll to the bottom - QTextCursor cursor = pEdit->textCursor(); - cursor.movePosition(QTextCursor::End); - pEdit->setTextCursor(cursor); - } + mpUi->statusTextEdit->append(textToAdd); } bool ProgressDialog::shouldCancel() 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...> - 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 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. |