code = FILE_RUNIQUE;
name = name1;
}
- pCtx->AddDiff(name, dir0, dir1, code);
+ pCtx->AddDiff(name, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, code);
if (gWriteLog) gLog.Write(_T("\tUnique\r\n"));
if (free0)
free (free0);
/* If either file should exist but does not, return 2. */
val = 2;
- pCtx->AddDiff(name0, dir0, dir1, FILE_ERROR);
+ pCtx->AddDiff(name0, dir0, dir1, 0, 0, FILE_ERROR);
}
#if defined(__MSDOS__) || defined(__NT__) || defined(WIN32)
else if (same_files = 0) /* yes, only ONE equal sign intended! hmo11apr93 */
We know they are identical without actually reading them. */
val = 0;
- pCtx->AddDiff(name0, dir0, dir0, FILE_SAME);
+ pCtx->AddDiff(name0, dir0, dir0, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_SAME);
}
#endif /*__MSDOS__||__NT__*/
else if (inf[0].dir_p & inf[1].dir_p)
/* This is a difference. */
val = 1;
- pCtx->AddDiff(name0, dir0, dir1, FILE_DIFF);
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_DIFF);
}
}
else if ((no_details_flag & ~ignore_some_changes)
{
message ("Files %s and %s differ\n", inf[0].name, inf[1].name);
val = 1;
- pCtx->AddDiff(name0, dir0, dir1, FILE_DIFF);
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_DIFF);
}
else
{
if(val==2)
{
- pCtx->AddDiff(name0, dir0, dir1, FILE_ERROR);
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_ERROR);
if (gWriteLog) gLog.Write(_T("\t%s.\r\n"), val==2? "error":"different");
}
else if (diff_flag)
{
val = 1;
- pCtx->AddDiff(name0, dir0, dir1, FILE_BINDIFF);
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_BINDIFF);
if (gWriteLog) gLog.Write(_T("\tbinary.\r\n"));
}
else
{
val = 0;
- //pCtx->AddDiff(name0, dir0, dir1, FILE_SAME);
+ //pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_SAME);
// if (gWriteLog) gLog.Write(_T("\tidentical.\r\n"));
}
}
}
if (val==2 || val == 1)
{
- pCtx->AddDiff(name0, dir0, dir1, (BYTE)(val==2? FILE_ERROR:FILE_DIFF));
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, (BYTE)(val==2? FILE_ERROR:FILE_DIFF));
if (gWriteLog) gLog.Write(_T("\t%s.\r\n"), val==2? "error":"different");
}
}
if (print_file_same_flag)
message ("Files %s and %s are identical\n",
inf[0].name, inf[1].name);
- pCtx->AddDiff(name0, dir0, dir1, FILE_SAME);
+ pCtx->AddDiff(name0, dir0, dir1, inf[0].stat.st_mtime, inf[1].stat.st_mtime, FILE_SAME);
if (gWriteLog) gLog.Write(_T("\tidentical.\r\n"));
}
else
}
-void CDiffContext::AddDiff(LPCTSTR pszFilename, LPCTSTR pszLeftDir, LPCTSTR pszRightDir, BYTE code)
+void CDiffContext::AddDiff(LPCTSTR pszFilename, LPCTSTR pszLeftDir, LPCTSTR pszRightDir,
+ long ltime, long rtime, BYTE code)
{
DIFFITEM di;
strcpy(di.filename,pszFilename);
strcpy(di.lpath, pszLeftDir);
strcpy(di.rpath, pszRightDir);
+ di.ltime = ltime;
+ di.rtime = rtime;
di.code = code;
m_pList->AddTail(di);
}
typedef struct tagDIFFITEM {
TCHAR filename[_MAX_FNAME+_MAX_EXT];
TCHAR lpath[MAX_PATH], rpath[MAX_PATH];
+ long ltime, rtime;
BYTE code;
}DIFFITEM;
{
public:
void SetRegExp(LPCTSTR pszExp);
- void AddDiff(LPCTSTR pszFilename, LPCTSTR pszLeftDir, LPCTSTR pszRightDir, BYTE code);
+ void AddDiff(LPCTSTR pszFilename, LPCTSTR pszLeftDir, LPCTSTR pszRightDir, long ltime, long rtime, BYTE code);
CDiffContext(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL);
CDiffContext(LPCTSTR pszLeft, LPCTSTR pszRight, CDiffContext& src);
virtual ~CDiffContext();
int rlen = m_pCtxt->m_strRight.GetLength();
POSITION pos = (POSITION)m_pView->m_pList->GetItemData(nIdx);
DIFFITEM di = m_pCtxt->m_dirlist.GetAt(pos);
+ TCHAR sTime[80];
switch (di.code)
{
case FILE_DIFF:
VERIFY(s.LoadString(IDS_FILES_ARE_DIFFERENT));
m_pView->AddItem(nIdx, DV_STATUS, s);
m_pView->SetImage(nIdx, FILE_DIFF);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.ltime));
+ m_pView->AddItem(nIdx, DV_LTIME, sTime);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.rtime));
+ m_pView->AddItem(nIdx, DV_RTIME, sTime);
break;
case FILE_BINDIFF:
VERIFY(s.LoadString(IDS_BIN_FILES_DIFF));
m_pView->AddItem(nIdx, DV_STATUS, s);
m_pView->SetImage(nIdx, FILE_BINDIFF);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.ltime));
+ m_pView->AddItem(nIdx, DV_LTIME, sTime);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.rtime));
+ m_pView->AddItem(nIdx, DV_RTIME, sTime);
break;
case FILE_LUNIQUE:
case FILE_LDIRUNIQUE:
AfxFormatString1(s, IDS_ONLY_IN_FMT, di.lpath);
m_pView->AddItem(nIdx, DV_STATUS, s);
m_pView->SetImage(nIdx, di.code);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.ltime));
+ m_pView->AddItem(nIdx, DV_LTIME, sTime);
+ m_pView->AddItem(nIdx, DV_RTIME, _T("---"));
break;
case FILE_RUNIQUE:
case FILE_RDIRUNIQUE:
AfxFormatString1(s, IDS_ONLY_IN_FMT, di.rpath);
m_pView->AddItem(nIdx, DV_STATUS, s);
m_pView->SetImage(nIdx, di.code);
+ m_pView->AddItem(nIdx, DV_LTIME, _T("---"));
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.rtime));
+ m_pView->AddItem(nIdx, DV_RTIME, sTime);
break;
case FILE_SAME:
VERIFY(s.LoadString(IDS_IDENTICAL));
m_pView->AddItem(nIdx, DV_STATUS,s);
m_pView->SetImage(nIdx, FILE_SAME);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.ltime));
+ m_pView->AddItem(nIdx, DV_LTIME, sTime);
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.rtime));
+ m_pView->AddItem(nIdx, DV_RTIME, sTime);
break;
default: // error
VERIFY(s.LoadString(IDS_CANT_COMPARE_FILES));
m_pView->AddItem(nIdx, DV_STATUS, s);
m_pView->SetImage(nIdx, FILE_ERROR);
+ if (di.ltime>0)
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.ltime));
+ else
+ *sTime = _T('\0');
+ m_pView->AddItem(nIdx, DV_LTIME, sTime);
+ if (di.rtime>0)
+ _tcsftime(sTime, 80, _T("%c"), localtime(&di.rtime));
+ else
+ *sTime = _T('\0');
+ m_pView->AddItem(nIdx, DV_RTIME, sTime);
break;
}
}
m_pList->InsertColumn(DV_NAME, _T("Filename"), LVCFMT_LEFT, 150);
m_pList->InsertColumn(DV_PATH, _T("Directory"), LVCFMT_LEFT, 200);
m_pList->InsertColumn(DV_STATUS, _T("Comparison result"), LVCFMT_LEFT, 250);
+ m_pList->InsertColumn(DV_LTIME, _T("Left Time"), LVCFMT_LEFT, 150);
+ m_pList->InsertColumn(DV_RTIME, _T("Right Time"), LVCFMT_LEFT, 150);
CBitmap bm;
VERIFY (m_imageList.Create (16, 16, ILC_MASK, 0, 1));
VERIFY(s.LoadString(IDS_RESULT_HEADER));
lvc.pszText = (LPTSTR)((LPCTSTR)s);
m_pList->SetColumn(DV_STATUS, &lvc);
+ VERIFY(s.LoadString(IDS_LTIME_HEADER));
+ lvc.pszText = (LPTSTR)((LPCTSTR)s);
+ m_pList->SetColumn(DV_LTIME, &lvc);
+ VERIFY(s.LoadString(IDS_RTIME_HEADER));
+ lvc.pszText = (LPTSTR)((LPCTSTR)s);
+ m_pList->SetColumn(DV_RTIME, &lvc);
}
BOOL CDirView::GetSelectedDirNames(CString& strLeft, CString& strRight)
case DV_STATUS: // Diff Status.
retVal = rDi.code-lDi.code;
break;
+ case DV_LTIME: // Diff Status.
+ retVal = rDi.ltime-lDi.ltime;
+ break;
+ case DV_RTIME: // Diff Status.
+ retVal = lDi.rtime-rDi.rtime;
+ break;
}
// return compare result, considering sort direction
return (pView->m_bSortAscending)?retVal:-retVal;
#define DV_NAME 0
#define DV_PATH 1
#define DV_STATUS 2
+#define DV_LTIME 3
+#define DV_RTIME 4
/////////////////////////////////////////////////////////////////////////////
// CDirView view
IDS_VSS_RUN_ERROR "Error executing versioning system command."
IDS_DIFF_OPEN_NO_SET_PROPS
"Modifications have been made to the current file comparison session. Some property settings may not take place until the current file comparison is restarted."
+ IDS_LTIME_HEADER "Left Date"
+ IDS_RTIME_HEADER "Right Date"
END
#endif // English (U.S.) resources
DDX_CBStringExact(pDX, IDC_LEFT_COMBO, m_strLeft);
DDX_CBStringExact(pDX, IDC_RIGHT_COMBO, m_strRight);
DDX_Check(pDX, IDC_RECURS_CHECK, m_bRecurse);
- DDX_CBString(pDX, IDC_EXT_COMBO, m_strExt);
+ DDX_CBStringExact(pDX, IDC_EXT_COMBO, m_strExt);
//}}AFX_DATA_MAP
}
#define IDS_VSS_CMD 168
#define IDS_VSS_RUN_ERROR 169
#define IDS_DIFF_OPEN_NO_SET_PROPS 170
+#define IDS_LTIME_HEADER 171
+#define IDS_RTIME_HEADER 172
#define IDB_EQUAL 213
#define IDB_NOTEQUAL 214
#define IDB_RFOLDER 215