Changeset 26483 in vbox
- Timestamp:
- Feb 14, 2010 2:12:15 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 edited
-
.scm-settings (added)
-
src/VBox/Runtime/.scm-settings (added)
-
src/bldprogs/scm.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scm.cpp
r26477 r26483 194 194 bool fStripTrailingLines; 195 195 unsigned cchTab; 196 /** Only consider files matcihng these patterns. This is only applied to the 197 * base names. */ 198 char *pszFilterFiles; 199 /** Filter out files matching the following patterns. This is applied to base 200 * names as well as the aboslute paths. */ 201 char *pszFilterOutFiles; 202 /** Filter out directories matching the following patterns. This is applied 203 * to base names as well as the aboslute paths. All absolute paths ends with a 204 * slash and dot ("/."). */ 205 char *pszFilterOutDirs; 196 206 } SCMSETTINGSBASE; 197 207 /** Pointer to massager settings. */ … … 221 231 SCMOPT_NO_STRIP_TRAILING_LINES, 222 232 SCMOPT_TAB_SIZE, 223 SCMOPT_LAST_SETTINGS = SCMOPT_TAB_SIZE, 233 SCMOPT_FILTER_OUT_DIRS, 234 SCMOPT_FILTER_FILES, 235 SCMOPT_FILTER_OUT_FILES, 236 SCMOPT_LAST_SETTINGS = SCMOPT_FILTER_OUT_FILES, 224 237 // 225 238 SCMOPT_DIFF_IGNORE_EOL, … … 322 335 /* .fConvertTabs = */ true, 323 336 /* .cchTab = */ 8, 324 /* .fConvertEol = */ true 337 /* .fConvertEol = */ true, 338 /* .pszFilterFiles = */ (char *)"", 339 /* .pszFilterOutFiles = */ (char *)"*.exe|*.com|20*-*-*.log", 340 /* .pszFilterOutDirs = */ (char *)".svn|.hg|.git|CVS", 325 341 }; 326 342 … … 341 357 { "--strip-no-trailing-lines", SCMOPT_NO_STRIP_TRAILING_LINES, RTGETOPT_REQ_NOTHING }, 342 358 { "--tab-size", SCMOPT_TAB_SIZE, RTGETOPT_REQ_UINT8 }, 359 { "--filter-out-dirs", SCMOPT_FILTER_OUT_DIRS, RTGETOPT_REQ_STRING }, 360 { "--filter-files", SCMOPT_FILTER_FILES, RTGETOPT_REQ_STRING }, 361 { "--filter-out-files", SCMOPT_FILTER_OUT_FILES, RTGETOPT_REQ_STRING }, 343 362 }; 344 363 345 364 /** Consider files matching the following patterns (base names only). */ 346 365 static const char *g_pszFileFilter = NULL; 347 /** Filter out files matching the following patterns. This is applied to the348 * base names as well as the absolute paths. */349 static const char *g_pszFileFilterOut =350 "*.exe|"351 "*.com|"352 "20*-*-*.log|"353 "*/src/VBox/Runtime/testcase/soundcard.h|"354 "*/src/VBox/Runtime/include/internal/ldrELF*.h|"355 "*/src/VBox/Runtime/common/math/x86/fenv-x86.c|"356 "*/src/VBox/Runtime/common/checksum/md5.cpp|"357 "/dummy/."358 ;359 /** Consider directories matching the following patterns (base names only) */360 static const char *g_pszDirFilter = NULL;361 /** Filter out directories matching the following patterns. This is applied362 * to base names as well as the aboslute paths. All absolute paths ends with a363 * slash and dot ("/."). */364 static const char *g_pszDirFilterOut =365 // generic366 ".svn|"367 ".hg|"368 ".git|"369 "CVS|"370 // root371 "out|"372 "tools|"373 "webtools|"374 "kBuild|"375 "debian|"376 "SlickEdit|"377 // src378 "*/src/libs/.|"379 "*/src/apps/.|"380 "*/src/VBox/Frontends/.|"381 "*/src/VBox/Additions/x11/x11include/.|"382 "*/src/VBox/Additions/WINNT/Graphics/Wine/.|"383 "*/src/VBox/Additions/common/crOpenGL/.|"384 "*/src/VBox/HostServices/SharedOpenGL/.|"385 "*/src/VBox/GuestHost/OpenGL/*/.|"386 "*/src/VBox/Devices/PC/Etherboot-src/*/.|"387 "*/src/VBox/Devices/Network/lwip/.|"388 "*/src/VBox/Devices/Storage/VBoxHDDFormats/StorageCraft/*/.|"389 "*/src/VBox/Runtime/r0drv/solaris/vbi/*/.|"390 "*/src/VBox/Runtime/common/math/gcc/.|"391 "/dummy"392 ;393 366 394 367 static PFNSCMREWRITER const g_aRewritersFor_Makefile_kup[] = … … 1719 1692 { 1720 1693 *pSettings = *pSrc; 1721 /* No dynamically allocated stuff yet. */ 1722 return VINF_SUCCESS; 1694 1695 int rc = RTStrDupEx(&pSettings->pszFilterFiles, pSrc->pszFilterFiles); 1696 if (RT_SUCCESS(rc)) 1697 { 1698 rc = RTStrDupEx(&pSettings->pszFilterOutFiles, pSrc->pszFilterOutFiles); 1699 if (RT_SUCCESS(rc)) 1700 { 1701 rc = RTStrDupEx(&pSettings->pszFilterOutDirs, pSrc->pszFilterOutDirs); 1702 if (RT_SUCCESS(rc)) 1703 return VINF_SUCCESS; 1704 1705 RTStrFree(pSettings->pszFilterOutFiles); 1706 } 1707 RTStrFree(pSettings->pszFilterFiles); 1708 } 1709 1710 pSettings->pszFilterFiles = NULL; 1711 pSettings->pszFilterOutFiles = NULL; 1712 pSettings->pszFilterOutDirs = NULL; 1713 return rc; 1723 1714 } 1724 1715 … … 1745 1736 Assert(pSettings->cchTab != ~(unsigned)0); 1746 1737 pSettings->cchTab = ~(unsigned)0; 1747 /* No dynamically allocated stuff yet. */ 1748 } 1749 } 1738 1739 RTStrFree(pSettings->pszFilterFiles); 1740 pSettings->pszFilterFiles = NULL; 1741 1742 RTStrFree(pSettings->pszFilterOutFiles); 1743 pSettings->pszFilterOutFiles = NULL; 1744 1745 RTStrFree(pSettings->pszFilterOutDirs); 1746 pSettings->pszFilterOutDirs = NULL; 1747 } 1748 } 1749 1750 1750 1751 1751 /** … … 1816 1816 pSettings->cchTab = pValueUnion->u8; 1817 1817 return VINF_SUCCESS; 1818 1819 case SCMOPT_FILTER_OUT_DIRS: 1820 case SCMOPT_FILTER_FILES: 1821 case SCMOPT_FILTER_OUT_FILES: 1822 { 1823 char **ppsz; 1824 switch (rc) 1825 { 1826 case SCMOPT_FILTER_OUT_DIRS: ppsz = &pSettings->pszFilterOutDirs; break; 1827 case SCMOPT_FILTER_FILES: ppsz = &pSettings->pszFilterFiles; break; 1828 case SCMOPT_FILTER_OUT_FILES: ppsz = &pSettings->pszFilterOutFiles; break; 1829 } 1830 1831 /* 1832 * An empty string zaps the current list. 1833 */ 1834 if (!*pValueUnion->psz) 1835 return RTStrATruncate(ppsz, 0); 1836 1837 /* 1838 * Non-empty strings are appended to the pattern list. 1839 * 1840 * Strip leading and trailing pattern separators before attempting 1841 * to append it. If it's just separators, don't do anything. 1842 */ 1843 const char *pszSrc = pValueUnion->psz; 1844 while (*pszSrc == '|') 1845 pszSrc++; 1846 size_t cchSrc = strlen(pszSrc); 1847 while (cchSrc > 0 && pszSrc[cchSrc - 1] == '|') 1848 cchSrc--; 1849 if (!cchSrc) 1850 return VINF_SUCCESS; 1851 1852 return RTStrAAppendExN(ppsz, 2, 1853 "|", *ppsz && **ppsz ? 1 : 0, 1854 pszSrc, cchSrc); 1855 } 1818 1856 1819 1857 default: … … 2661 2699 * Do the file level filtering. 2662 2700 */ 2663 if ( g_pszFileFilter 2664 && !RTStrSimplePatternMultiMatch(g_pszFileFilter, RTSTR_MAX, pszBasename, cchBasename, NULL)) 2701 if ( pBaseSettings->pszFilterFiles 2702 && *pBaseSettings->pszFilterFiles 2703 && !RTStrSimplePatternMultiMatch(pBaseSettings->pszFilterFiles, RTSTR_MAX, pszBasename, cchBasename, NULL)) 2665 2704 { 2666 2705 ScmVerbose(4, "file filter mismatch: \"%s\"\n", pszFilename); 2667 2706 return VINF_SUCCESS; 2668 2707 } 2669 if ( g_pszFileFilterOut 2670 && ( RTStrSimplePatternMultiMatch(g_pszFileFilterOut, RTSTR_MAX, pszBasename, cchBasename, NULL) 2671 || RTStrSimplePatternMultiMatch(g_pszFileFilterOut, RTSTR_MAX, pszFilename, RTSTR_MAX, NULL)) ) 2708 if ( pBaseSettings->pszFilterOutFiles 2709 && *pBaseSettings->pszFilterOutFiles 2710 && ( RTStrSimplePatternMultiMatch(pBaseSettings->pszFilterOutFiles, RTSTR_MAX, pszBasename, cchBasename, NULL) 2711 || RTStrSimplePatternMultiMatch(pBaseSettings->pszFilterOutFiles, RTSTR_MAX, pszFilename, RTSTR_MAX, NULL)) ) 2672 2712 { 2673 2713 ScmVerbose(4, "file filter out: \"%s\"\n", pszFilename); … … 2914 2954 size_t cchSubDir = cchDir - 1 + pEntry->cbName + sizeof("/.") - 1; 2915 2955 2916 if ( ( g_pszDirFilter == NULL 2917 || RTStrSimplePatternMultiMatch(g_pszDirFilter, RTSTR_MAX, 2918 pEntry->szName, pEntry->cbName, NULL)) 2919 && ( g_pszDirFilterOut == NULL 2920 || ( !RTStrSimplePatternMultiMatch(g_pszDirFilterOut, RTSTR_MAX, 2921 pEntry->szName, pEntry->cbName, NULL) 2922 && !RTStrSimplePatternMultiMatch(g_pszDirFilterOut, RTSTR_MAX, 2923 pszBuf, cchSubDir, NULL) 2924 ) 2925 ) 2956 if ( !pSettingsStack->Base.pszFilterOutDirs 2957 || !*pSettingsStack->Base.pszFilterOutDirs 2958 || ( !RTStrSimplePatternMultiMatch(pSettingsStack->Base.pszFilterOutDirs, RTSTR_MAX, 2959 pEntry->szName, pEntry->cbName, NULL) 2960 && !RTStrSimplePatternMultiMatch(pSettingsStack->Base.pszFilterOutDirs, RTSTR_MAX, 2961 pszBuf, cchSubDir, NULL) 2962 ) 2926 2963 ) 2927 2964 {
Note:
See TracChangeset
for help on using the changeset viewer.

