Merge branch '1.8' into 1.9

This commit is contained in:
Markus Goetz 2015-05-12 23:02:58 +02:00
commit ac0e08cc91
9 changed files with 50 additions and 14 deletions

View file

@ -386,6 +386,20 @@ static int _csync_treewalk_visitor(void *obj, void *data) {
SAFE_FREE(renamed_path);
}
if (!other_node) {
/* Check the source path as well. */
int len;
uint64_t h = 0;
char *renamed_path = csync_rename_adjust_path_source(ctx, cur->path);
if (!c_streq(renamed_path, cur->path)) {
len = strlen( renamed_path );
h = c_jhash64((uint8_t *) renamed_path, len, 0);
other_node = c_rbtree_find(other_tree, &h);
}
SAFE_FREE(renamed_path);
}
if (obj == NULL || data == NULL) {
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
return -1;

View file

@ -43,6 +43,7 @@ struct csync_rename_s {
}
std::map<std::string, std::string> folder_renamed_to; // map from->to
std::map<std::string, std::string> folder_renamed_from; // map to->from
struct renameop {
csync_file_stat_t *st;
@ -63,6 +64,7 @@ void csync_rename_destroy(CSYNC* ctx)
void csync_rename_record(CSYNC* ctx, const char* from, const char* to)
{
csync_rename_s::get(ctx)->folder_renamed_to[from] = to;
csync_rename_s::get(ctx)->folder_renamed_from[to] = from;
}
char* csync_rename_adjust_path(CSYNC* ctx, const char* path)
@ -78,4 +80,18 @@ char* csync_rename_adjust_path(CSYNC* ctx, const char* path)
return c_strdup(path);
}
char* csync_rename_adjust_path_source(CSYNC* ctx, const char* path)
{
csync_rename_s* d = csync_rename_s::get(ctx);
for (std::string p = _parentDir(path); !p.empty(); p = _parentDir(p)) {
std::map< std::string, std::string >::iterator it = d->folder_renamed_from.find(p);
if (it != d->folder_renamed_from.end()) {
std::string rep = it->second + (path + p.length());
return c_strdup(rep.c_str());
}
}
return c_strdup(path);
}
}

View file

@ -26,7 +26,10 @@
extern "C" {
#endif
/* Return the final destination path of a given patch in case of renames */
char *csync_rename_adjust_path(CSYNC *ctx, const char *path);
/* Return the source of a given path in case of renames */
char *csync_rename_adjust_path_source(CSYNC *ctx, const char *path);
void csync_rename_destroy(CSYNC *ctx);
void csync_rename_record(CSYNC *ctx, const char *from, const char *to);

View file

@ -124,7 +124,8 @@ sub initTesting(;$)
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0
}
$d = HTTP::DAV->new();
my $ua = HTTP::DAV::UserAgent->new(keep_alive => 1 );
$d = HTTP::DAV->new(-useragent => $ua);
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $user,

View file

@ -110,9 +110,9 @@ Application::Application(int &argc, char **argv) :
if (isRunning())
return;
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) && QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
// Workaround for QTBUG-44576: Make sure a stale QSettings lock file
// is deleted.
// is deleted. (Introduced in Qt 5.4.0 and fixed in Qt 5.4.2)
{
QString lockFilePath = ConfigFile().configFile() + QLatin1String(".lock");
QLockFile(lockFilePath).removeStaleLockFile();

View file

@ -184,7 +184,7 @@ void BandwidthManager::relativeUploadMeasuringTimerExpired()
// qDebug() << Q_FUNC_INFO << _relativeUploadLimitProgressAtMeasuringRestart
// << relativeLimitProgressMeasured << relativeLimitProgressDifference;
qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0;
// qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0;
// qDebug() << Q_FUNC_INFO << relativeLimitProgressDifference/1024 <<"kB =>" << speedkBPerSec << "kB/sec on full speed ("
// << _relativeLimitCurrentMeasuredDevice->_readWithProgress << _relativeLimitCurrentMeasuredDevice->_read
// << qAbs(_relativeLimitCurrentMeasuredDevice->_readWithProgress
@ -277,7 +277,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired()
qDebug() << Q_FUNC_INFO << _relativeDownloadLimitProgressAtMeasuringRestart
<< relativeLimitProgressMeasured << relativeLimitProgressDifference;
qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0;
// qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0;
// qDebug() << Q_FUNC_INFO << relativeLimitProgressDifference/1024 <<"kB =>" << speedkBPerSec << "kB/sec on full speed ("
// << _relativeLimitCurrentMeasuredJob->currentDownloadPosition() ;

View file

@ -532,6 +532,7 @@ void PropagateDownloadFileQNAM::downloadFinished()
done(SyncFileItem::SoftError, renameError);
return;
}
qDebug() << "Created conflict file" << fn << "->" << conflictFileName;
}
FileSystem::setModTime(_tmpFile.fileName(), _item._modtime);

View file

@ -608,13 +608,14 @@ void SyncEngine::startSync()
bool isUpdateFrom_1_8 = _journal->isUpdateFrom_1_8_0();
/*
* If 1.8.0 caused missing data in the local tree, this patch gets it
* back. For that, the usage of the journal for remote repository is
* disabled at the first start.
* If we are upgrading from a client version older than 1.5 is found,
* we cannot read from the database because we need to fetch the files id and etags.
*
* If 1.8.0 caused missing data in the local tree, so we also don't read from DB
* to get back the files that were gone.
*/
if (fileRecordCount >= 1 && (isUpdateFrom_1_5 || isUpdateFrom_1_8)) {
qDebug() << "detected update from 1.5" << fileRecordCount << isUpdateFrom_1_5;
// Disable the read from DB to be sure to re-read all the fileid and etags.
qDebug() << "detected update from 1.5 or 1.8" << fileRecordCount << isUpdateFrom_1_5;
_csync_ctx->read_remote_from_db = false;
} else {
_csync_ctx->read_remote_from_db = true;

View file

@ -431,14 +431,14 @@ private slots:
this, SLOT(slotFinishedSuccessfully()) );
QHash <QString, qint64> sizes;
QVERIFY(parser.parse( testXml, &sizes, "" ));
QVERIFY(parser.parse( testXml, &sizes, QString::fromUtf8("") ));
QVERIFY(_success);
QVERIFY(_items.contains("/ä/ä.pdf"));
QVERIFY(_items.contains(""));
QVERIFY(_items.contains(QString::fromUtf8("/ä/ä.pdf")));
QVERIFY(_items.contains(QString::fromUtf8("")));
QVERIFY(_items.size() == 2 );
QVERIFY(_subdirs.contains(""));
QVERIFY(_subdirs.contains(QString::fromUtf8("")));
QVERIFY(_subdirs.size() == 1);
}