diff --git a/src/svnqt/dirent.cpp b/src/svnqt/dirent.cpp index 4113d685..2c32b737 100644 --- a/src/svnqt/dirent.cpp +++ b/src/svnqt/dirent.cpp @@ -1,189 +1,166 @@ /* * Port for usage with qt-framework and development for kdesvn * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) * http://kdesvn.alwins-world.de */ /* * ==================================================================== * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. * dev@rapidsvn.tigris.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library (in the file LGPL.txt); if not, * write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://rapidsvn.tigris.org/. * ==================================================================== */ // svncpp #include "dirent.h" namespace svn { class SVNQT_NOEXPORT DirEntry_Data { public: QString name; - svn_node_kind_t kind; - qlonglong size; - bool hasProps; - svn_revnum_t createdRev; - DateTime time; QString lastAuthor; + DateTime time; LockEntry m_Lock; + qlonglong size = 0; + svn_revnum_t createdRev = 0; + svn_node_kind_t kind = svn_node_unknown; + bool hasProps = false; - DirEntry_Data() - : kind(svn_node_unknown), size(0), hasProps(false), - createdRev(0), time(0), m_Lock() - { - } - + DirEntry_Data() = default; DirEntry_Data(const QString &_name, const svn_dirent_t *dirEntry) - : name(_name), kind(dirEntry->kind), size(dirEntry->size), - hasProps(dirEntry->has_props != 0), - createdRev(dirEntry->created_rev), time(dirEntry->time), m_Lock() + : name(_name), time(dirEntry->time), size(dirEntry->size), + createdRev(dirEntry->created_rev), kind(dirEntry->kind), + hasProps(dirEntry->has_props != 0) { lastAuthor = dirEntry->last_author == nullptr ? QString() : QString::fromUtf8(dirEntry->last_author); } - - DirEntry_Data(const DirEntry &src) - { - init(src); - } - - void - init(const DirEntry &src) - { - name = src.name(); - kind = src.kind(); - size = src.size(); - hasProps = src.hasProps(); - createdRev = src.createdRev(); - time = src.time(); - lastAuthor = src.lastAuthor(); - m_Lock = src.lockEntry(); - } }; DirEntry::DirEntry() - : m(new DirEntry_Data()) + : m(new DirEntry_Data) { } DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry) : m(new DirEntry_Data(name, dirEntry)) { } DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const svn_lock_t *lockEntry) : m(new DirEntry_Data(name, dirEntry)) { setLock(lockEntry); } DirEntry::DirEntry(const QString &name, const svn_dirent_t *dirEntry, const LockEntry &lockEntry) : m(new DirEntry_Data(name, dirEntry)) { m->m_Lock = lockEntry; } DirEntry::DirEntry(const DirEntry &src) - : m(new DirEntry_Data(src)) + : m(new DirEntry_Data(*src.m)) { } DirEntry::~DirEntry() { delete m; } svn_node_kind_t DirEntry::kind() const { return m->kind; } bool DirEntry::isDir()const { return kind() == svn_node_dir; } qlonglong DirEntry::size() const { return m->size; } bool DirEntry::hasProps() const { return m->hasProps; } svn_revnum_t DirEntry::createdRev() const { return m->createdRev; } const DateTime & DirEntry::time() const { return m->time; } const QString & DirEntry::lastAuthor() const { return m->lastAuthor; } const QString & DirEntry::name() const { return m->name; } const LockEntry & DirEntry::lockEntry() const { return m->m_Lock; } void DirEntry::setLock(const svn_lock_t *_l) { m->m_Lock.init(_l); } DirEntry & DirEntry::operator= (const DirEntry &dirEntry) { if (this == &dirEntry) { return *this; } - m->init(dirEntry); + *m = *dirEntry.m; return *this; } } /* ----------------------------------------------------------------- * local variables: * eval: (load-file "../../rapidsvn-dev.el") * end: */ diff --git a/src/svnqt/entry.cpp b/src/svnqt/entry.cpp index b71a6c87..444b5c6a 100644 --- a/src/svnqt/entry.cpp +++ b/src/svnqt/entry.cpp @@ -1,284 +1,284 @@ /* * Port for usage with qt-framework and development for kdesvn * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) * http://kdesvn.alwins-world.de */ /* * ==================================================================== * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. * dev@rapidsvn.tigris.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library (in the file LGPL.txt); if not, * write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://rapidsvn.tigris.org/. * ==================================================================== */ // svncpp #include "entry.h" namespace svn { class SVNQT_NOEXPORT Entry_private { protected: void init_clean(); public: Entry_private(); - bool m_valid; LockEntry m_Lock; QUrl _url, _repos; + DateTime _cmt_date; QString _name, _uuid, _cmt_author; - bool _copied; svn_revnum_t _revision, _cmt_rev; svn_node_kind_t _kind; - DateTime _cmt_date; + bool m_valid; + bool _copied; /** * initializes the members */ void init(const svn_client_status_t *src); void init(const Entry_private &src); void init(const QString &url, const DirEntry &src); void init(const QString &url, const InfoEntry &src); }; void Entry_private::init_clean() { _name.clear(); _url.clear(); _repos.clear(); _uuid.clear(); _cmt_author.clear(); _revision = _cmt_rev = SVN_INVALID_REVNUM; _kind = svn_node_unknown; _cmt_date = DateTime(); _copied = false; } Entry_private::Entry_private() - : m_valid(false), m_Lock() + : m_valid(false) { init_clean(); } void Entry_private::init(const svn_client_status_t *src) { if (src) { // copy & convert the contents of src _name = QString::fromUtf8(src->local_abspath); _revision = src->revision; _repos = QUrl::fromEncoded(src->repos_root_url); _url = _repos; _url.setPath(_url.path() + QLatin1Char('/') + QString::fromUtf8(src->repos_relpath)); _uuid = QString::fromUtf8(src->repos_uuid); _kind = src->kind; _copied = src->copied != 0; _cmt_rev = src->changed_rev; _cmt_date = DateTime(src->changed_date); _cmt_author = QString::fromUtf8(src->changed_author); m_Lock.init(src->lock); m_valid = true; } else { init_clean(); } } void Entry_private::init(const Entry_private &src) { _name = src._name; _url = src._url; _repos = src._repos; _uuid = src._uuid; _cmt_author = src._cmt_author; _copied = src._copied; _revision = src._revision; _cmt_rev = src._cmt_rev; _kind = src._kind; _cmt_date = src._cmt_date; m_Lock = src.m_Lock; m_valid = src.m_valid; } void Entry_private::init(const QString &url, const DirEntry &dirEntry) { init_clean(); _url = QUrl(url); if (!dirEntry.isEmpty()) { _name = dirEntry.name(); _revision = dirEntry.createdRev(); _kind = dirEntry.kind(); _cmt_rev = dirEntry.createdRev(); _cmt_date = dirEntry.time(); _cmt_author = dirEntry.lastAuthor(); m_Lock = dirEntry.lockEntry(); m_valid = true; } } void Entry_private::init(const QString &url, const InfoEntry &src) { init(nullptr); _name = src.Name(); _url = QUrl(url); _revision = src.revision(); _kind = src.kind(); _cmt_rev = src.cmtRev(); _cmt_date = src.cmtDate(); _cmt_author = src.cmtAuthor(); m_Lock = src.lockEntry(); m_valid = true; } Entry::Entry(const svn_client_status_t *src) : m_Data(new Entry_private()) { m_Data->init(src); } Entry::Entry(const Entry &src) : m_Data(new Entry_private()) { if (src.m_Data) { m_Data->init(*(src.m_Data)); } else { m_Data->init(nullptr); } } Entry::Entry(const QString &url, const DirEntry &src) : m_Data(new Entry_private()) { m_Data->init(url, src); } Entry::Entry(const QString &url, const InfoEntry &src) : m_Data(new Entry_private()) { m_Data->init(url, src); } Entry::~Entry() { delete m_Data; } Entry & Entry::operator = (const Entry &src) { if (this == &src) { return *this; } if (src.m_Data) { m_Data->init(*(src.m_Data)); } else { m_Data->init(nullptr); } return *this; } const LockEntry & Entry::lockEntry()const { return m_Data->m_Lock; } const QString & Entry::cmtAuthor() const { return m_Data->_cmt_author; } const DateTime & Entry::cmtDate() const { return m_Data->_cmt_date; } svn_revnum_t Entry::cmtRev() const { return m_Data->_cmt_rev; } bool Entry::isCopied() const { return m_Data->_copied != 0; } svn_node_kind_t Entry::kind() const { return m_Data->_kind; } const QString & Entry::uuid() const { return m_Data->_uuid; } const QUrl & Entry::repos() const { return m_Data->_repos; } const QUrl & Entry::url() const { return m_Data->_url; } svn_revnum_t Entry::revision() const { return m_Data->_revision; } const QString & Entry::name() const { return m_Data->_name; } bool Entry::isValid() const { return m_Data->m_valid; } } /*! \fn svn::Entry::isDir() */ bool svn::Entry::isDir() const { return kind() == svn_node_dir; } /*! \fn svn::Entry::isFile() */ bool svn::Entry::isFile() const { return kind() == svn_node_file; } diff --git a/src/svnqt/log_entry.h b/src/svnqt/log_entry.h index 04d2fd7c..a32ad3df 100644 --- a/src/svnqt/log_entry.h +++ b/src/svnqt/log_entry.h @@ -1,106 +1,106 @@ /* * Port for usage with qt-framework and development for kdesvn * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) * http://kdesvn.alwins-world.de */ /* * ==================================================================== * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. * dev@rapidsvn.tigris.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library (in the file LGPL.txt); if not, * write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://rapidsvn.tigris.org/. * ==================================================================== */ #ifndef SVNQT_LOG_ENTRY_H #define SVNQT_LOG_ENTRY_H #include #include #include #include #include // apr #include // subversion api #include #include namespace svn { class StringArray; struct LogChangePathEntry { LogChangePathEntry() = default; LogChangePathEntry(const QString &path_, char action_, const QString ©FromPath_, const svn_revnum_t copyFromRevision_) : path(path_) - , action(action_) , copyFromPath(copyFromPath_) , copyFromRevision(copyFromRevision_) + , action(action_) {} QString path; - char action = '\0'; QString copyFromPath; //! future use or useful in backends QString copyToPath; qlonglong copyFromRevision; //! future use or useful in backends qlonglong copyToRevision; + char action = '\0'; }; typedef QVector LogChangePathEntries; class SVNQT_EXPORT LogEntry { public: LogEntry(); LogEntry(svn_log_entry_t *log_entry, const StringArray &excludeList); //! if -1 the entry is a fake entry and not real usable! qlonglong revision; qlonglong date; // apr_time QString author; QString message; LogChangePathEntries changedPaths; QList m_MergedInRevisions; }; } SVNQT_EXPORT QDataStream &operator<<(QDataStream &s, const svn::LogEntry &r); SVNQT_EXPORT QDataStream &operator<<(QDataStream &s, const svn::LogChangePathEntry &r); SVNQT_EXPORT QDataStream &operator>>(QDataStream &s, svn::LogEntry &r); SVNQT_EXPORT QDataStream &operator>>(QDataStream &s, svn::LogChangePathEntry &r); #endif /* ----------------------------------------------------------------- * local variables: * eval: (load-file "../../rapidsvn-dev.el") * end: */ diff --git a/src/svnqt/status.cpp b/src/svnqt/status.cpp index 39376c81..3f9e167e 100644 --- a/src/svnqt/status.cpp +++ b/src/svnqt/status.cpp @@ -1,328 +1,312 @@ /* * Port for usage with qt-framework and development for kdesvn * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) * http://kdesvn.alwins-world.de */ /* * ==================================================================== * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. * dev@rapidsvn.tigris.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library (in the file LGPL.txt); if not, * write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://rapidsvn.tigris.org/. * ==================================================================== */ // svncpp #include "status.h" #include "svnqt/svnqt_defines.h" #include "svnqt/path.h" #include "svnqt/url.h" #include "svn_path.h" namespace svn { class SVNQT_NOEXPORT Status_private { public: - Status_private(); - virtual ~Status_private(); /** * Initialize structures * * @param path * @param status if NULL isVersioned will be false */ void init(const QString &path, const svn_client_status_t *status); void init(const QString &path, const Status_private &src); void init(const QString &url, const DirEntry &src); void init(const QString &url, const InfoEntry &src); void setPath(const QString &); QString m_Path; - bool m_isVersioned; - bool m_hasReal; LockEntry m_Lock; Entry m_entry; - - svn_wc_status_kind m_node_status, m_text_status, m_prop_status, m_repos_text_status, m_repos_prop_status; - bool m_copied, m_switched; + svn_wc_status_kind m_node_status = svn_wc_status_none; + svn_wc_status_kind m_text_status = svn_wc_status_none; + svn_wc_status_kind m_prop_status = svn_wc_status_none; + svn_wc_status_kind m_repos_text_status = svn_wc_status_none; + svn_wc_status_kind m_repos_prop_status = svn_wc_status_none; + bool m_isVersioned = false; + bool m_hasReal = false; + bool m_copied = false; + bool m_switched = false; }; -Status_private::Status_private() - : m_Path() - , m_isVersioned(false) - , m_hasReal(false) - , m_node_status(svn_wc_status_none) - , m_text_status(svn_wc_status_none) - , m_prop_status(svn_wc_status_none) - , m_repos_text_status(svn_wc_status_none) - , m_repos_prop_status(svn_wc_status_none) - , m_copied(false) - , m_switched(false) -{ -} - -Status_private::~ Status_private() -{ -} - void Status_private::setPath(const QString &aPath) { Pool pool; if (!Url::isValid(aPath)) { m_Path = aPath; } else { const char *int_path = svn_path_uri_decode(aPath.toUtf8(), pool.pool()); m_Path = QString::fromUtf8(int_path); } } void Status_private::init(const QString &path, const svn_client_status_t *status) { setPath(path); if (!status) { m_isVersioned = false; m_hasReal = false; m_entry = Entry(); m_Lock = LockEntry(); } else { // now duplicate the contents // svn 1.7 does not count ignored entries as versioned but we do here... m_isVersioned = status->node_status > svn_wc_status_unversioned; m_hasReal = m_isVersioned && status->node_status != svn_wc_status_ignored; m_entry = Entry(status); m_node_status = status->node_status; m_text_status = status->text_status; m_prop_status = status->prop_status; m_copied = status->copied != 0; m_switched = status->switched != 0; m_repos_text_status = status->repos_text_status; m_repos_prop_status = status->repos_prop_status; if (status->repos_lock) { m_Lock.init(status->repos_lock->creation_date, status->repos_lock->expiration_date, status->repos_lock->owner, status->repos_lock->comment, status->repos_lock->token); } else { m_Lock = LockEntry(); } } } void Status_private::init(const QString &path, const Status_private &src) { setPath(path); m_Lock = src.m_Lock; m_entry = src.m_entry; - m_isVersioned = src.m_isVersioned; - m_hasReal = src.m_hasReal; m_node_status = src.m_node_status; m_text_status = src.m_text_status; m_prop_status = src.m_prop_status; m_repos_text_status = src.m_repos_text_status; m_repos_prop_status = src.m_repos_prop_status; + m_isVersioned = src.m_isVersioned; + m_hasReal = src.m_hasReal; m_copied = src.m_copied; m_switched = src.m_switched; } void Status_private::init(const QString &url, const DirEntry &src) { m_entry = Entry(url, src); setPath(url); m_node_status = svn_wc_status_normal; m_text_status = svn_wc_status_normal; m_prop_status = svn_wc_status_normal; if (!src.isEmpty()) { m_Lock = src.lockEntry(); m_isVersioned = true; m_hasReal = true; } m_switched = false; m_repos_text_status = svn_wc_status_normal; m_repos_prop_status = svn_wc_status_normal; } void Status_private::init(const QString &url, const InfoEntry &src) { m_entry = Entry(url, src); setPath(url); m_Lock = src.lockEntry(); m_node_status = svn_wc_status_normal; m_text_status = svn_wc_status_normal; m_prop_status = svn_wc_status_normal; m_repos_text_status = svn_wc_status_normal; m_repos_prop_status = svn_wc_status_normal; m_isVersioned = true; m_hasReal = true; } Status::Status(const Status &src) : m_Data(new Status_private()) { if (&src != this) { if (src.m_Data) { m_Data->init(src.m_Data->m_Path, *(src.m_Data)); } else { m_Data->init(QString(), nullptr); } } } Status::Status(const char *path, const svn_client_status_t *status) : m_Data(new Status_private()) { m_Data->init(QString::fromUtf8(path), status); } Status::Status(const QString &path) : m_Data(new Status_private()) { m_Data->init(path, nullptr); } Status::Status(const QString &url, const DirEntry &src) : m_Data(new Status_private()) { m_Data->init(url, src); } Status::Status(const QString &url, const InfoEntry &src) : m_Data(new Status_private()) { m_Data->init(url, src); } Status::~Status() { delete m_Data; } Status & Status::operator=(const Status &status) { if (this == &status) { return *this; } if (status.m_Data) { m_Data->init(status.m_Data->m_Path, *(status.m_Data)); } else { m_Data->init(status.m_Data->m_Path, nullptr); } return *this; } const LockEntry & Status::lockEntry() const { return m_Data->m_Lock; } svn_wc_status_kind Status::reposPropStatus() const { return m_Data->m_repos_prop_status; } svn_wc_status_kind Status::reposTextStatus() const { return m_Data->m_repos_text_status; } bool Status::isSwitched() const { return m_Data->m_switched != 0; } bool Status::isCopied() const { return m_Data->m_copied; } bool Status::isLocked() const { return m_Data->m_Lock.Locked(); } bool Status::isModified()const { return textStatus() == svn_wc_status_modified || propStatus() == svn_wc_status_modified || textStatus() == svn_wc_status_replaced; } bool Status::isRealVersioned()const { return m_Data->m_hasReal; } bool Status::isVersioned() const { return m_Data->m_isVersioned; } svn_wc_status_kind Status::nodeStatus() const { return m_Data->m_node_status; } svn_wc_status_kind Status::propStatus() const { return m_Data->m_prop_status; } svn_wc_status_kind Status::textStatus() const { return m_Data->m_text_status; } const Entry & Status::entry() const { return m_Data->m_entry; } const QString & Status::path() const { return m_Data->m_Path; } bool Status::validReposStatus()const { return reposTextStatus() != svn_wc_status_none || reposPropStatus() != svn_wc_status_none; } bool Status::validLocalStatus()const { return textStatus() != svn_wc_status_none || propStatus() != svn_wc_status_none; } }