1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2007-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "CopyCommand.h"
\r
22 #include "CopyDlg.h"
\r
23 #include "SVNProgressDlg.h"
\r
24 #include "StringUtils.h"
\r
26 bool CopyCommand::Execute()
\r
30 if (parser.HasKey(_T("logmsg")))
\r
32 msg = parser.GetVal(_T("logmsg"));
\r
34 if (parser.HasKey(_T("logmsgfile")))
\r
36 CString logmsgfile = parser.GetVal(_T("logmsgfile"));
\r
37 CStringUtils::ReadStringFromTextFile(logmsgfile, msg);
\r
40 BOOL repeat = FALSE;
\r
42 dlg.m_sLogMessage = msg;
\r
44 dlg.m_path = cmdLinePath;
\r
45 CString url = parser.GetVal(_T("url"));
\r
47 SVNRev copyRev = SVNRev::REV_HEAD;
\r
48 BOOL doSwitch = FALSE;
\r
53 dlg.m_sLogMessage = logmessage;
\r
54 dlg.m_CopyRev = copyRev;
\r
55 dlg.m_bDoSwitch = doSwitch;
\r
56 if (dlg.DoModal() == IDOK)
\r
58 theApp.m_pMainWnd = NULL;
\r
59 TRACE(_T("copy %s to %s\n"), (LPCTSTR)cmdLinePath.GetWinPathString(), (LPCTSTR)dlg.m_URL);
\r
60 CSVNProgressDlg progDlg;
\r
61 progDlg.SetCommand(CSVNProgressDlg::SVNProgress_Copy);
\r
62 if (parser.HasVal(_T("closeonend")))
\r
63 progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
\r
64 progDlg.SetOptions(dlg.m_bDoSwitch ? ProgOptSwitchAfterCopy : ProgOptNone);
\r
65 progDlg.SetPathList(pathList);
\r
66 progDlg.SetUrl(dlg.m_URL);
\r
67 progDlg.SetCommitMessage(dlg.m_sLogMessage);
\r
68 progDlg.SetRevision(dlg.m_CopyRev);
\r
70 logmessage = dlg.m_sLogMessage;
\r
71 copyRev = dlg.m_CopyRev;
\r
72 doSwitch = dlg.m_bDoSwitch;
\r
74 CRegDWORD err = CRegDWORD(_T("Software\\TortoiseGit\\ErrorOccurred"), FALSE);
\r
75 err = (DWORD)progDlg.DidErrorsOccur();
\r
76 bRet = !progDlg.DidErrorsOccur();
\r
77 repeat = progDlg.DidErrorsOccur();
\r
78 CRegDWORD bFailRepeat = CRegDWORD(_T("Software\\TortoiseGit\\CommitReopen"), FALSE);
\r
79 if (DWORD(bFailRepeat) == FALSE)
\r
80 repeat = false; // do not repeat if the user chose not to in the settings.
\r