[Pkg-owncloud-commits] [owncloud-client] 292/333: Keep the updater data in the log struct for the synclog.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:17:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit cf87fdff7f33c9bcf67c5a7a486a59c68b8e524d
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Apr 3 16:56:36 2014 +0200

    Keep the updater data in the log struct for the synclog.
    
    Also, shorten the timestamp and add the sync direction.
---
 src/mirall/propagatorjobs.cpp |  6 +++---
 src/mirall/syncengine.cpp     | 16 ++++++++++-----
 src/mirall/syncfileitem.h     |  7 ++++++-
 src/mirall/syncrunfilelog.cpp | 45 +++++++++++++++++++++++++++++++------------
 src/mirall/syncrunfilelog.h   |  1 +
 5 files changed, 54 insertions(+), 21 deletions(-)

diff --git a/src/mirall/propagatorjobs.cpp b/src/mirall/propagatorjobs.cpp
index 61e3d85..4b4699e 100644
--- a/src/mirall/propagatorjobs.cpp
+++ b/src/mirall/propagatorjobs.cpp
@@ -137,7 +137,7 @@ void PropagateRemoteRemove::start()
 
     //  Wed, 15 Nov 1995 06:25:24 GMT
     QDateTime dt = QDateTime::currentDateTimeUtc();
-    _item._responseTimeStamp = dt.toString("ddd, dd MMM yyyy hh:mm:ss GMT");
+    _item._responseTimeStamp = dt.toString("hh:mm:ss");
 
     _propagator->_journal->deleteFileRecord(_item._originalFile, _item._isDirectory);
     _propagator->_journal->commit("Remote Remove");
@@ -158,7 +158,7 @@ void PropagateRemoteMkdir::start()
      * Ignore that error */
     //  Wed, 15 Nov 1995 06:25:24 GMT
     QDateTime dt = QDateTime::currentDateTimeUtc();
-    _item._responseTimeStamp = dt.toString("ddd, dd MMM yyyy hh:mm:ss GMT");
+    _item._responseTimeStamp = dt.toString("hh:mm:ss");
 
     if( updateErrorFromSession( rc , 0, 405 ) ) {
         return;
@@ -248,7 +248,7 @@ void PropagateRemoteRename::start()
     }
     //  Wed, 15 Nov 1995 06:25:24 GMT
     QDateTime dt = QDateTime::currentDateTimeUtc();
-    _item._responseTimeStamp = dt.toString("ddd, dd MMM yyyy hh:mm:ss GMT");
+    _item._responseTimeStamp = dt.toString("hh:mm:ss");
 
     _propagator->_journal->deleteFileRecord(_item._originalFile);
     SyncJournalFileRecord record(_item, _propagator->_localDir + _item._renameTarget);
diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 9e088af..ca5add2 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -368,11 +368,17 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     }
     _needsUpdate = true;
 
-    item.other._etag        = file->other.etag;
-    item.other._fileId      = file->other.file_id;
-    item.other._instruction = file->other.instruction;
-    item.other._modtime     = file->other.modtime;
-    item.other._size        = file->other.size;
+    item.log._etag          = file->etag;
+    item.log._fileId        = file->file_id;
+    item.log._instruction   = file->instruction;
+    item.log._modtime       = file->modtime;
+    item.log._size          = file->size;
+
+    item.log._other_etag        = file->other.etag;
+    item.log._other_fileId      = file->other.file_id;
+    item.log._other_instruction = file->other.instruction;
+    item.log._other_modtime     = file->other.modtime;
+    item.log._other_size        = file->other.size;
 
     _syncedItems.append(item);
     emit syncItemDiscovered(item);
diff --git a/src/mirall/syncfileitem.h b/src/mirall/syncfileitem.h
index e15b231..cd7228b 100644
--- a/src/mirall/syncfileitem.h
+++ b/src/mirall/syncfileitem.h
@@ -99,7 +99,12 @@ public:
         QByteArray  _etag;
         QByteArray  _fileId;
         enum csync_instructions_e _instruction;
-    } other;
+        quint64     _other_size;
+        time_t      _other_modtime;
+        QByteArray  _other_etag;
+        QByteArray  _other_fileId;
+        enum csync_instructions_e _other_instruction;
+    } log;
 };
 
 
diff --git a/src/mirall/syncrunfilelog.cpp b/src/mirall/syncrunfilelog.cpp
index 4291900..bd678ea 100644
--- a/src/mirall/syncrunfilelog.cpp
+++ b/src/mirall/syncrunfilelog.cpp
@@ -11,6 +11,8 @@
  * for more details.
  */
 
+#include <QRegExp>
+
 #include "mirall/syncrunfilelog.h"
 #include "mirall/utility.h"
 #include "mirall/mirallconfigfile.h"
@@ -28,6 +30,17 @@ QString SyncRunFileLog::dateTimeStr( const QDateTime& dt )
     return dt.toString(Qt::ISODate);
 }
 
+QString SyncRunFileLog::directionToStr( SyncFileItem::Direction dir )
+{
+    QString re("N");
+    if( dir == SyncFileItem::Up ) {
+        re = QLatin1String("Up");
+    } else if( dir == SyncFileItem::Down ) {
+        re = QLatin1String("Down");
+    }
+    return re;
+}
+
 QString SyncRunFileLog::instructionToStr( csync_instructions_e inst )
 {
     QString re;
@@ -104,7 +117,7 @@ void SyncRunFileLog::start(const QString &folderPath,  const Utility::StopWatch
 
     if (!exists) {
         // We are creating a new file, add the note.
-        _out << "# timestamp | duration | file | instruction | modtime | etag | "
+        _out << "# timestamp | duration | file | instruction | dir | modtime | etag | "
                 "size | fileId | status | errorString | http result code | "
                 "other size | other modtime | other etag | other fileId | "
                 "other instruction" << endl;
@@ -123,24 +136,32 @@ void SyncRunFileLog::logItem( const SyncFileItem& item )
     if( item._direction == SyncFileItem::None ) {
         return;
     }
+    QString ts = item._responseTimeStamp;
+    if( ts.length() > 6 ) {
+        QRegExp rx("(\\d\\d:\\d\\d:\\d\\d)");
+        if( ts.contains(rx) ) {
+            ts = rx.cap(0);
+        }
+    }
 
     const QChar L = QLatin1Char('|');
-    _out << item._responseTimeStamp << L;
+    _out << ts << L;
     _out << QString::number(item._requestDuration) << L;
     _out << item._file << L;
-    _out << instructionToStr( item._instruction ) << L;
-    _out << QString::number(item._modtime) << L;
-    _out << item._etag << L;
-    _out << QString::number(item._size) << L;
-    _out << item._fileId << L;
+    _out << instructionToStr( item.log._instruction ) << L;
+    _out << directionToStr( item._direction ) << L;
+    _out << QString::number(item.log._modtime) << L;
+    _out << item.log._etag << L;
+    _out << QString::number(item.log._size) << L;
+    _out << item.log._fileId << L;
     _out << item._status << L;
     _out << item._errorString << L;
     _out << QString::number(item._httpErrorCode) << L;
-    _out << QString::number(item.other._size) << L;
-    _out << QString::number(item.other._modtime) << L;
-    _out << item.other._etag << L;
-    _out << item.other._fileId << L;
-    _out << instructionToStr(item.other._instruction) << L;
+    _out << QString::number(item.log._other_size) << L;
+    _out << QString::number(item.log._other_modtime) << L;
+    _out << item.log._other_etag << L;
+    _out << item.log._other_fileId << L;
+    _out << instructionToStr(item.log._other_instruction) << L;
 
     _out << endl;
 }
diff --git a/src/mirall/syncrunfilelog.h b/src/mirall/syncrunfilelog.h
index c9d006d..eb6dd5e 100644
--- a/src/mirall/syncrunfilelog.h
+++ b/src/mirall/syncrunfilelog.h
@@ -37,6 +37,7 @@ protected:
 private:
     QString dateTimeStr( const QDateTime& dt );
     QString instructionToStr( csync_instructions_e inst );
+    QString directionToStr( SyncFileItem::Direction dir );
 
     QScopedPointer<QFile> _file;
     QTextStream _out;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list