Changeset 26559 in vbox
- Timestamp:
- Feb 16, 2010 12:44:18 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.scm-settings
r26557 r26559 34 34 --only-svn-dirs 35 35 --only-svn-files 36 --set-svn-eol 36 #--set-svn-eol 37 --set-svn-executable 38 #--set-svn-keywords 37 39 38 40 # -
trunk/src/bldprogs/scm.cpp
r26557 r26559 238 238 /** Set svn:eol-style if missing or incorrect. */ 239 239 bool fSetSvnEol; 240 /** Set svn:executable according to type (unually this means deleting it). */ 241 bool fSetSvnExecutable; 242 /** Set svn:keyword if completely or partially missing. */ 243 bool fSetSvnKeywords; 240 244 /** */ 241 245 unsigned cchTab; … … 282 286 SCMOPT_SET_SVN_EOL, 283 287 SCMOPT_DONT_SET_SVN_EOL, 288 SCMOPT_SET_SVN_EXECUTABLE, 289 SCMOPT_DONT_SET_SVN_EXECUTABLE, 290 SCMOPT_SET_SVN_KEYWORDS, 291 SCMOPT_DONT_SET_SVN_KEYWORDS, 284 292 SCMOPT_TAB_SIZE, 285 293 SCMOPT_FILTER_OUT_DIRS, … … 359 367 static bool rewrite_ForceCRLF(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); 360 368 static bool rewrite_AdjustTrailingLines(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); 369 static bool rewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); 370 static bool rewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); 361 371 static bool rewrite_Makefile_kup(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); 362 372 static bool rewrite_Makefile_kmk(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings); … … 389 399 /* .fOnlySvnDirs = */ false, 390 400 /* .fSetSvnEol = */ false, 401 /* .fSetSvnExecutable = */ false, 402 /* .fSetSvnKeywords = */ false, 391 403 /* .cchTab = */ 8, 392 404 /* .pszFilterFiles = */ (char *)"", … … 416 428 { "--set-svn-eol", SCMOPT_SET_SVN_EOL, RTGETOPT_REQ_NOTHING }, 417 429 { "--dont-set-svn-eol", SCMOPT_DONT_SET_SVN_EOL, RTGETOPT_REQ_NOTHING }, 430 { "--set-svn-executable", SCMOPT_SET_SVN_EXECUTABLE, RTGETOPT_REQ_NOTHING }, 431 { "--dont-set-svn-executable", SCMOPT_DONT_SET_SVN_EXECUTABLE, RTGETOPT_REQ_NOTHING }, 432 { "--set-svn-keywords", SCMOPT_SET_SVN_KEYWORDS, RTGETOPT_REQ_NOTHING }, 433 { "--dont-set-svn-keywords", SCMOPT_DONT_SET_SVN_KEYWORDS, RTGETOPT_REQ_NOTHING }, 418 434 { "--tab-size", SCMOPT_TAB_SIZE, RTGETOPT_REQ_UINT8 }, 419 435 { "--filter-out-dirs", SCMOPT_FILTER_OUT_DIRS, RTGETOPT_REQ_STRING }, … … 427 443 static PFNSCMREWRITER const g_aRewritersFor_Makefile_kup[] = 428 444 { 445 rewrite_SvnNoExecutable, 429 446 rewrite_Makefile_kup 430 447 }; … … 435 452 rewrite_StripTrailingBlanks, 436 453 rewrite_AdjustTrailingLines, 454 rewrite_SvnNoExecutable, 455 rewrite_SvnKeywords, 437 456 rewrite_Makefile_kmk 438 457 }; … … 444 463 rewrite_StripTrailingBlanks, 445 464 rewrite_AdjustTrailingLines, 465 rewrite_SvnNoExecutable, 466 rewrite_SvnKeywords, 446 467 rewrite_C_and_CPP 447 468 }; 448 469 449 static PFNSCMREWRITER const g_aRewritersFor_ RC[] =470 static PFNSCMREWRITER const g_aRewritersFor_H_and_HPP[] = 450 471 { 451 472 rewrite_ForceNativeEol, 452 473 rewrite_ExpandTabs, 453 474 rewrite_StripTrailingBlanks, 454 rewrite_AdjustTrailingLines 475 rewrite_AdjustTrailingLines, 476 rewrite_SvnNoExecutable, 477 rewrite_C_and_CPP 478 }; 479 480 static PFNSCMREWRITER const g_aRewritersFor_RC[] = 481 { 482 rewrite_ForceNativeEol, 483 rewrite_ExpandTabs, 484 rewrite_StripTrailingBlanks, 485 rewrite_AdjustTrailingLines, 486 rewrite_SvnNoExecutable, 487 rewrite_SvnKeywords 455 488 }; 456 489 … … 472 505 { 473 506 { RT_ELEMENTS(g_aRewritersFor_Makefile_kup), &g_aRewritersFor_Makefile_kup[0], "Makefile.kup" }, 474 { RT_ELEMENTS(g_aRewritersFor_Makefile_kmk), &g_aRewritersFor_Makefile_kmk[0], "Makefile.kmk" }, 475 { RT_ELEMENTS(g_aRewritersFor_C_and_CPP), &g_aRewritersFor_C_and_CPP[0], "*.c|*.h|*.cpp|*.hpp|*.C|*.CPP|*.cxx|*.cc" }, 507 { RT_ELEMENTS(g_aRewritersFor_Makefile_kmk), &g_aRewritersFor_Makefile_kmk[0], "Makefile.kmk|Config.kmk" }, 508 { RT_ELEMENTS(g_aRewritersFor_C_and_CPP), &g_aRewritersFor_C_and_CPP[0], "*.c|*.cpp|*.C|*.CPP|*.cxx|*.cc" }, 509 { RT_ELEMENTS(g_aRewritersFor_H_and_HPP), &g_aRewritersFor_H_and_HPP[0], "*.h|*.hpp" }, 476 510 { RT_ELEMENTS(g_aRewritersFor_RC), &g_aRewritersFor_RC[0], "*.rc" }, 477 511 { RT_ELEMENTS(g_aRewritersFor_ShellScripts), &g_aRewritersFor_ShellScripts[0], "*.sh|configure" }, … … 2024 2058 return VINF_SUCCESS; 2025 2059 case SCMOPT_DONT_SET_SVN_EOL: 2060 pSettings->fSetSvnEol = false; 2061 return VINF_SUCCESS; 2062 2063 case SCMOPT_SET_SVN_EXECUTABLE: 2064 pSettings->fSetSvnExecutable = true; 2065 return VINF_SUCCESS; 2066 case SCMOPT_DONT_SET_SVN_EXECUTABLE: 2067 pSettings->fSetSvnExecutable = false; 2068 return VINF_SUCCESS; 2069 2070 case SCMOPT_SET_SVN_KEYWORDS: 2071 pSettings->fSetSvnKeywords = true; 2072 return VINF_SUCCESS; 2073 case SCMOPT_DONT_SET_SVN_KEYWORDS: 2074 pSettings->fSetSvnKeywords = false; 2026 2075 return VINF_SUCCESS; 2027 2076 … … 3211 3260 { 3212 3261 if (rc == VERR_NOT_FOUND) 3213 ScmVerbose(pState, 2, " * Setting ssvn:eol-style to %s (missing)\n", pszDesiredSvnEol);3262 ScmVerbose(pState, 2, " * Setting svn:eol-style to %s (missing)\n", pszDesiredSvnEol); 3214 3263 else 3215 ScmVerbose(pState, 2, " * Settings svn:eol-style to %s (was: %s)\n", pszDesiredSvnEol, pszEol); 3216 rc = scmSvnSetProperty(pState, "svn:eol-style", pszDesiredSvnEol); 3217 if (RT_FAILURE(rc)) 3218 RTMsgError("scmSvnSetProperty: %Rrc\n", rc); /** @todo propagate the error somehow... */ 3219 } 3264 ScmVerbose(pState, 2, " * Setting svn:eol-style to %s (was: %s)\n", pszDesiredSvnEol, pszEol); 3265 int rc2 = scmSvnSetProperty(pState, "svn:eol-style", pszDesiredSvnEol); 3266 if (RT_FAILURE(rc2)) 3267 RTMsgError("scmSvnSetProperty: %Rrc\n", rc2); /** @todo propagate the error somehow... */ 3268 } 3269 if (RT_SUCCESS(rc)) 3270 RTStrFree(pszEol); 3220 3271 } 3221 3272 … … 3335 3386 ScmVerbose(pState, 2, " * Adjusted trailing blank lines\n"); 3336 3387 return true; 3388 } 3389 3390 /** 3391 * Make sure there is no svn:executable keyword on the current file. 3392 * 3393 * @returns false - the state carries these kinds of changes. 3394 * @param pState The rewriter state. 3395 * @param pIn The input stream. 3396 * @param pOut The output stream. 3397 * @param pSettings The settings. 3398 */ 3399 static bool rewrite_SvnNoExecutable(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 3400 { 3401 if ( !pSettings->fSetSvnExecutable 3402 || !scmSvnIsInWorkingCopy(pState)) 3403 return false; 3404 3405 int rc = scmSvnQueryProperty(pState, "svn:executable", NULL); 3406 if (RT_SUCCESS(rc)) 3407 { 3408 ScmVerbose(pState, 2, " * removing svn:executable\n"); 3409 rc = scmSvnDelProperty(pState, "svn:executable"); 3410 if (RT_FAILURE(rc)) 3411 RTMsgError("scmSvnSetProperty: %Rrc\n", rc); /** @todo error propagation here.. */ 3412 } 3413 return false; 3414 } 3415 3416 /** 3417 * Make sure the Id and Revision keywords are expanded. 3418 * 3419 * @returns false - the state carries these kinds of changes. 3420 * @param pState The rewriter state. 3421 * @param pIn The input stream. 3422 * @param pOut The output stream. 3423 * @param pSettings The settings. 3424 */ 3425 static bool rewrite_SvnKeywords(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings) 3426 { 3427 if ( !pSettings->fSetSvnKeywords 3428 || !scmSvnIsInWorkingCopy(pState)) 3429 return false; 3430 3431 char *pszKeywords; 3432 int rc = scmSvnQueryProperty(pState, "svn:keywords", &pszKeywords); 3433 if ( RT_SUCCESS(rc) 3434 && ( !strstr(pszKeywords, "Id") /** @todo need some function for finding a word in a string. */ 3435 || !strstr(pszKeywords, "Revision")) ) 3436 { 3437 if (!strstr(pszKeywords, "Id") && !strstr(pszKeywords, "Revision")) 3438 rc = RTStrAAppend(&pszKeywords, " Id Revision"); 3439 else if (!strstr(pszKeywords, "Id")) 3440 rc = RTStrAAppend(&pszKeywords, " Id"); 3441 else 3442 rc = RTStrAAppend(&pszKeywords, " Revision"); 3443 if (RT_SUCCESS(rc)) 3444 { 3445 ScmVerbose(pState, 2, " * changing svn:keywords to '%s'\n", pszKeywords); 3446 rc = scmSvnSetProperty(pState, "svn:keywords", pszKeywords); 3447 if (RT_FAILURE(rc)) 3448 RTMsgError("scmSvnSetProperty: %Rrc\n", rc); /** @todo error propagation here.. */ 3449 } 3450 else 3451 RTMsgError("RTStrAppend: %Rrc\n", rc); /** @todo error propagation here.. */ 3452 RTStrFree(pszKeywords); 3453 } 3454 else if (rc == VERR_NOT_FOUND) 3455 { 3456 ScmVerbose(pState, 2, " * setting svn:keywords to 'Id Revision'\n"); 3457 rc = scmSvnSetProperty(pState, "svn:keywords", "Id Revision"); 3458 if (RT_FAILURE(rc)) 3459 RTMsgError("scmSvnSetProperty: %Rrc\n", rc); /** @todo error propagation here.. */ 3460 } 3461 else if (RT_SUCCESS(rc)) 3462 RTStrFree(pszKeywords); 3463 3464 return false; 3337 3465 } 3338 3466 … … 3544 3672 ScmDiffStreams(pszFilename, &Stream1, pIn, g_fDiffIgnoreEol, g_fDiffIgnoreLeadingWS, 3545 3673 g_fDiffIgnoreTrailingWS, g_fDiffSpecialChars, pBaseSettings->cchTab, g_pStdOut); 3546 ScmVerbose(pState, 3, "would have modified the file \"%s%s\"\n", pszFilename, g_pszChangedSuff); 3547 scmSvnDisplayChanges(pState); 3674 ScmVerbose(pState, 2, "would have modified the file \"%s%s\"\n", pszFilename, g_pszChangedSuff); 3548 3675 } 3549 3676 } … … 3952 4079 case SCMOPT_ONLY_SVN_DIRS: RTPrintf(" Default: %RTbool\n", g_Defaults.fOnlySvnDirs); break; 3953 4080 case SCMOPT_ONLY_SVN_FILES: RTPrintf(" Default: %RTbool\n", g_Defaults.fOnlySvnFiles); break; 4081 case SCMOPT_SET_SVN_EOL: RTPrintf(" Default: %RTbool\n", g_Defaults.fSetSvnEol); break; 4082 case SCMOPT_SET_SVN_EXECUTABLE: RTPrintf(" Default: %RTbool\n", g_Defaults.fSetSvnExecutable); break; 4083 case SCMOPT_SET_SVN_KEYWORDS: RTPrintf(" Default: %RTbool\n", g_Defaults.fSetSvnKeywords); break; 3954 4084 case SCMOPT_TAB_SIZE: RTPrintf(" Default: %u\n", g_Defaults.cchTab); break; 3955 4085 case SCMOPT_FILTER_OUT_DIRS: RTPrintf(" Default: %s\n", g_Defaults.pszFilterOutDirs); break;
Note:
See TracChangeset
for help on using the changeset viewer.