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