OSDN Git Service

Rational ClearCase integration
authorDennis Lim <dlkj@users.sourceforge.net>
Wed, 20 Dec 2000 14:33:22 +0000 (14:33 +0000)
committerDennis Lim <dlkj@users.sourceforge.net>
Wed, 20 Dec 2000 14:33:22 +0000 (14:33 +0000)
Src/DirView.cpp
Src/MainFrm.cpp
Src/MainFrm.h
Src/Merge.dsp
Src/Merge.rc
Src/PropVss.cpp
Src/PropVss.h
Src/VssPrompt.cpp
Src/VssPrompt.h
Src/resource.h

index 435334e..0957e30 100644 (file)
@@ -100,6 +100,7 @@ CDirDoc* CDirView::GetDocument() // non-debug version is inline
 void CDirView::OnInitialUpdate() 
 {
        CListViewEx::OnInitialUpdate();
+       m_sortColumn = -1;      // start up in no sorted order.
        m_pList = &GetListCtrl();
        GetDocument()->m_pView = this;
        
index 5854beb..02c990e 100644 (file)
@@ -38,6 +38,7 @@
 #include "coretools.h"
 #include "Splash.h"
 #include "VssPrompt.h"
+#include "CCPrompt.h"
 #include "PropVss.h"
 #include "PropGeneral.h"
 #include "RegKey.h"
@@ -112,7 +113,7 @@ CMainFrame::CMainFrame()
        m_bScrollToFirst = theApp.GetProfileInt(_T("Settings"), _T("ScrollToFirst"), FALSE)!=0;
        m_bIgnoreWhitespace = theApp.GetProfileInt(_T("Settings"), _T("IgnoreSpace"), TRUE)!=0;
        m_bHideBak = theApp.GetProfileInt(_T("Settings"), _T("HideBak"), TRUE)!=0;
-       m_bUseVss = theApp.GetProfileInt(_T("Settings"), _T("UseVss"), FALSE)!=0;
+       m_nVerSys = theApp.GetProfileInt(_T("Settings"), _T("VersionSystem"), 0);
        m_strVssProject = theApp.GetProfileString(_T("Settings"), _T("VssProject"), _T(""));
        m_strVssPath = theApp.GetProfileString(_T("Settings"), _T("VssPath"), _T(""));
        m_nTabSize = theApp.GetProfileInt(_T("Settings"), _T("TabSize"), 4);
@@ -324,30 +325,29 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
                {
                        if (status.m_attribute & CFile::Attribute::readOnly)
                        {
-                               if (!m_bUseVss)
+                               int userChoice = IDCANCEL;
+
+                               switch(m_nVerSys)
                                {
-                                       CString title;
-                                       VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
+                               case 0: //no versioning system
+                                       // prompt for user choice
                                        AfxFormatString1(s, IDS_SAVEREADONLY_FMT, strSavePath);
-                                       if (AfxMessageBox(s, MB_YESNO|MB_ICONQUESTION) == IDYES
-                                               && SelectFile(s, strSavePath, title, NULL, FALSE))
+                                       if (AfxMessageBox(s, MB_YESNO|MB_ICONQUESTION) == IDYES)
                                        {
-                                               strSavePath = s;
-                                               needCheck=TRUE;
+                                               userChoice = IDSAVEAS;
                                        }
-                                       else
-                                               return FALSE;
-                               }
-                               else
+                                       break;
+                               case 1: // Visual Source Safe
                                {
+                                               // prompt for user choice
                                        CVssPrompt dlg;
-                                       AfxFormatString1(dlg.m_strMessage, IDS_SAVEVSS_FMT, strSavePath);
+                                               dlg.m_strMessage.FormatMessage(IDS_SAVE_FMT, strSavePath);
                                        dlg.m_strProject = m_strVssProject;
-                                       switch(dlg.DoModal())
-                                       {
-                                       case IDOK:
+                                               userChoice = dlg.DoModal();
+                                               // process versioning system specific action
+                                               if(userChoice==IDOK)
                                                {
-                                                       BeginWaitCursor();
+                                                       CWaitCursor wait;
                                                        m_strVssProject = dlg.m_strProject;
                                                        theApp.WriteProfileString(_T("Settings"), _T("VssProject"), mf->m_strVssProject);
                                                        TCHAR args[1024];
@@ -358,10 +358,48 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
                                                        DWORD code;
                                                        _stprintf(args,_T("checkout %s/%s"), m_strVssProject,name);
                                                        HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
-                                                       if (hVss)
+                                                       if (hVss!=INVALID_HANDLE_VALUE)
+                                                       {
+                                                               WaitForSingleObject(hVss, INFINITE);
+                                                               GetExitCodeProcess(hVss, &code);
+                                                               CloseHandle(hVss);
+                                                               if (code != 0)
+                                                               {
+                                                                       AfxMessageBox(IDS_VSSERROR, MB_ICONSTOP);
+                                                                       return FALSE;
+                                                               }
+                                                               needCheck=FALSE;
+                                                       }
+                                                       else
                                                        {
-                                                               while (!HasExited(hVss, &code))
-                                                                       Sleep(1000);
+                                                               AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
+                                                               return FALSE;
+                                                       }
+                                               }
+                                       }
+                                       break;
+                               case 2: // ClearCase
+                                       {
+                                               // prompt for user choice
+                                               CCCPrompt dlg;
+                                               userChoice = dlg.DoModal();
+                                               // process versioning system specific action
+                                               if(userChoice == IDOK)
+                                               {
+                                                       CWaitCursor wait;
+                                                       TCHAR args[1024];
+                                                       TCHAR path[MAX_PATH],name[MAX_PATH];
+                                                       split_filename(strSavePath,path,name,NULL);
+                                                       _chdrive(toupper(path[0])-'A'+1);
+                                                       _chdir(path);
+                                                       DWORD code;
+                                                       _stprintf(args,_T("checkout -c \"%s\" %s"), dlg.m_comments, name);
+                                                       HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
+                                                       if (hVss!=INVALID_HANDLE_VALUE)
+                                                       {
+                                                               WaitForSingleObject(hVss, INFINITE);
+                                                               GetExitCodeProcess(hVss, &code);
+                                                               CloseHandle(hVss);
                                                                
                                                                if (code != 0)
                                                                {
@@ -369,17 +407,26 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
                                                                        return FALSE;
                                                                }
                                                                needCheck=FALSE;
-                                                               //CloseHandle(hVss);
                                                        }
-                                                       EndWaitCursor();
+                                                       else
+                                                       {
+                                                               AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
+                                                               return FALSE;
+                                                       }
+                                               }
                                                }
                                                break;
+                               }       //switch(m_nVerSys)
+
+                               // common processing for all version systems
+                               switch(userChoice)
+                               {
                                        case IDCANCEL:
                                                return FALSE;
                                        case IDSAVEAS:
                                                CString title;
                                                VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
-                                               if (SelectFile(s, strSavePath, title, NULL, FALSE))
+                                               if (SelectFile(s, NULL, title, NULL, FALSE))
                                                {
                                                        strSavePath = s;
                                                        needCheck=TRUE;
@@ -390,7 +437,6 @@ BOOL CMainFrame::CheckSavePath(CString& strSavePath)
                                        }
                                }
                        }
-               }
        } while (needCheck);
        return TRUE;
 }
@@ -403,7 +449,7 @@ void CMainFrame::OnProperties()
        sht.AddPage(&gen);
        sht.AddPage(&vss);
        
-       vss.m_bDoVss = m_bUseVss;
+       vss.m_nVerSys = m_nVerSys;
        vss.m_strPath = m_strVssPath;
 
        gen.m_bBackup = m_bBackup;
@@ -415,7 +461,7 @@ void CMainFrame::OnProperties()
        
        if (sht.DoModal()==IDOK)
        {
-               m_bUseVss = vss.m_bDoVss;
+               m_nVerSys = vss.m_nVerSys;
                m_strVssPath = vss.m_strPath;
                
                m_bBackup = gen.m_bBackup;
@@ -428,7 +474,7 @@ void CMainFrame::OnProperties()
                ignore_some_changes = m_bIgnoreWhitespace || m_bIgnoreCase || m_bIgnoreBlankLines;
                length_varies = m_bIgnoreWhitespace;
 
-               theApp.WriteProfileInt(_T("Settings"), _T("UseVss"), m_bUseVss);        
+               theApp.WriteProfileInt(_T("Settings"), _T("VersionSystem"), m_nVerSys);
                theApp.WriteProfileInt(_T("Settings"), _T("IgnoreSpace"), m_bIgnoreWhitespace);
                theApp.WriteProfileInt(_T("Settings"), _T("ScrollToFirst"), m_bScrollToFirst);
                theApp.WriteProfileInt(_T("Settings"), _T("BackupFile"), m_bBackup);
@@ -495,7 +541,7 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
                                  _T("\tShowIdentical: %d\r\n")
                                  _T("\tShowDiff: %d\r\n")
                                  _T("\tHideBak: %d\r\n")
-                                 _T("\tUseVss: %d\r\n")
+                                 _T("\tVerSys: %d\r\n")
                                  _T("\tVssPath: %s\r\n")
                                  _T("\tBackups: %d\r\n")
                                  _T("\tIgnoreWS: %d\r\n")
@@ -508,7 +554,7 @@ BOOL CMainFrame::DoFileOpen(LPCTSTR pszLeft /*=NULL*/, LPCTSTR pszRight /*=NULL*
                                  m_bShowIdent,
                                  m_bShowDiff,
                                  m_bHideBak,
-                                 m_bUseVss,
+                                 m_nVerSys,
                                  m_strVssPath,
                                  m_bBackup,
                                  m_bIgnoreWhitespace,
index 98cd68b..0a25a57 100644 (file)
@@ -80,7 +80,7 @@ public:
        BOOL CheckSavePath(CString& strSavePath);
        CString m_strVssPath;
        CString m_strVssProject;
-       BOOL m_bUseVss;
+       int m_nVerSys;
        BOOL m_bHideBak;
        BOOL m_bIgnoreWhitespace;
        BOOL m_bScrollToFirst;
index 61634ad..5d47e28 100644 (file)
@@ -57,7 +57,7 @@ LINK32=link.exe
 # ADD LINK32 version.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\Build\MergeRelease/WinMerge.exe" /verbose:lib
 # SUBTRACT LINK32 /pdb:none
 # Begin Special Build Tool
-TargetPath=\Programs\Merge\Build\MergeRelease\WinMerge.exe
+TargetPath=\Merge\Build\MergeRelease\WinMerge.exe
 SOURCE="$(InputPath)"
 PostBuild_Cmds=StampVer -vstampver.inf -i4 -j4 -o2 $(TargetPath)
 # End Special Build Tool
@@ -148,6 +148,10 @@ SOURCE=.\ANALYZE.C
 # End Source File
 # Begin Source File
 
+SOURCE=.\CCPrompt.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\ChildFrm.cpp
 
 !IF  "$(CFG)" == "Merge - Win32 Release"
@@ -694,6 +698,10 @@ SOURCE=D:\data\html\WinMergeChanges.html
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
+SOURCE=.\CCPrompt.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\ChildFrm.h
 # End Source File
 # Begin Source File
index ae3cacb..20dceca 100644 (file)
@@ -272,15 +272,16 @@ END
 
 IDD_PROP_VSS DIALOG DISCARDABLE  0, 0, 259, 157
 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
-CAPTION "SourceSafe"
+CAPTION "Versioning System"
 FONT 8, "MS Sans Serif"
 BEGIN
     GROUPBOX        "Settings",IDC_STATIC,7,7,245,54
-    CONTROL         "Enable Visual &SourceSafe integration",IDC_DOVSS_CHECK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,21,133,10
-    LTEXT           "&Path to SS.EXE:",IDC_VSS_L1,16,42,53,8
-    EDITTEXT        IDC_PATH_EDIT,72,40,131,12,ES_AUTOHSCROLL
+    LTEXT           "&Path to cleartool.exe:",IDC_VSS_L1,16,42,68,8
+    EDITTEXT        IDC_PATH_EDIT,85,40,116,12,ES_AUTOHSCROLL
     PUSHBUTTON      "&Browse...",IDC_BROWSE_BUTTON,206,40,42,12
+    COMBOBOX        IDC_VER_SYS,85,20,157,41,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
+    LTEXT           "&Versioning System",IDC_STATIC,16,22,60,10
 END
 
 IDD_PROPPAGE_LARGE DIALOG DISCARDABLE  0, 0, 235, 156
@@ -317,6 +318,19 @@ BEGIN
     LTEXT           "Available languages:",IDC_STATIC,7,7,66,8
 END
 
+IDD_CLEARCASE DIALOG DISCARDABLE  0, 0, 279, 111
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Rational Clearcase"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "CheckOut",IDOK,35,90,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,194,90,50,14
+    PUSHBUTTON      "Save As...",IDSAVEAS,114,90,50,14
+    EDITTEXT        IDC_COMMENTS,18,21,243,56,ES_MULTILINE | ES_AUTOVSCROLL | 
+                    ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
+    LTEXT           "Comments",IDC_STATIC,18,7,34,10
+END
+
 
 #ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
@@ -408,6 +422,7 @@ BEGIN
     BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 252
+        VERTGUIDE, 85
         TOPMARGIN, 7
         BOTTOMMARGIN, 150
     END
@@ -419,6 +434,18 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 149
     END
+
+    IDD_CLEARCASE, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 272
+        VERTGUIDE, 18
+        VERTGUIDE, 35
+        VERTGUIDE, 244
+        VERTGUIDE, 261
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 104
+    END
 END
 #endif    // APSTUDIO_INVOKED
 
@@ -466,7 +493,25 @@ IDB_UNKNOWN             BITMAP  DISCARDABLE     "res\\unknown.bmp"
 IDB_BINARY              BITMAP  DISCARDABLE     "res\\binary.bmp"
 IDB_LFILE               BITMAP  DISCARDABLE     "res\\lfile.bmp"
 IDB_RFILE               BITMAP  DISCARDABLE     "res\\rfile.bmp"
-IDB_BITMAP1             BITMAP  DISCARDABLE     "res\\bitmap1.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_PROP_VSS DLGINIT
+BEGIN
+    IDC_VER_SYS, 0x403, 5, 0
+0x6f4e, 0x656e, "\000" 
+    IDC_VER_SYS, 0x403, 18, 0
+0x6956, 0x7573, 0x6c61, 0x5320, 0x756f, 0x6372, 0x5365, 0x6661, 0x0065, 
+
+    IDC_VER_SYS, 0x403, 19, 0
+0x6152, 0x6974, 0x6e6f, 0x6c61, 0x4320, 0x656c, 0x7261, 0x6143, 0x6573, 
+"\000" 
+    0
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -663,8 +708,8 @@ BEGIN
     IDS_SAVEREADONLY_FMT    "%1 is marked read-only.  Would you like to save the file under a different name?"
     IDS_SAVE_FMT            "Save changes to %1?"
     IDS_FILEBINARY          "Binary files cannot be visually compared."
-    IDS_SAVEVSS_FMT         "%1 is marked read-only.  Would you like to check it out from SourceSafe, or save it under a different name?"
-    IDS_VSSERROR            "SourceSafe returned an error while attempting to check out the file.  Unable to continue..."
+    IDS_SAVEVSS_FMT         "%1 is marked read-only.  Would you like to check it out from Versioning System, or save it under a different name?"
+    IDS_VSSERROR            "Versioning System returned an error while attempting to check out the file.  Unable to continue..."
     IDS_NOPROJECT           "You must specify a SourceSafe project path in order to continue (ie:  $/MyProject)"
 END
 
@@ -809,6 +854,9 @@ BEGIN
     IDS_DIFF_NUMBER_STATUS_FMT "Difference %1 of %2"
     IDS_NO_DIFF_SEL_FMT     "%1 Differences Found"
     IDS_FILEISDIR           "Directory files cannot be visually compared."
+    IDS_CC_CMD              "&Path to cleartool.exe :"
+    IDS_VSS_CMD             "&Path to SS.EXE :"
+    IDS_VSS_RUN_ERROR       "Error executing versioning system command."
 END
 
 #endif    // English (U.S.) resources
index 1b8e7e6..b9f5d31 100644 (file)
@@ -41,7 +41,7 @@ CPropVss::CPropVss() : CPropertyPage(CPropVss::IDD)
 {
        //{{AFX_DATA_INIT(CPropVss)
        m_strPath = _T("");
-       m_bDoVss = FALSE;
+       m_nVerSys = -1;
        //}}AFX_DATA_INIT
 }
 
@@ -57,15 +57,15 @@ void CPropVss::DoDataExchange(CDataExchange* pDX)
        DDX_Control(pDX, IDC_PATH_EDIT, m_ctlPath);
        DDX_Control(pDX, IDC_BROWSE_BUTTON, m_ctlBrowse);
        DDX_Text(pDX, IDC_PATH_EDIT, m_strPath);
-       DDX_Check(pDX, IDC_DOVSS_CHECK, m_bDoVss);
+       DDX_CBIndex(pDX, IDC_VER_SYS, m_nVerSys);
        //}}AFX_DATA_MAP
 }
 
 
 BEGIN_MESSAGE_MAP(CPropVss, CPropertyPage)
        //{{AFX_MSG_MAP(CPropVss)
-       ON_BN_CLICKED(IDC_DOVSS_CHECK, OnDovssCheck)
        ON_BN_CLICKED(IDC_BROWSE_BUTTON, OnBrowseButton)
+       ON_CBN_SELENDOK(IDC_VER_SYS, OnSelendokVerSys)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -92,16 +92,6 @@ BOOL ChooseFile( CString& strResult,
        return FALSE;      
 }
 
-
-
-void CPropVss::OnDovssCheck() 
-{
-       UpdateData(TRUE);
-       m_ctlPath.EnableWindow(m_bDoVss);
-       m_ctlVssL1.EnableWindow(m_bDoVss);
-       m_ctlBrowse.EnableWindow(m_bDoVss);
-}
-
 void CPropVss::OnBrowseButton() 
 {
        CString s;
@@ -119,7 +109,17 @@ BOOL CPropVss::OnInitDialog()
        CPropertyPage::OnInitDialog();
        
        UpdateData(FALSE);
-       OnDovssCheck();
+       OnSelendokVerSys();
        
        return TRUE;  
 }
+
+void CPropVss::OnSelendokVerSys() 
+{
+       UpdateData(TRUE);
+       CString tempStr((LPCSTR)(m_nVerSys==2?IDS_CC_CMD:IDS_VSS_CMD));
+       m_ctlVssL1.SetWindowText(tempStr);
+       m_ctlPath.EnableWindow(m_nVerSys>0);
+       m_ctlVssL1.EnableWindow(m_nVerSys>0);
+       m_ctlBrowse.EnableWindow(m_nVerSys>0);
+}
index e120fa2..e3532c2 100644 (file)
@@ -26,7 +26,7 @@ public:
        CEdit   m_ctlPath;
        CButton m_ctlBrowse;
        CString m_strPath;
-       BOOL    m_bDoVss;
+       int             m_nVerSys;
        //}}AFX_DATA
 
 
@@ -41,9 +41,9 @@ public:
 protected:
        // Generated message map functions
        //{{AFX_MSG(CPropVss)
-       afx_msg void OnDovssCheck();
        afx_msg void OnBrowseButton();
        virtual BOOL OnInitDialog();
+       afx_msg void OnSelendokVerSys();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 
index 536b8ed..decdaf6 100644 (file)
@@ -58,6 +58,7 @@ void CVssPrompt::DoDataExchange(CDataExchange* pDX)
 
 BEGIN_MESSAGE_MAP(CVssPrompt, CDialog)
        //{{AFX_MSG_MAP(CVssPrompt)
+       ON_BN_CLICKED(IDSAVEAS, OnSaveas)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -87,3 +88,8 @@ void CVssPrompt::OnOK()
        
        CDialog::OnOK();
 }
+
+void CVssPrompt::OnSaveas() 
+{
+       EndDialog(IDSAVEAS);
+}
index 1833fab..d2ed195 100644 (file)
@@ -40,6 +40,7 @@ protected:
        //{{AFX_MSG(CVssPrompt)
        virtual BOOL OnInitDialog();
        virtual void OnOK();
+       afx_msg void OnSaveas();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
index 46513ac..c101580 100644 (file)
@@ -25,7 +25,7 @@
 #define IDD_PROPPAGE_LARGE              133
 #define IDS_CONFIRM_ALL_RIGHT           133
 #define IDS_COPY2DIR_FMT                134
-#define IDB_BITMAP1                     134
+#define IDD_CLEARCASE                   134
 #define IDS_CONFIRM_COPY2DIR            135
 #define IDS_FONT_CHANGE                 136
 #define IDS_DIRECTORY_WINDOW_TITLE      137
@@ -59,6 +59,9 @@
 #define IDS_NO_DIFF_SEL                 165
 #define IDS_NO_DIFF_SEL_FMT             165
 #define IDS_FILEISDIR                   166
+#define IDS_CC_CMD                      167
+#define IDS_VSS_CMD                     168
+#define IDS_VSS_RUN_ERROR               169
 #define IDB_EQUAL                       213
 #define IDB_NOTEQUAL                    214
 #define IDB_RFOLDER                     215
@@ -91,6 +94,8 @@
 #define IDC_IGNCASE_CHECK               1014
 #define IDC_EMAIL                       1015
 #define IDC_COMPANY                     1016
+#define IDC_COMMENTS                    1017
+#define IDC_VER_SYS                     1018
 #define IDD_LANGUAGE_SELECT             30000
 #define IDS_AFRIKAANS                   30003
 #define IDS_ALBANIAN                    30004
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        135
-#define _APS_NEXT_COMMAND_VALUE         32809
-#define _APS_NEXT_CONTROL_VALUE         1017
+#define _APS_NEXT_COMMAND_VALUE         32806
+#define _APS_NEXT_CONTROL_VALUE         1019
 #define _APS_NEXT_SYMED_VALUE           106
 #endif
 #endif