[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Feature request: a way to exclude some extension from commit

From: Roberto Paterlini <rpaterlini_at_libero.it>
Date: 2007-05-12 18:31:06 CEST

Usually when I do a commit I don't want to include some file like
*.csproj or *.config because they contains changes made from VS o from
the programmers that don't need to be released.

I have modified Dialog2 in setting to let the user add a list like
'*.csproj *.config *.log4net' to the Tortoise configuration.

The Commit Dialog leave files with the specified extension unchecked if
they have entry->status == svn_wc_status_modified, otherwise they are
checked as usual.

The patch in the attachment is based on revision 9381 from trunk.

Index: Resources/TortoiseProcENG.rc
===================================================================
--- Resources/TortoiseProcENG.rc (revision 9381)
+++ Resources/TortoiseProcENG.rc (working copy)
@@ -917,7 +917,7 @@
     PUSHBUTTON "Restore Default",IDC_RESTORE,200,196,93,14
 END
 
-IDD_SETTINGSMISC DIALOGEX 0, 0, 300, 217
+IDD_SETTINGSMISC DIALOGEX 0, 0, 300, 238
 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
 CAPTION "Look and Feel::Dialogs 2"
 FONT 8, "MS Shell Dlg", 0, 0, 0x0
@@ -925,7 +925,7 @@
     GROUPBOX "Status",IDC_STATIC,7,7,286,32
     CONTROL "Recurse into unversioned folders",IDC_UNVERSIONEDRECURSE,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,21,269,10
- GROUPBOX "Commit",IDC_COMMITGROUP,7,44,286,94
+ GROUPBOX "Commit",IDC_COMMITGROUP,7,44,286,112
     CONTROL "&Use autocompletion of filepaths and keywords",IDC_AUTOCOMPLETION,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,57,271,10
     LTEXT "&Timeout in seconds to stop the autocompletion parsing",IDC_AUTOCOMPLETIONTIMEOUTLABEL,14,74,231,8,SS_NOTIFY
@@ -934,14 +934,16 @@
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,90,271,10
     LTEXT "Max. items to keep in the log message history",IDC_MAXHISTORYLABEL,14,107,226,8,SS_NOTIFY
     EDITTEXT IDC_MAXHISTORY,252,103,31,14,ES_AUTOHSCROLL
- GROUPBOX "Check for modifications",IDC_STATIC,7,142,286,32
+ GROUPBOX "Check for modifications",IDC_STATIC,7,159,286,32
     CONTROL "&Contact the repository on startup",IDC_REPOCHECK,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,156,271,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,173,271,10
     CONTROL "&Reopen commit dialog after a commit failed",IDC_REOPENCOMMIT,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,237,10
- GROUPBOX "Lock",IDC_STATIC,7,178,286,32
+ GROUPBOX "Lock",IDC_STATIC,7,194,286,32
     CONTROL "Show Lock dialog before locking files",IDC_SHOWLOCKDLG,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,190,270,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,207,270,10
+ LTEXT "Excluded extensions:",IDC_STATIC,14,137,68,11
+ EDITTEXT IDC_EXCLUDED_EXT,88,136,196,12,ES_AUTOHSCROLL
 END
 
 IDD_SETTINGSSAVEDDATA DIALOGEX 0, 0, 300, 217
@@ -1588,7 +1590,7 @@
         VERTGUIDE, 252
         VERTGUIDE, 284
         TOPMARGIN, 7
- BOTTOMMARGIN, 210
+ BOTTOMMARGIN, 231
     END
 
     IDD_SETTINGSSAVEDDATA, DIALOG
Index: SVN/SVNStatusListCtrl.cpp
===================================================================
--- SVN/SVNStatusListCtrl.cpp (revision 9381)
+++ SVN/SVNStatusListCtrl.cpp (working copy)
@@ -956,10 +956,33 @@
         return 0;
 }
 
+bool CSVNStatusListCtrl::CheckExcluded(std::vector<CString>& arExts, FileEntry* entry)
+{
+ for(std::vector<CString>::const_iterator it=arExts.begin(); it!=arExts.end(); it++ )
+ {
+ BOOL b = CStringUtils::WildCardMatch( *it, entry->GetDisplayName());
+ if ( b && entry->status == svn_wc_status_modified )
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
 void CSVNStatusListCtrl::Show(DWORD dwShow, DWORD dwCheck /*=0*/, bool bShowFolders /* = true */)
 {
         Locker lock(m_critSec);
         WORD langID = (WORD)CRegStdWORD(_T("Software\\TortoiseSVN\\LanguageID"), GetUserDefaultLangID());
+ CString ext = CRegString(_T("Software\\TortoiseSVN\\ExcludedExtensions"), _T(""));
+ std::vector<CString> arExts;
+ int iStart=0;
+ while(true)
+ {
+ CString s = ext.Tokenize( _T(" "), iStart );
+ if ( s.IsEmpty() ) break;
+ arExts.push_back(s);
+ }
+
 
         CWinApp * pApp = AfxGetApp();
         if (pApp)
@@ -1019,7 +1042,7 @@
                                 m_arListArray.push_back(i);
                                 if ((dwCheck & showFlags)||((dwCheck & SVNSLC_SHOWDIRECTS)&&(entry->direct)))
                                 {
- entry->checked = true;
+ entry->checked = CheckExcluded(arExts,entry);
                                 }
                                 AddEntry(entry, langID, listIndex++);
                         }
Index: SVN/SVNStatusListCtrl.h
===================================================================
--- SVN/SVNStatusListCtrl.h (revision 9381)
+++ SVN/SVNStatusListCtrl.h (working copy)
@@ -574,6 +574,8 @@
         void HideColumn(int col);
         void ShowColumn(int col);
 
+ bool CheckExcluded(std::vector<CString>& arExts, FileEntry* entry);
+
         virtual void PreSubclassWindow();
         virtual BOOL PreTranslateMessage(MSG* pMsg);
         virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
Index: TortoiseProc/resource.h
===================================================================
--- TortoiseProc/resource.h (revision 9381)
+++ TortoiseProc/resource.h (working copy)
@@ -1,6 +1,6 @@
 //{{NO_DEPENDENCIES}}
 // Microsoft Visual C++ generated include file.
-// Used by d:\Development\SVN\TortoiseSVN\src\Resources\TortoiseProcENG.rc
+// Used by f:\vs2005\SVN\TortoiseSVN\src\Resources\TortoiseProcENG.rc
 //
 #define IDR_MAINFRAME 1
 #define IDD_SETTINGSPROXY 102
@@ -613,6 +613,7 @@
 #define IDC_GROUPTOP 1374
 #define IDC_GROUPBOTTOM 1375
 #define IDC_URLOFREPO 1376
+#define IDC_EXCLUDED_EXT 1377
 #define IDS_WARN_FOLDERNOTEXIST 1400
 #define IDS_WARN_SHAREFILEACCESS 1401
 #define IDS_WARN_RELOCATEREALLY 1402
@@ -1093,7 +1094,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE 252
 #define _APS_NEXT_COMMAND_VALUE 32814
-#define _APS_NEXT_CONTROL_VALUE 1377
+#define _APS_NEXT_CONTROL_VALUE 1379
 #define _APS_NEXT_SYMED_VALUE 195
 #endif
 #endif
Index: TortoiseProc/SetMisc.cpp
===================================================================
--- TortoiseProc/SetMisc.cpp (revision 9381)
+++ TortoiseProc/SetMisc.cpp (working copy)
@@ -33,6 +33,7 @@
         , m_dwMaxHistory(25)
         , m_bCommitReopen(FALSE)
         , m_bShowLockDlg(FALSE)
+ , m_sExcludedExtension(_T(""))
 {
         m_regUnversionedRecurse = CRegDWORD(_T("Software\\TortoiseSVN\\UnversionedRecurse"), TRUE);
         m_bUnversionedRecurse = (DWORD)m_regUnversionedRecurse;
@@ -50,6 +51,8 @@
         m_bCommitReopen = (BOOL)(DWORD)m_regCommitReopen;
         m_regShowLockDlg = CRegDWORD(_T("Software\\TortoiseSVN\\ShowLockDlg"), TRUE);
         m_bShowLockDlg = (BOOL)(DWORD)m_regShowLockDlg;
+ m_regExcludedExtension = CRegString(_T("Software\\TortoiseSVN\\ExcludedExtensions"), _T(""));
+ m_sExcludedExtension = m_regExcludedExtension;
 }
 
 CSetMisc::~CSetMisc()
@@ -82,6 +85,10 @@
         m_regShowLockDlg = m_bShowLockDlg;
         if (m_regShowLockDlg.LastError != ERROR_SUCCESS)
                 CMessageBox::Show(m_hWnd, m_regShowLockDlg.getErrorString(), _T("TortoiseSVN"), MB_ICONERROR);
+ m_regExcludedExtension = m_sExcludedExtension;
+ if (m_regExcludedExtension.LastError != ERROR_SUCCESS)
+ CMessageBox::Show(m_hWnd, m_regCommitReopen.getErrorString(), _T("TortoiseSVN"), MB_ICONERROR);
+
         return 0;
 }
 
@@ -98,6 +105,7 @@
         DDV_MinMaxUInt(pDX, m_dwMaxHistory, 1, 100);
         DDX_Check(pDX, IDC_REOPENCOMMIT, m_bCommitReopen);
         DDX_Check(pDX, IDC_SHOWLOCKDLG, m_bShowLockDlg);
+ DDX_Text(pDX, IDC_EXCLUDED_EXT, m_sExcludedExtension);
 }
 
 
Index: TortoiseProc/SetMisc.h
===================================================================
--- TortoiseProc/SetMisc.h (revision 9381)
+++ TortoiseProc/SetMisc.h (working copy)
@@ -72,4 +72,6 @@
         BOOL m_bCommitReopen;
         CRegDWORD m_regShowLockDlg;
         BOOL m_bShowLockDlg;
+ CRegString m_regExcludedExtension;
+ CString m_sExcludedExtension;
 };

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Sat May 12 18:34:19 2007

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.