# # # patch "NEWS" # from [a15df731f396db003f1c0b80c21e5b3ab31ab830] # to [94103c517dc4f526f296170fb162792d4ebb035b] # # patch "src/model/ContentDiff.cpp" # from [c77817f8d247996fc23d536a191a8377991d2d8c] # to [96601ca8586c28850268b7753a33a36a5e16d8a7] # # patch "src/model/ContentDiff.h" # from [6d7f15f9d1f56bac5e7cc8189a1b6dc40993a022] # to [1c6e2ba3401e96ec515c037b068e9ed20f75d652] # # patch "src/util/DiffParser.cpp" # from [5bdcb3f592048ca903f4ad916b70fe441cb24256] # to [acc22ce0dc9e9c870f3fd2308a0a489715a16d3a] # # patch "src/util/DiffParser.h" # from [831ad2e4c4bffd650540219fedd91deb5c6945be] # to [3b9a8b7b8abed481f4ba8f2c50220cd61af5a114] # ============================================================ --- NEWS a15df731f396db003f1c0b80c21e5b3ab31ab830 +++ NEWS 94103c517dc4f526f296170fb162792d4ebb035b @@ -11,6 +11,8 @@ xxxx-xx-xx (1.0rc3) - bugfix: hang / crash on quit on Mac OS X (closes FS#47) - bugfix: model-related crash under certain circumstances when a revision diff was triggered + - bugfix: file diff dialog could be opened from the revision + diff dialog for added files and mtn failed to load the bogus diff - internal: bind guitone's internal settings system late to the needed QSettings backend; improve the creation of Mac OS X distributable binaries and images ============================================================ --- src/model/ContentDiff.cpp c77817f8d247996fc23d536a191a8377991d2d8c +++ src/model/ContentDiff.cpp 96601ca8586c28850268b7753a33a36a5e16d8a7 @@ -171,6 +171,7 @@ void ContentDiff::loadOutputIntoModel(co Diff * diff = i.value(); ListLine * fileLine = new ListLine(fileName, diff->hunks.size()); + fileLine->isNewFile = diff->is_new_file; lines.append(fileLine); if (diff->is_binary) ============================================================ --- src/model/ContentDiff.h 6d7f15f9d1f56bac5e7cc8189a1b6dc40993a022 +++ src/model/ContentDiff.h 1c6e2ba3401e96ec515c037b068e9ed20f75d652 @@ -33,6 +33,7 @@ struct ListLine QString fileName; int hunkCount; bool isBinary; + bool isNewFile; QString lineMarker; QString lineContent; @@ -76,7 +77,7 @@ struct ListLine bool isFileLineAndDiffable() { - return type == FileLine && !isBinary; + return type == FileLine && !isBinary && !isNewFile; } void addChild(ListLine * l) { lines.append(l); l->parent = this; } ============================================================ --- src/util/DiffParser.cpp 5bdcb3f592048ca903f4ad916b70fe441cb24256 +++ src/util/DiffParser.cpp acc22ce0dc9e9c870f3fd2308a0a489715a16d3a @@ -82,21 +82,28 @@ void DiffParser::parse(const QByteArray if (isBinaryPos != -1) { curDiff->is_binary = true; + // we actually don't get this information from the diff + curDiff->is_new_file = false; + I(in.length() > isBinaryPos); curFile = nextLine.mid(2, isBinaryPos - 2); } else { + curDiff->is_binary = false; + // `--- path/to/file 123456789abcdef...' int tabPos = nextLine.indexOf('\t'); I(tabPos != -1); curFile = nextLine.mid(4, tabPos - 4); - curDiff->is_binary = false; - // skip the next line as we don't care about renames - // yet and if we would care about them, we would get this - // info from the cset (which we should fetch and process - // sometime...) - i++; + QString fileVerOld = nextLine.mid(tabPos).trimmed(); + + nextLine = lines.at(++i); + tabPos = nextLine.indexOf('\t'); + I(tabPos != -1); + QString fileVerNew = nextLine.mid(tabPos).trimmed(); + + curDiff->is_new_file = fileVerOld == fileVerNew; } fileDiffs.insert(curFile, curDiff); ============================================================ --- src/util/DiffParser.h 831ad2e4c4bffd650540219fedd91deb5c6945be +++ src/util/DiffParser.h 3b9a8b7b8abed481f4ba8f2c50220cd61af5a114 @@ -61,6 +61,7 @@ struct Diff hunks.clear(); } bool is_binary; + bool is_new_file; }; typedef QMap FileDiffs;