bool Triggerconf::checkItemCount (STRING_LIST path, unsigned int items) { if (path.size () != items) { char buf [16]; #ifdef WIN32 ultoa (items, buf, 10); #else snprintf (buf, 10, "%d", items); #endif setError ("path " + untokenize (path) + " does not contain " + string(buf) + " items"); return false; } else return true; }
//----------------------------------------------------------------------------- // Purpose: runs diff on all changed files in the date range // Input : argc - // *argv[] - // Output : int //----------------------------------------------------------------------------- int main( int argc, char *argv[] ) { char tmpBuf[1024]; if ( argc < 2 ) { Error( "Incorrect usage\n" ); } ArgsInit( argc, argv ); const char *pSSDir = ArgsGet( "-ssdir", "\\\\jeeves\\vsscode" ); sprintf( tmpBuf, "ssdir=%s", pSSDir ); putenv( tmpBuf ); const char *pSSProject = argv[argc-1]; const char *pSSUser = ArgsGet( "-user", "Jay" ); printf("Changes for %s\n", pSSUser ); const char *pSSTmpFile = _tempnam( ".", "ssc" ); const char *pRecurse = ""; if ( ArgsExist( "-r" ) || ArgsExist( "-R" ) ) { pRecurse = "-R"; } const char *pDateRange = ArgsGet( "-vssdate", NULL ); char dateBuf[128]; if ( !pDateRange ) { pDateRange = ArgsGet( "-weeks", "1" ); int weeks = atoi( pDateRange ); struct tm last, first; SetToday( &last ); SetSunday( &last ); SubtractWeeks( &last, &first, weeks ); if ( ArgsExist( "-addcurrent" ) ) { SetToday( &last ); } string end = TmToString(last); string start = TmToString( first ); sprintf( dateBuf, "%s~%s", &end[0], &start[0] ); pDateRange = dateBuf; printf("From %s to %s\n", &start[0], &end[0] ); } else { printf("Using custom vss date range: %s\n", pDateRange ); } sprintf( tmpBuf, "history %s %s -vd%s -u%s >%s", pRecurse, pSSProject, pDateRange, pSSUser, pSSTmpFile ); RunVSS( tmpBuf ); STRING_LIST list = ParseHistory( pSSProject, pSSTmpFile ); int totalLines = 0; for ( int i = 0; i < list.size(); i++ ) { const char *pFileName = (const char *)&((list[i].file)[0]); sprintf( tmpBuf, "Diff -IEW %s -V%d~%d -DU >%s", pFileName, list[i].version-1, list[i].version, pSSTmpFile ); RunVSS( tmpBuf ); int linesChanged = CountDiffs( pSSTmpFile ); printf( "Changed %-32s (ver %3d) \t%4d lines\n", pFileName, list[i].version, linesChanged ); totalLines += linesChanged; } unlink( pSSTmpFile ); printf( "\nTotal Files changed: %d\n", list.size() ); printf( "Total Lines changed: %d\n\n", totalLines ); return 0; }