VirtualBox

Changeset 70834 in vbox for trunk/src/bldprogs


Ignore:
Timestamp:
Jan 31, 2018 2:48:21 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120640
Message:

scm: check svn:sync-process on files and parent dir.

Location:
trunk/src/bldprogs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/scm.cpp

    r69753 r70834  
    101101    SCMOPT_SET_SVN_KEYWORDS,
    102102    SCMOPT_DONT_SET_SVN_KEYWORDS,
     103    SCMOPT_SKIP_SVN_SYNC_PROCESS,
     104    SCMOPT_DONT_SKIP_SVN_SYNC_PROCESS,
    103105    SCMOPT_TAB_SIZE,
    104106    SCMOPT_WIDTH,
     
    181183    /* .fSetSvnExecutable = */                      false,
    182184    /* .fSetSvnKeywords = */                        false,
     185    /* .fSkipSvnSyncProcess = */                    false,
    183186    /* .cchTab = */                                 8,
    184187    /* .cchWidth = */                               130,
     
    230233    { "--set-svn-keywords",                 SCMOPT_SET_SVN_KEYWORDS,                RTGETOPT_REQ_NOTHING },
    231234    { "--dont-set-svn-keywords",            SCMOPT_DONT_SET_SVN_KEYWORDS,           RTGETOPT_REQ_NOTHING },
     235    { "--skip-svn-sync-process",            SCMOPT_SKIP_SVN_SYNC_PROCESS,           RTGETOPT_REQ_NOTHING },
     236    { "--dont-skip-svn-sync-process",       SCMOPT_DONT_SKIP_SVN_SYNC_PROCESS,      RTGETOPT_REQ_NOTHING },
    232237    { "--tab-size",                         SCMOPT_TAB_SIZE,                        RTGETOPT_REQ_UINT8   },
    233238    { "--width",                            SCMOPT_WIDTH,                           RTGETOPT_REQ_UINT8   },
     
    268273SCM_REWRITER_CFG(g_SvnBinary,                       "svn-binary",                   rewrite_SvnBinary);
    269274SCM_REWRITER_CFG(g_SvnKeywords,                     "svn-keywords",                 rewrite_SvnKeywords);
     275SCM_REWRITER_CFG(g_SvnSyncProcess,                  "svn-sync-process",             rewrite_SvnSyncProcess);
    270276SCM_REWRITER_CFG(g_Copyright_CstyleComment,         "copyright-c-style",            rewrite_Copyright_CstyleComment);
    271277SCM_REWRITER_CFG(g_Copyright_HashComment,           "copyright-hash-style",         rewrite_Copyright_HashComment);
     
    295301    &g_SvnBinary,
    296302    &g_SvnKeywords,
     303    &g_SvnSyncProcess,
    297304    &g_Copyright_CstyleComment,
    298305    &g_Copyright_HashComment,
     
    313320{
    314321    &g_SvnNoExecutable,
     322    &g_SvnSyncProcess,
    315323    &g_Makefile_kup
    316324};
     
    323331    &g_SvnNoExecutable,
    324332    &g_SvnKeywords,
     333    &g_SvnSyncProcess,
    325334    &g_Copyright_HashComment,
    326335    &g_Makefile_kmk
     
    334343    &g_SvnNoExecutable,
    335344    &g_SvnKeywords,
     345    &g_SvnSyncProcess,
    336346    &g_Copyright_HashComment,
    337347};
     
    345355    &g_SvnNoExecutable,
    346356    &g_SvnKeywords,
     357    &g_SvnSyncProcess,
    347358    &g_Copyright_CstyleComment,
    348359    &g_FixFlowerBoxMarkers,
     
    359370    &g_SvnNoExecutable,
    360371    &g_SvnKeywords,
     372    &g_SvnSyncProcess,
    361373    &g_Copyright_CstyleComment,
    362374    &g_C_and_CPP
     
    371383    &g_SvnNoExecutable,
    372384    &g_SvnKeywords,
     385    &g_SvnSyncProcess,
    373386    &g_Copyright_CstyleComment,
    374387};
     
    381394    &g_AdjustTrailingLines,
    382395    &g_SvnKeywords,
     396    &g_SvnSyncProcess,
    383397    &g_Copyright_CstyleComment,
    384398};
     
    392406    &g_SvnNoExecutable,
    393407    &g_SvnKeywords,
     408    &g_SvnSyncProcess,
    394409    &g_Copyright_CstyleComment,
    395410};
     
    403418    &g_SvnNoExecutable,
    404419    &g_SvnKeywords,
     420    &g_SvnSyncProcess,
    405421    &g_Copyright_SemicolonComment,
    406422};
     
    414430    &g_SvnNoExecutable,
    415431    &g_SvnKeywords,
     432    &g_SvnSyncProcess,
    416433    &g_Copyright_SemicolonComment,
    417434};
     
    422439    &g_ExpandTabs,
    423440    &g_StripTrailingBlanks,
     441    &g_SvnSyncProcess,
    424442    &g_Copyright_HashComment,
    425443};
     
    430448    &g_ExpandTabs,
    431449    &g_StripTrailingBlanks,
     450    &g_SvnSyncProcess,
    432451    &g_Copyright_RemComment,
    433452};
     
    438457    &g_ExpandTabs,
    439458    &g_StripTrailingBlanks,
     459    &g_SvnSyncProcess,
    440460    &g_Copyright_TickComment,
    441461};
     
    446466    &g_ExpandTabs,
    447467    &g_StripTrailingBlanks,
     468    &g_SvnSyncProcess,
    448469    &g_Copyright_HashComment,
    449470};
     
    456477    &g_AdjustTrailingLines,
    457478    &g_SvnKeywords,
     479    &g_SvnSyncProcess,
    458480    &g_Copyright_PythonComment,
    459481};
     
    466488    &g_AdjustTrailingLines,
    467489    &g_SvnKeywords,
     490    &g_SvnSyncProcess,
    468491    &g_Copyright_HashComment,
    469492};
     
    477500    &g_SvnKeywords,
    478501    &g_SvnNoExecutable,
     502    &g_SvnSyncProcess,
    479503    &g_Copyright_SemicolonComment,
    480504};
     
    488512    &g_SvnKeywords,
    489513    &g_SvnNoExecutable,
     514    &g_SvnSyncProcess,
    490515    &g_Copyright_SemicolonComment,
    491516};
     
    499524    &g_SvnNoExecutable,
    500525    &g_SvnKeywords,
     526    &g_SvnSyncProcess,
    501527    &g_Copyright_CstyleComment,
    502528    &g_FixFlowerBoxMarkers,
     
    512538    &g_SvnNoExecutable,
    513539    &g_SvnKeywords,
     540    &g_SvnSyncProcess,
    514541    &g_Copyright_HashComment,
    515542};
     
    519546    &g_SvnNoExecutable,
    520547    &g_SvnBinary,
     548    &g_SvnSyncProcess,
    521549};
    522550
     
    529557    &g_SvnNoExecutable,
    530558    &g_SvnKeywords,
     559    &g_SvnSyncProcess,
    531560    /** @todo copyright is in an XML comment. */
    532561};
     
    540569    &g_SvnNoExecutable,
    541570    &g_SvnKeywords,
     571    &g_SvnSyncProcess,
    542572    /** @todo copyright is in an XML comment. */
    543573};
     
    551581    &g_SvnNoExecutable,
    552582    &g_SvnKeywords,
     583    &g_SvnSyncProcess,
    553584    /** @todo copyright is in an XML comment. */
    554585};
     
    561592    &g_SvnNoExecutable,
    562593    &g_SvnKeywords,
     594    &g_SvnSyncProcess,
    563595    &g_Copyright_HashComment,
    564596};
     
    569601    &g_SvnNoExecutable,
    570602    &g_SvnKeywords,
     603    &g_SvnSyncProcess,
    571604    /** @todo figure out copyright for Qt resource XML files. */
    572605};
     
    583616    &g_SvnNoExecutable,
    584617    &g_SvnKeywords,
     618    &g_SvnSyncProcess,
    585619    /** @todo copyright is in an XML 'comment' element. */
    586620};
     
    594628    &g_SvnKeywords,
    595629    &g_SvnNoExecutable,
     630    &g_SvnSyncProcess,
    596631    &g_Copyright_SemicolonComment,
    597632};
     
    605640    &g_SvnKeywords,
    606641    &g_SvnNoExecutable,
     642    &g_SvnSyncProcess,
    607643    &g_Copyright_SqlComment,
    608644};
     
    616652    &g_SvnKeywords,
    617653    &g_SvnNoExecutable,
     654    &g_SvnSyncProcess,
    618655    &g_Copyright_CstyleComment,
    619656};
     
    625662    &g_SvnKeywords,
    626663    &g_SvnNoExecutable,
     664    &g_SvnSyncProcess,
    627665    /** @todo check for plain copyright + license in text files. */
    628666};
     
    634672    &g_SvnKeywords,
    635673    &g_SvnNoExecutable,
     674    &g_SvnSyncProcess,
    636675};
    637676
     
    639678{
    640679    &g_SvnBinary,
     680    &g_SvnSyncProcess,
    641681};
    642682
     
    647687    &g_StripTrailingBlanks,
    648688    &g_AdjustTrailingLines,
     689    &g_SvnSyncProcess,
    649690    &g_Copyright_HashComment,
    650691};
     
    10381079        case SCMOPT_DONT_SET_SVN_KEYWORDS:
    10391080            pSettings->fSetSvnKeywords = false;
     1081            return VINF_SUCCESS;
     1082
     1083        case SCMOPT_SKIP_SVN_SYNC_PROCESS:
     1084            pSettings->fSkipSvnSyncProcess = true;
     1085            return VINF_SUCCESS;
     1086        case SCMOPT_DONT_SKIP_SVN_SYNC_PROCESS:
     1087            pSettings->fSkipSvnSyncProcess = false;
    10401088            return VINF_SUCCESS;
    10411089
     
    26292677            case SCMOPT_SET_SVN_EXECUTABLE:     RTPrintf("      Default: %RTbool\n", g_Defaults.fSetSvnExecutable); break;
    26302678            case SCMOPT_SET_SVN_KEYWORDS:       RTPrintf("      Default: %RTbool\n", g_Defaults.fSetSvnKeywords); break;
     2679            case SCMOPT_SKIP_SVN_SYNC_PROCESS:  RTPrintf("      Default: %RTbool\n", g_Defaults.fSkipSvnSyncProcess); break;
    26312680            case SCMOPT_TAB_SIZE:               RTPrintf("      Default: %u\n", g_Defaults.cchTab); break;
    26322681            case SCMOPT_WIDTH:                  RTPrintf("      Default: %u\n", g_Defaults.cchWidth); break;
  • trunk/src/bldprogs/scm.h

    r69500 r70834  
    5656bool ScmSvnIsInWorkingCopy(PSCMRWSTATE pState);
    5757int  ScmSvnQueryProperty(PSCMRWSTATE pState, const char *pszName, char **ppszValue);
     58int  ScmSvnQueryParentProperty(PSCMRWSTATE pState, const char *pszName, char **ppszValue);
    5859int  ScmSvnSetProperty(PSCMRWSTATE pState, const char *pszName, const char *pszValue);
    5960int  ScmSvnDelProperty(PSCMRWSTATE pState, const char *pszName);
     
    202203FNSCMREWRITER rewrite_SvnBinary;
    203204FNSCMREWRITER rewrite_SvnKeywords;
     205FNSCMREWRITER rewrite_SvnSyncProcess;
    204206FNSCMREWRITER rewrite_Copyright_CstyleComment;
    205207FNSCMREWRITER rewrite_Copyright_HashComment;
     
    306308    /** Set svn:keyword if completely or partially missing. */
    307309    bool            fSetSvnKeywords;
     310    /** Skip checking svn:sync-process. */
     311    bool            fSkipSvnSyncProcess;
    308312    /** Tab size. */
    309313    uint8_t         cchTab;
  • trunk/src/bldprogs/scmrw.cpp

    r69507 r70834  
    986986    else if (RT_SUCCESS(rc))
    987987        RTStrFree(pszKeywords);
     988
     989    return false;
     990}
     991
     992/**
     993 * Checks the svn:sync-process value and that parent is exported too.
     994 *
     995 * @returns false - the state carries these kinds of changes.
     996 * @param   pState              The rewriter state.
     997 * @param   pIn                 The input stream.
     998 * @param   pOut                The output stream.
     999 * @param   pSettings           The settings.
     1000 */
     1001bool rewrite_SvnSyncProcess(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
     1002{
     1003    RT_NOREF2(pIn, pOut);
     1004    if (   pSettings->fSkipSvnSyncProcess
     1005        || !ScmSvnIsInWorkingCopy(pState))
     1006        return false;
     1007
     1008    char *pszSyncProcess;
     1009    int rc = ScmSvnQueryProperty(pState, "svn:sync-process", &pszSyncProcess);
     1010    if (RT_SUCCESS(rc))
     1011    {
     1012        if (strcmp(pszSyncProcess, "export") == 0)
     1013        {
     1014            char *pszParentSyncProcess;
     1015            rc = ScmSvnQueryParentProperty(pState, "svn:sync-process", &pszParentSyncProcess);
     1016            if (RT_SUCCESS(rc))
     1017            {
     1018                if (strcmp(pszSyncProcess, "export") != 0)
     1019                    ScmError(pState, VERR_INVALID_STATE,
     1020                             "svn:sync-process=export, but parent directory differs: %s\n", pszParentSyncProcess);
     1021                RTStrFree(pszParentSyncProcess);
     1022            }
     1023            else if (rc == VERR_NOT_FOUND)
     1024                ScmError(pState, VERR_NOT_FOUND, "svn:sync-process=export, but parent directory is not exported!\n");
     1025            else
     1026                ScmError(pState, rc, "ScmSvnQueryParentProperty: %Rrc\n", rc);
     1027        }
     1028        else if (strcmp(pszSyncProcess, "ignore") != 0)
     1029            ScmError(pState, VERR_INVALID_NAME, "Bad sync-process value: %s\n", pszSyncProcess);
     1030        RTStrFree(pszSyncProcess);
     1031    }
     1032    else if (rc != VERR_NOT_FOUND)
     1033        ScmError(pState, rc, "ScmSvnQueryProperty: %Rrc\n", rc);
    9881034
    9891035    return false;
  • trunk/src/bldprogs/scmsubversion.cpp

    r70814 r70834  
    14361436
    14371437/**
     1438 * Queries the value of an SVN property on the parent dir/whatever.
     1439 *
     1440 * This will not adjust for scheduled changes to the parent!
     1441 *
     1442 * @returns IPRT status code.
     1443 * @retval  VERR_INVALID_STATE if not a SVN WC file.
     1444 * @retval  VERR_NOT_FOUND if the property wasn't found.
     1445 * @param   pState              The rewrite state to work on.
     1446 * @param   pszName             The property name.
     1447 * @param   ppszValue           Where to return the property value.  Free this
     1448 *                              using RTStrFree.  Optional.
     1449 */
     1450int ScmSvnQueryParentProperty(PSCMRWSTATE pState, const char *pszName, char **ppszValue)
     1451{
     1452    /*
     1453     * Strip the filename and use ScmSvnQueryProperty.
     1454     */
     1455    char szPath[RTPATH_MAX];
     1456    int rc = RTStrCopy(szPath, sizeof(szPath), pState->pszFilename);
     1457    if (RT_SUCCESS(rc))
     1458    {
     1459        RTPathStripFilename(szPath);
     1460        SCMRWSTATE ParentState;
     1461        ParentState.pszFilename         = szPath;
     1462        ParentState.fFirst              = false;
     1463        ParentState.fIsInSvnWorkingCopy = true;
     1464        ParentState.cSvnPropChanges     = 0;
     1465        ParentState.paSvnPropChanges    = NULL;
     1466        ParentState.rc                  = VINF_SUCCESS;
     1467        rc = ScmSvnQueryProperty(&ParentState, pszName, ppszValue);
     1468        if (RT_SUCCESS(rc))
     1469            rc = ParentState.rc;
     1470    }
     1471    return rc;
     1472}
     1473
     1474
     1475/**
    14381476 * Schedules the setting of a property.
    14391477 *
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette