Can CVS and Subversion be set to ignore whitespace in merging?

后端 未结 3 1709
你的背包
你的背包 2021-02-07 02:51

CVS and Subversion both have a handy merge feature so that when you update a source file that you have modified, it merges in changes that others have made on the same file.

3条回答
  •  一整个雨季
    2021-02-07 03:12

    TortoiseMerge doesn't have any CLA (Command Line Arguments) to ignore the whitespace and ignore the case. After searching a lot it seems that it can be achieved still by tweaking the registry values.

    /* DisableWhitespaceDifferences and DisableCaseDifferences. 
    * The settings for TortoiseMerge is stored in Registry in CurrentUser\Software\TortoiseMerge\
    * DWORDS stored the property values.
    * 
    * IgnoreWS         :   Set to 1 to ignore the whitespace differences. 
    *                      Set to 0 to allow the whitespace differences.             
    * IgnoreEOL        :   Set to 1 to ignore the End of Line differences. 
    *                      Set to 0 to allow the End of Line differences.             
    * CaseInsensitive  :   Set to 1 to ignore the Case differences. 
    *                      Set to 0 to allow the Case differences.             
    */
    
    // Get the key from the registry
    using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\TortoiseMerge", true))
    {
       if (key != null)
       {
            // Set the IgnoreWS and IgnoreEOL DWORDs based on DisableWhitespaceDifferences is set or not
            key.SetValue("IgnoreWS", DisableWhitespaceDifferences ? 1 : 0, RegistryValueKind.DWord);
            key.SetValue("IgnoreEOL", DisableWhitespaceDifferences ? 1 : 0, RegistryValueKind.DWord);
    
            // Set the CaseInsensitive DWORD based on DisableCaseDifferences is set or not
            key.SetValue("CaseInsensitive", DisableCaseDifferences ? 1 : 0, RegistryValueKind.DWord);
    
            // close key
            key.Close();
        }
    }
    

提交回复
热议问题