Thread: [Winmerge-svn] SF.net SVN: winmerge:[7493] branches/R2_14/Src/MergeDoc.cpp
Windows visual diff and merge for files and directories
Brought to you by:
christianlist,
grimmdp
From: <ge...@us...> - 2011-01-02 13:21:46
|
Revision: 7493 http://winmerge.svn.sourceforge.net/winmerge/?rev=7493&view=rev Author: gerundt Date: 2011-01-02 13:21:40 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Automatic rescanning was not disabled everywhere. Add forced rescan after loading documents (spotted by Matthias). Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-01-01 13:40:57 UTC (rev 7492) +++ branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:21:40 UTC (rev 7493) @@ -2515,7 +2515,7 @@ } BOOL bBinary = FALSE; - nRescanResult = Rescan(bBinary, bIdentical); + nRescanResult = Rescan(bBinary, bIdentical, TRUE); // Open filed if rescan succeed and files are not binaries if (nRescanResult == RESCAN_OK) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ge...@us...> - 2011-01-02 13:31:49
|
Revision: 7495 http://winmerge.svn.sourceforge.net/winmerge/?rev=7495&view=rev Author: gerundt Date: 2011-01-02 13:31:42 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Make few variables consts. Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:26:21 UTC (rev 7494) +++ branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:31:42 UTC (rev 7495) @@ -811,8 +811,8 @@ */ bool CMergeDoc::SanityCheckDiff(DIFFRANGE dr) const { - int cd_dbegin = dr.dbegin0; - int cd_dend = dr.dend0; + const int cd_dbegin = dr.dbegin0; + const int cd_dend = dr.dend0; // Must ensure line number is in range before getting line flags if (cd_dend >= m_ptBuf[0]->GetLineCount()) @@ -892,9 +892,9 @@ CDiffTextBuffer& sbuf = *m_ptBuf[srcPane]; CDiffTextBuffer& dbuf = *m_ptBuf[dstPane]; BOOL bSrcWasMod = sbuf.IsModified(); - int cd_dbegin = srcPane == 0 ? cd.dbegin0 : cd.dbegin1; - int cd_dend = srcPane == 0 ? cd.dend0 : cd.dend1; - int cd_blank = srcPane == 0 ? cd.blank0 : cd.blank1; + const int cd_dbegin = srcPane == 0 ? cd.dbegin0 : cd.dbegin1; + const int cd_dend = srcPane == 0 ? cd.dend0 : cd.dend1; + const int cd_blank = srcPane == 0 ? cd.blank0 : cd.blank1; bool bInSync = SanityCheckDiff(cd); if (!bInSync) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ge...@us...> - 2011-01-02 13:41:39
|
Revision: 7496 http://winmerge.svn.sourceforge.net/winmerge/?rev=7496&view=rev Author: gerundt Date: 2011-01-02 13:41:33 +0000 (Sun, 02 Jan 2011) Log Message: ----------- PATCH: [ 2921555 ] selected codepage is not used Fixes bug #2907951. Submitted by Matthias Mayer. Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:31:42 UTC (rev 7495) +++ branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:41:33 UTC (rev 7496) @@ -83,7 +83,7 @@ _T ("\x0d") // Macintosh style }; -static void SaveBuffForDiff(CDiffTextBuffer & buf, LPCTSTR filepath); +static void SaveBuffForDiff(CDiffTextBuffer & buf, CDiffTextBuffer & buf2, LPCTSTR filepath); static void UnescapeControlChars(CString &s); ///////////////////////////////////////////////////////////////////////////// @@ -335,14 +335,14 @@ * (the plugins are optional, not the conversion) * @todo Show SaveToFile() errors? */ -static void SaveBuffForDiff(CDiffTextBuffer & buf, LPCTSTR filepath) +static void SaveBuffForDiff(CDiffTextBuffer & buf, CDiffTextBuffer & buf2, LPCTSTR filepath) { ASSERT(buf.m_nSourceEncoding == buf.m_nDefaultEncoding); int orig_codepage = buf.getCodepage(); ucr::UNICODESET orig_unicoding = buf.getUnicoding(); // If file was in Unicode - if (orig_unicoding!=ucr::NONE) + if ((orig_unicoding != ucr::NONE) || (buf2.getUnicoding() != ucr::NONE)) { // we subvert the buffer's memory of the original file encoding buf.setUnicoding(ucr::UCS2LE); // write as UCS-2LE (for preprocessing) @@ -484,8 +484,8 @@ // output buffers to temp files (in UTF-8 if TCHAR=wchar_t or buffer was Unicode) if (bBinary == FALSE) { - SaveBuffForDiff(*m_ptBuf[0], m_tempFiles[0].GetPath().c_str()); - SaveBuffForDiff(*m_ptBuf[1], m_tempFiles[1].GetPath().c_str()); + SaveBuffForDiff(*m_ptBuf[0], *m_ptBuf[1], m_tempFiles[0].GetPath().c_str()); + SaveBuffForDiff(*m_ptBuf[1], *m_ptBuf[0], m_tempFiles[1].GetPath().c_str()); } // Set up DiffWrapper This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ge...@us...> - 2011-01-02 13:46:26
|
Revision: 7497 http://winmerge.svn.sourceforge.net/winmerge/?rev=7497&view=rev Author: gerundt Date: 2011-01-02 13:46:20 +0000 (Sun, 02 Jan 2011) Log Message: ----------- PATCH: [ 2931558 ] some smal cleanups mergedoc7097.patch Submitted by Matthias Mayer Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:41:33 UTC (rev 7496) +++ branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:46:20 UTC (rev 7497) @@ -450,6 +450,7 @@ if (AfxMessageBox(msg, MB_YESNO | MB_ICONWARNING) == IDYES) { ReloadDoc(0); + return RESCAN_OK; } } else if (rightFileChanged == FileChanged) @@ -459,6 +460,7 @@ if (AfxMessageBox(msg, MB_YESNO | MB_ICONWARNING) == IDYES) { ReloadDoc(1); + return RESCAN_OK; } } @@ -1440,6 +1442,7 @@ // Show possible error after updating screen if (nRescanResult != RESCAN_SUPPRESSED) ShowRescanError(nRescanResult, bIdentical); + m_LastRescan = COleDateTime::GetCurrentTime(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ge...@us...> - 2011-01-02 13:52:30
|
Revision: 7498 http://winmerge.svn.sourceforge.net/winmerge/?rev=7498&view=rev Author: gerundt Date: 2011-01-02 13:52:24 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Optimize merging list of differences. Give diff number instead of activating diff and letting code to determine active difference for every diff. Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:46:20 UTC (rev 7497) +++ branches/R2_14/Src/MergeDoc.cpp 2011-01-02 13:52:24 UTC (rev 7498) @@ -779,9 +779,8 @@ // Note we don't care about m_nDiffs count to become zero, // because we don't rescan() so it does not change - SetCurrentDiff(lastDiff); bool bGroupWithPrevious = false; - if (!ListCopy(srcPane, dstPane, -1, bGroupWithPrevious)) + if (!ListCopy(srcPane, dstPane, lastDiff, bGroupWithPrevious)) return; // sync failure // copy from bottom up is more efficient @@ -789,10 +788,9 @@ { if (m_diffList.IsDiffSignificant(i)) { - SetCurrentDiff(i); // Group merge with previous (merge undo data to one action) bGroupWithPrevious = true; - if (!ListCopy(srcPane, dstPane, -1, bGroupWithPrevious)) + if (!ListCopy(srcPane, dstPane, i, bGroupWithPrevious)) return; // sync failure } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2011-10-24 06:29:44
|
Revision: 7569 http://winmerge.svn.sourceforge.net/winmerge/?rev=7569&view=rev Author: jtuc Date: 2011-10-24 06:29:38 +0000 (Mon, 24 Oct 2011) Log Message: ----------- Fix CMergeDoc::Rescan() passing wrong buffer index to DoSaveAs() when rewriting right file in (very rare and unusual) case it has unexpectedly vanished from file system. Modified Paths: -------------- branches/R2_14/Src/MergeDoc.cpp Modified: branches/R2_14/Src/MergeDoc.cpp =================================================================== --- branches/R2_14/Src/MergeDoc.cpp 2011-10-24 06:28:20 UTC (rev 7568) +++ branches/R2_14/Src/MergeDoc.cpp 2011-10-24 06:29:38 UTC (rev 7569) @@ -436,7 +436,7 @@ LangFormatString1(msg, IDS_FILE_DISAPPEARED, m_filePaths.GetRight().c_str()); AfxMessageBox(msg); BOOL bSaveResult = FALSE; - bool ok = DoSaveAs(m_filePaths.GetRight().c_str(), bSaveResult, 0); + bool ok = DoSaveAs(m_filePaths.GetRight().c_str(), bSaveResult, 1); if (!ok || !bSaveResult) { return RESCAN_FILE_ERR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |