1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-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 "TortoiseProc.h"
\r
21 #include "messagebox.h"
\r
22 #include "SVNProgressDlg.h"
\r
24 #include "TGitPath.h"
\r
25 #include "Registry.h"
\r
26 #include "GitStatus.h"
\r
27 #include "AppUtils.h"
\r
28 #include "PathUtils.h"
\r
29 #include "StringUtils.h"
\r
30 #include "TempFile.h"
\r
31 #include "UnicodeUtils.h"
\r
32 #include "SoundUtils.h"
\r
33 #include "GitDiff.h"
\r
35 #include "DropFiles.h"
\r
36 //#include "GitLogHelper.h"
\r
37 #include "RegHistory.h"
\r
38 //#include "ConflictResolveDlg.h"
\r
39 #include "LogFile.h"
\r
40 #include "ShellUpdater.h"
\r
41 #include "IconMenu.h"
\r
42 #include "BugTraqAssociations.h"
\r
44 static UINT WM_GITPROGRESS = RegisterWindowMessage(_T("TORTOISEGIT_GITPROGRESS_MSG"));
\r
46 BOOL CGitProgressDlg::m_bAscending = FALSE;
\r
47 int CGitProgressDlg::m_nSortedColumn = -1;
\r
49 #define TRANSFERTIMER 100
\r
50 #define VISIBLETIMER 101
\r
52 enum SVNProgressDlgContextMenuCommands
\r
54 // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu
\r
58 ID_CONFLICTUSETHEIRS,
\r
67 IMPLEMENT_DYNAMIC(CGitProgressDlg, CResizableStandAloneDialog)
\r
68 CGitProgressDlg::CGitProgressDlg(CWnd* pParent /*=NULL*/)
\r
69 : CResizableStandAloneDialog(CGitProgressDlg::IDD, pParent)
\r
71 , m_Revision(_T("HEAD"))
\r
72 //, m_RevisionEnd(0)
\r
73 , m_bLockWarning(false)
\r
74 , m_bLockExists(false)
\r
75 , m_bCancelled(FALSE)
\r
76 , m_bThreadRunning(FALSE)
\r
78 , m_bErrorsOccurred(FALSE)
\r
79 , m_bMergesAddsDeletesOccurred(FALSE)
\r
81 , m_options(ProgOptNone)
\r
82 , m_dwCloseOnEnd((DWORD)-1)
\r
83 , m_bFinishedItemAdded(false)
\r
84 , m_bLastVisible(false)
\r
85 // , m_depth(svn_depth_unknown)
\r
87 , m_itemCountTotal(-1)
\r
88 , m_AlwaysConflicted(false)
\r
89 , m_BugTraqProvider(NULL)
\r
90 , sIgnoredIncluded(MAKEINTRESOURCE(IDS_PROGRS_IGNOREDINCLUDED))
\r
91 , sExtExcluded(MAKEINTRESOURCE(IDS_PROGRS_EXTERNALSEXCLUDED))
\r
92 , sExtIncluded(MAKEINTRESOURCE(IDS_PROGRS_EXTERNALSINCLUDED))
\r
93 , sIgnoreAncestry(MAKEINTRESOURCE(IDS_PROGRS_IGNOREANCESTRY))
\r
94 , sRespectAncestry(MAKEINTRESOURCE(IDS_PROGRS_RESPECTANCESTRY))
\r
95 , sDryRun(MAKEINTRESOURCE(IDS_PROGRS_DRYRUN))
\r
96 , sRecordOnly(MAKEINTRESOURCE(IDS_MERGE_RECORDONLY))
\r
101 CGitProgressDlg::~CGitProgressDlg()
\r
103 for (size_t i=0; i<m_arData.size(); i++)
\r
105 delete m_arData[i];
\r
107 if(m_pThread != NULL)
\r
113 void CGitProgressDlg::DoDataExchange(CDataExchange* pDX)
\r
115 CResizableStandAloneDialog::DoDataExchange(pDX);
\r
116 DDX_Control(pDX, IDC_SVNPROGRESS, m_ProgList);
\r
119 BEGIN_MESSAGE_MAP(CGitProgressDlg, CResizableStandAloneDialog)
\r
120 ON_BN_CLICKED(IDC_LOGBUTTON, OnBnClickedLogbutton)
\r
121 ON_NOTIFY(NM_CUSTOMDRAW, IDC_SVNPROGRESS, OnNMCustomdrawSvnprogress)
\r
123 ON_NOTIFY(NM_DBLCLK, IDC_SVNPROGRESS, OnNMDblclkSvnprogress)
\r
124 ON_NOTIFY(HDN_ITEMCLICK, 0, OnHdnItemclickSvnprogress)
\r
126 ON_WM_CONTEXTMENU()
\r
127 ON_REGISTERED_MESSAGE(WM_GITPROGRESS, OnGitProgress)
\r
129 ON_EN_SETFOCUS(IDC_INFOTEXT, &CGitProgressDlg::OnEnSetfocusInfotext)
\r
130 ON_NOTIFY(LVN_BEGINDRAG, IDC_SVNPROGRESS, &CGitProgressDlg::OnLvnBegindragSvnprogress)
\r
132 ON_NOTIFY(LVN_GETDISPINFO, IDC_SVNPROGRESS, &CGitProgressDlg::OnLvnGetdispinfoSvnprogress)
\r
133 ON_BN_CLICKED(IDC_NONINTERACTIVE, &CGitProgressDlg::OnBnClickedNoninteractive)
\r
134 ON_MESSAGE(WM_SHOWCONFLICTRESOLVER, OnShowConflictResolver)
\r
137 BOOL CGitProgressDlg::Cancel()
\r
139 return m_bCancelled;
\r
142 LRESULT CGitProgressDlg::OnShowConflictResolver(WPARAM /*wParam*/, LPARAM lParam)
\r
145 CConflictResolveDlg dlg(this);
\r
146 const svn_wc_conflict_description_t *description = (svn_wc_conflict_description_t *)lParam;
\r
149 dlg.SetConflictDescription(description);
\r
150 if (dlg.DoModal() == IDOK)
\r
152 if (dlg.GetResult() == svn_wc_conflict_choose_postpone)
\r
154 // if the result is conflicted and the dialog returned IDOK,
\r
155 // that means we should not ask again in case of a conflict
\r
156 m_AlwaysConflicted = true;
\r
157 ::SendMessage(GetDlgItem(IDC_NONINTERACTIVE)->GetSafeHwnd(), BM_SETCHECK, BST_CHECKED, 0);
\r
160 m_mergedfile = dlg.GetMergedFile();
\r
161 m_bCancelled = dlg.IsCancelled();
\r
162 return dlg.GetResult();
\r
165 return svn_wc_conflict_choose_postpone;
\r
170 svn_wc_conflict_choice_t CGitProgressDlg::ConflictResolveCallback(const svn_wc_conflict_description_t *description, CString& mergedfile)
\r
172 // we only bother the user when merging
\r
173 if (((m_Command == GitProgress_Merge)||(m_Command == GitProgress_MergeAll)||(m_Command == GitProgress_MergeReintegrate))&&(!m_AlwaysConflicted)&&(description))
\r
175 // we're in a worker thread here. That means we must not show a dialog from the thread
\r
176 // but let the UI thread do it.
\r
177 // To do that, we send a message to the UI thread and let it show the conflict resolver dialog.
\r
178 LRESULT dlgResult = ::SendMessage(GetSafeHwnd(), WM_SHOWCONFLICTRESOLVER, 0, (LPARAM)description);
\r
179 mergedfile = m_mergedfile;
\r
180 return (svn_wc_conflict_choice_t)dlgResult;
\r
183 return svn_wc_conflict_choose_postpone;
\r
186 void CGitProgressDlg::AddItemToList()
\r
188 int totalcount = m_ProgList.GetItemCount();
\r
190 m_ProgList.SetItemCountEx(totalcount+1, LVSICF_NOSCROLL|LVSICF_NOINVALIDATEALL);
\r
191 // make columns width fit
\r
192 if (iFirstResized < 30)
\r
194 // only resize the columns for the first 30 or so entries.
\r
195 // after that, don't resize them anymore because that's an
\r
196 // expensive function call and the columns will be sized
\r
197 // close enough already.
\r
202 // Make sure the item is *entirely* visible even if the horizontal
\r
203 // scroll bar is visible.
\r
204 int count = m_ProgList.GetCountPerPage();
\r
205 if (totalcount <= (m_ProgList.GetTopIndex() + count + nEnsureVisibleCount + 2))
\r
207 nEnsureVisibleCount++;
\r
208 m_bLastVisible = true;
\r
212 nEnsureVisibleCount = 0;
\r
213 if (IsIconic() == 0)
\r
214 m_bLastVisible = false;
\r
219 BOOL CGitProgressDlg::Notify(const CTGitPath& path, git_wc_notify_action_t action
\r
221 svn_node_kind_t kind, const CString& mime_type,
\r
222 svn_wc_notify_state_t content_state,
\r
223 svn_wc_notify_state_t prop_state, LONG rev,
\r
224 const svn_lock_t * lock, svn_wc_notify_lock_state_t lock_state,
\r
225 const CString& changelistname,
\r
226 svn_merge_range_t * range,
\r
227 svn_error_t * err, apr_pool_t * pool
\r
230 bool bNoNotify = false;
\r
231 bool bDoAddData = true;
\r
232 NotificationData * data = new NotificationData();
\r
234 data->action = action;
\r
235 data->sPathColumnText=path.GetGitPathString();
\r
238 data->mime_type = mime_type;
\r
239 data->content_state = content_state;
\r
240 data->prop_state = prop_state;
\r
242 data->lock_state = lock_state;
\r
243 data->changelistname = changelistname;
\r
244 if ((lock)&&(lock->owner))
\r
245 data->owner = CUnicodeUtils::GetUnicode(lock->owner);
\r
246 data->sPathColumnText = path.GetUIPathString();
\r
247 if (!m_basePath.IsEmpty())
\r
248 data->basepath = m_basePath;
\r
250 data->merge_range = *range;
\r
252 switch (data->action)
\r
254 case git_wc_notify_add:
\r
255 //case svn_wc_notify_update_add:
\r
256 // if ((data->content_state == svn_wc_notify_state_conflicted) || (data->prop_state == svn_wc_notify_state_conflicted))
\r
258 // data->color = m_Colors.GetColor(CColors::Conflict);
\r
259 // data->bConflictedActionItem = true;
\r
260 // data->sActionColumnText.LoadString(IDS_SVNACTION_CONFLICTED);
\r
265 // m_bMergesAddsDeletesOccurred = true;
\r
266 data->sActionColumnText.LoadString(IDS_SVNACTION_ADD);
\r
267 data->color = m_Colors.GetColor(CColors::Added);
\r
271 case git_wc_notify_resolved:
\r
272 data->sActionColumnText.LoadString(IDS_SVNACTION_RESOLVE);
\r
276 case svn_wc_notify_commit_added:
\r
277 data->sActionColumnText.LoadString(IDS_SVNACTION_ADDING);
\r
278 data->color = m_Colors.GetColor(CColors::Added);
\r
280 case svn_wc_notify_copy:
\r
281 data->sActionColumnText.LoadString(IDS_SVNACTION_COPY);
\r
283 case svn_wc_notify_commit_modified:
\r
284 data->sActionColumnText.LoadString(IDS_SVNACTION_MODIFIED);
\r
285 data->color = m_Colors.GetColor(CColors::Modified);
\r
287 case svn_wc_notify_delete:
\r
288 case svn_wc_notify_update_delete:
\r
289 data->sActionColumnText.LoadString(IDS_SVNACTION_DELETE);
\r
290 m_bMergesAddsDeletesOccurred = true;
\r
291 data->color = m_Colors.GetColor(CColors::Deleted);
\r
293 case svn_wc_notify_commit_deleted:
\r
294 data->sActionColumnText.LoadString(IDS_SVNACTION_DELETING);
\r
295 data->color = m_Colors.GetColor(CColors::Deleted);
\r
297 case svn_wc_notify_restore:
\r
298 data->sActionColumnText.LoadString(IDS_SVNACTION_RESTORE);
\r
300 case svn_wc_notify_revert:
\r
301 data->sActionColumnText.LoadString(IDS_SVNACTION_REVERT);
\r
303 case svn_wc_notify_update_replace:
\r
304 case svn_wc_notify_commit_replaced:
\r
305 data->sActionColumnText.LoadString(IDS_SVNACTION_REPLACED);
\r
306 data->color = m_Colors.GetColor(CColors::Deleted);
\r
308 case svn_wc_notify_exists:
\r
309 if ((data->content_state == svn_wc_notify_state_conflicted) || (data->prop_state == svn_wc_notify_state_conflicted))
\r
311 data->color = m_Colors.GetColor(CColors::Conflict);
\r
312 data->bConflictedActionItem = true;
\r
314 data->sActionColumnText.LoadString(IDS_SVNACTION_CONFLICTED);
\r
316 else if ((data->content_state == svn_wc_notify_state_merged) || (data->prop_state == svn_wc_notify_state_merged))
\r
318 data->color = m_Colors.GetColor(CColors::Merged);
\r
319 m_bMergesAddsDeletesOccurred = true;
\r
320 data->sActionColumnText.LoadString(IDS_SVNACTION_MERGED);
\r
323 data->sActionColumnText.LoadString(IDS_SVNACTION_EXISTS);
\r
325 case svn_wc_notify_update_update:
\r
326 // if this is an inoperative dir change, don't show the notification.
\r
327 // an inoperative dir change is when a directory gets updated without
\r
328 // any real change in either text or properties.
\r
329 if ((kind == svn_node_dir)
\r
330 && ((prop_state == svn_wc_notify_state_inapplicable)
\r
331 || (prop_state == svn_wc_notify_state_unknown)
\r
332 || (prop_state == svn_wc_notify_state_unchanged)))
\r
337 if ((data->content_state == svn_wc_notify_state_conflicted) || (data->prop_state == svn_wc_notify_state_conflicted))
\r
339 data->color = m_Colors.GetColor(CColors::Conflict);
\r
340 data->bConflictedActionItem = true;
\r
342 data->sActionColumnText.LoadString(IDS_SVNACTION_CONFLICTED);
\r
344 else if ((data->content_state == svn_wc_notify_state_merged) || (data->prop_state == svn_wc_notify_state_merged))
\r
346 data->color = m_Colors.GetColor(CColors::Merged);
\r
347 m_bMergesAddsDeletesOccurred = true;
\r
348 data->sActionColumnText.LoadString(IDS_SVNACTION_MERGED);
\r
350 else if (((data->content_state != svn_wc_notify_state_unchanged)&&(data->content_state != svn_wc_notify_state_unknown)) ||
\r
351 ((data->prop_state != svn_wc_notify_state_unchanged)&&(data->prop_state != svn_wc_notify_state_unknown)))
\r
353 data->sActionColumnText.LoadString(IDS_SVNACTION_UPDATE);
\r
360 if (lock_state == svn_wc_notify_lock_state_unlocked)
\r
362 CString temp(MAKEINTRESOURCE(IDS_SVNACTION_UNLOCKED));
\r
363 data->sActionColumnText += _T(", ") + temp;
\r
367 case svn_wc_notify_update_external:
\r
368 // For some reason we build a list of externals...
\r
369 m_ExtStack.AddHead(path.GetUIPathString());
\r
370 data->sActionColumnText.LoadString(IDS_SVNACTION_EXTERNAL);
\r
371 data->bAuxItem = true;
\r
374 case svn_wc_notify_update_completed:
\r
376 data->sActionColumnText.LoadString(IDS_SVNACTION_COMPLETED);
\r
377 data->bAuxItem = true;
\r
378 bool bEmpty = !!m_ExtStack.IsEmpty();
\r
380 data->sPathColumnText.Format(IDS_PROGRS_PATHATREV, (LPCTSTR)m_ExtStack.RemoveHead(), rev);
\r
382 data->sPathColumnText.Format(IDS_PROGRS_ATREV, rev);
\r
384 if ((m_nConflicts>0)&&(bEmpty))
\r
386 // We're going to add another aux item - let's shove this current onto the list first
\r
387 // I don't really like this, but it will do for the moment.
\r
388 m_arData.push_back(data);
\r
391 data = new NotificationData();
\r
392 data->bAuxItem = true;
\r
393 data->sActionColumnText.LoadString(IDS_PROGRS_CONFLICTSOCCURED_WARNING);
\r
394 data->sPathColumnText.LoadString(IDS_PROGRS_CONFLICTSOCCURED);
\r
395 data->color = m_Colors.GetColor(CColors::Conflict);
\r
396 CSoundUtils::PlayTSVNWarning();
\r
397 // This item will now be added after the switch statement
\r
399 if (!m_basePath.IsEmpty())
\r
400 m_FinishedRevMap[m_basePath.GetSVNApiPath(pool)] = rev;
\r
401 m_RevisionEnd = rev;
\r
402 m_bFinishedItemAdded = true;
\r
405 case svn_wc_notify_commit_postfix_txdelta:
\r
406 data->sActionColumnText.LoadString(IDS_SVNACTION_POSTFIX);
\r
408 case svn_wc_notify_failed_revert:
\r
409 data->sActionColumnText.LoadString(IDS_SVNACTION_FAILEDREVERT);
\r
411 case svn_wc_notify_status_completed:
\r
412 case svn_wc_notify_status_external:
\r
413 data->sActionColumnText.LoadString(IDS_SVNACTION_STATUS);
\r
415 case svn_wc_notify_skip:
\r
416 if ((content_state == svn_wc_notify_state_missing)||(content_state == svn_wc_notify_state_obstructed)||(content_state == svn_wc_notify_state_conflicted))
\r
418 data->sActionColumnText.LoadString(IDS_SVNACTION_SKIPMISSING);
\r
420 // The color settings dialog describes the red color with
\r
421 // "possible or real conflict / obstructed" which also applies to
\r
422 // skipped targets during a merge. So we just use the same color.
\r
423 data->color = m_Colors.GetColor(CColors::Conflict);
\r
426 data->sActionColumnText.LoadString(IDS_SVNACTION_SKIP);
\r
428 case svn_wc_notify_locked:
\r
429 if ((lock)&&(lock->owner))
\r
430 data->sActionColumnText.Format(IDS_SVNACTION_LOCKEDBY, (LPCTSTR)CUnicodeUtils::GetUnicode(lock->owner));
\r
432 case svn_wc_notify_unlocked:
\r
433 data->sActionColumnText.LoadString(IDS_SVNACTION_UNLOCKED);
\r
435 case svn_wc_notify_failed_lock:
\r
436 data->sActionColumnText.LoadString(IDS_SVNACTION_FAILEDLOCK);
\r
437 m_arData.push_back(data);
\r
439 ReportError(SVN::GetErrorString(err));
\r
440 bDoAddData = false;
\r
441 if (err->apr_err == SVN_ERR_FS_OUT_OF_DATE)
\r
442 m_bLockWarning = true;
\r
443 if (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED)
\r
444 m_bLockExists = true;
\r
446 case svn_wc_notify_failed_unlock:
\r
447 data->sActionColumnText.LoadString(IDS_SVNACTION_FAILEDUNLOCK);
\r
448 m_arData.push_back(data);
\r
450 ReportError(SVN::GetErrorString(err));
\r
451 bDoAddData = false;
\r
452 if (err->apr_err == SVN_ERR_FS_OUT_OF_DATE)
\r
453 m_bLockWarning = true;
\r
455 case svn_wc_notify_changelist_set:
\r
456 data->sActionColumnText.Format(IDS_SVNACTION_CHANGELISTSET, (LPCTSTR)data->changelistname);
\r
458 case svn_wc_notify_changelist_clear:
\r
459 data->sActionColumnText.LoadString(IDS_SVNACTION_CHANGELISTCLEAR);
\r
461 case svn_wc_notify_changelist_moved:
\r
462 data->sActionColumnText.Format(IDS_SVNACTION_CHANGELISTMOVED, (LPCTSTR)data->changelistname);
\r
464 case svn_wc_notify_foreign_merge_begin:
\r
465 case svn_wc_notify_merge_begin:
\r
467 data->sActionColumnText.LoadString(IDS_SVNACTION_MERGEBEGINNONE);
\r
468 else if ((data->merge_range.start == data->merge_range.end) || (data->merge_range.start == data->merge_range.end - 1))
\r
469 data->sActionColumnText.Format(IDS_SVNACTION_MERGEBEGINSINGLE, data->merge_range.end);
\r
470 else if (data->merge_range.start - 1 == data->merge_range.end)
\r
471 data->sActionColumnText.Format(IDS_SVNACTION_MERGEBEGINSINGLEREVERSE, data->merge_range.start);
\r
472 else if (data->merge_range.start < data->merge_range.end)
\r
473 data->sActionColumnText.Format(IDS_SVNACTION_MERGEBEGINMULTIPLE, data->merge_range.start + 1, data->merge_range.end);
\r
475 data->sActionColumnText.Format(IDS_SVNACTION_MERGEBEGINMULTIPLEREVERSE, data->merge_range.start, data->merge_range.end + 1);
\r
476 data->bAuxItem = true;
\r
481 } // switch (data->action)
\r
489 m_arData.push_back(data);
\r
491 if (/*(!data->bAuxItem)&&*/(m_itemCount > 0))
\r
495 CProgressCtrl * progControl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESSBAR);
\r
496 progControl->ShowWindow(SW_SHOW);
\r
497 progControl->SetPos(m_itemCountTotal - m_itemCount);
\r
498 progControl->SetRange32(0, m_itemCountTotal);
\r
501 //if ((action == svn_wc_notify_commit_postfix_txdelta)&&(bSecondResized == FALSE))
\r
503 // ResizeColumns();
\r
504 // bSecondResized = TRUE;
\r
512 CString CGitProgressDlg::BuildInfoString()
\r
524 int conflicted = 0;
\r
531 for (size_t i=0; i<m_arData.size(); ++i)
\r
533 const NotificationData * dat = m_arData[i];
\r
534 switch (dat->action)
\r
536 case svn_wc_notify_add:
\r
537 case svn_wc_notify_update_add:
\r
538 case svn_wc_notify_commit_added:
\r
539 if (dat->bConflictedActionItem)
\r
544 case svn_wc_notify_copy:
\r
547 case svn_wc_notify_delete:
\r
548 case svn_wc_notify_update_delete:
\r
549 case svn_wc_notify_commit_deleted:
\r
552 case svn_wc_notify_restore:
\r
555 case svn_wc_notify_revert:
\r
558 case svn_wc_notify_resolved:
\r
561 case svn_wc_notify_update_update:
\r
562 if (dat->bConflictedActionItem)
\r
564 else if ((dat->content_state == svn_wc_notify_state_merged) || (dat->prop_state == svn_wc_notify_state_merged))
\r
569 case svn_wc_notify_commit_modified:
\r
572 case svn_wc_notify_skip:
\r
575 case svn_wc_notify_commit_replaced:
\r
582 temp.LoadString(IDS_SVNACTION_CONFLICTED);
\r
584 temp.Format(_T(":%d "), conflicted);
\r
589 temp.LoadString(IDS_SVNACTION_SKIP);
\r
591 infotext.AppendFormat(_T(":%d "), skipped);
\r
595 temp.LoadString(IDS_SVNACTION_MERGED);
\r
597 infotext.AppendFormat(_T(":%d "), merged);
\r
601 temp.LoadString(IDS_SVNACTION_ADD);
\r
603 infotext.AppendFormat(_T(":%d "), added);
\r
607 temp.LoadString(IDS_SVNACTION_DELETE);
\r
609 infotext.AppendFormat(_T(":%d "), deleted);
\r
613 temp.LoadString(IDS_SVNACTION_MODIFIED);
\r
615 infotext.AppendFormat(_T(":%d "), modified);
\r
619 temp.LoadString(IDS_SVNACTION_COPY);
\r
621 infotext.AppendFormat(_T(":%d "), copied);
\r
625 temp.LoadString(IDS_SVNACTION_REPLACED);
\r
627 infotext.AppendFormat(_T(":%d "), replaced);
\r
631 temp.LoadString(IDS_SVNACTION_UPDATE);
\r
633 infotext.AppendFormat(_T(":%d "), updated);
\r
637 temp.LoadString(IDS_SVNACTION_RESTORE);
\r
639 infotext.AppendFormat(_T(":%d "), restored);
\r
643 temp.LoadString(IDS_SVNACTION_REVERT);
\r
645 infotext.AppendFormat(_T(":%d "), reverted);
\r
649 temp.LoadString(IDS_SVNACTION_RESOLVE);
\r
651 infotext.AppendFormat(_T(":%d "), resolved);
\r
657 void CGitProgressDlg::SetSelectedList(const CTGitPathList& selPaths)
\r
659 m_selectedPaths = selPaths;
\r
662 void CGitProgressDlg::ResizeColumns()
\r
664 m_ProgList.SetRedraw(FALSE);
\r
666 TCHAR textbuf[MAX_PATH];
\r
668 int maxcol = ((CHeaderCtrl*)(m_ProgList.GetDlgItem(0)))->GetItemCount()-1;
\r
669 for (int col = 0; col <= maxcol; col++)
\r
671 // find the longest width of all items
\r
672 int count = m_ProgList.GetItemCount();
\r
674 hdi.mask = HDI_TEXT;
\r
675 hdi.pszText = textbuf;
\r
676 hdi.cchTextMax = sizeof(textbuf);
\r
677 ((CHeaderCtrl*)(m_ProgList.GetDlgItem(0)))->GetItem(col, &hdi);
\r
678 int cx = m_ProgList.GetStringWidth(hdi.pszText)+20; // 20 pixels for col separator and margin
\r
680 for (int index = 0; index<count; ++index)
\r
682 // get the width of the string and add 12 pixels for the column separator and margins
\r
683 int linewidth = cx;
\r
687 linewidth = m_ProgList.GetStringWidth(m_arData[index]->sActionColumnText) + 12;
\r
690 linewidth = m_ProgList.GetStringWidth(m_arData[index]->sPathColumnText) + 12;
\r
693 linewidth = m_ProgList.GetStringWidth(m_arData[index]->mime_type) + 12;
\r
696 if (cx < linewidth)
\r
699 m_ProgList.SetColumnWidth(col, cx);
\r
702 m_ProgList.SetRedraw(TRUE);
\r
705 BOOL CGitProgressDlg::OnInitDialog()
\r
707 __super::OnInitDialog();
\r
709 m_ProgList.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
\r
711 m_ProgList.DeleteAllItems();
\r
712 int c = ((CHeaderCtrl*)(m_ProgList.GetDlgItem(0)))->GetItemCount()-1;
\r
714 m_ProgList.DeleteColumn(c--);
\r
716 temp.LoadString(IDS_PROGRS_ACTION);
\r
717 m_ProgList.InsertColumn(0, temp);
\r
718 temp.LoadString(IDS_PROGRS_PATH);
\r
719 m_ProgList.InsertColumn(1, temp);
\r
720 temp.LoadString(IDS_PROGRS_MIMETYPE);
\r
721 m_ProgList.InsertColumn(2, temp);
\r
723 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
\r
724 if (m_pThread==NULL)
\r
726 ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
\r
730 m_pThread->m_bAutoDelete = FALSE;
\r
731 m_pThread->ResumeThread();
\r
736 // Call this early so that the column headings aren't hidden before any
\r
737 // text gets added.
\r
740 SetTimer(VISIBLETIMER, 300, NULL);
\r
742 AddAnchor(IDC_SVNPROGRESS, TOP_LEFT, BOTTOM_RIGHT);
\r
743 AddAnchor(IDC_PROGRESSLABEL, BOTTOM_LEFT, BOTTOM_CENTER);
\r
744 AddAnchor(IDC_PROGRESSBAR, BOTTOM_CENTER, BOTTOM_RIGHT);
\r
745 AddAnchor(IDC_INFOTEXT, BOTTOM_LEFT, BOTTOM_RIGHT);
\r
746 AddAnchor(IDC_NONINTERACTIVE, BOTTOM_LEFT, BOTTOM_RIGHT);
\r
747 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
\r
748 AddAnchor(IDOK, BOTTOM_RIGHT);
\r
749 AddAnchor(IDC_LOGBUTTON, BOTTOM_RIGHT);
\r
750 //SetPromptParentWindow(this->m_hWnd);
\r
752 CenterWindow(CWnd::FromHandle(hWndExplorer));
\r
753 EnableSaveRestore(_T("SVNProgressDlg"));
\r
757 bool CGitProgressDlg::SetBackgroundImage(UINT nID)
\r
759 return CAppUtils::SetListCtrlBackgroundImage(m_ProgList.GetSafeHwnd(), nID);
\r
763 void CGitProgressDlg::ReportSVNError()
\r
765 ReportError(GetLastErrorMessage());
\r
769 void CGitProgressDlg::ReportError(const CString& sError)
\r
771 CSoundUtils::PlayTGitError();
\r
772 ReportString(sError, CString(MAKEINTRESOURCE(IDS_ERR_ERROR)), m_Colors.GetColor(CColors::Conflict));
\r
773 m_bErrorsOccurred = true;
\r
776 void CGitProgressDlg::ReportWarning(const CString& sWarning)
\r
778 CSoundUtils::PlayTGitWarning();
\r
779 ReportString(sWarning, CString(MAKEINTRESOURCE(IDS_WARN_WARNING)), m_Colors.GetColor(CColors::Conflict));
\r
782 void CGitProgressDlg::ReportNotification(const CString& sNotification)
\r
784 CSoundUtils::PlayTGitNotification();
\r
785 ReportString(sNotification, CString(MAKEINTRESOURCE(IDS_WARN_NOTE)));
\r
788 void CGitProgressDlg::ReportCmd(const CString& sCmd)
\r
790 ReportString(sCmd, CString(MAKEINTRESOURCE(IDS_PROGRS_CMDINFO)), m_Colors.GetColor(CColors::Cmd));
\r
793 void CGitProgressDlg::ReportString(CString sMessage, const CString& sMsgKind, COLORREF color)
\r
795 // instead of showing a dialog box with the error message or notification,
\r
796 // just insert the error text into the list control.
\r
797 // that way the user isn't 'interrupted' by a dialog box popping up!
\r
799 // the message may be split up into different lines
\r
800 // so add a new entry for each line of the message
\r
801 while (!sMessage.IsEmpty())
\r
803 NotificationData * data = new NotificationData();
\r
804 data->bAuxItem = true;
\r
805 data->sActionColumnText = sMsgKind;
\r
806 if (sMessage.Find('\n')>=0)
\r
807 data->sPathColumnText = sMessage.Left(sMessage.Find('\n'));
\r
809 data->sPathColumnText = sMessage;
\r
810 data->sPathColumnText.Trim(_T("\n\r"));
\r
811 data->color = color;
\r
812 if (sMessage.Find('\n')>=0)
\r
814 sMessage = sMessage.Mid(sMessage.Find('\n'));
\r
815 sMessage.Trim(_T("\n\r"));
\r
819 m_arData.push_back(data);
\r
824 UINT CGitProgressDlg::ProgressThreadEntry(LPVOID pVoid)
\r
826 return ((CGitProgressDlg*)pVoid)->ProgressThread();
\r
829 UINT CGitProgressDlg::ProgressThread()
\r
831 // The SetParams function should have loaded something for us
\r
834 CString sWindowTitle;
\r
835 bool localoperation = false;
\r
836 bool bSuccess = false;
\r
837 m_AlwaysConflicted = false;
\r
839 DialogEnableWindow(IDOK, FALSE);
\r
840 DialogEnableWindow(IDCANCEL, TRUE);
\r
841 // SetAndClearProgressInfo(m_hWnd);
\r
842 m_itemCount = m_itemCountTotal;
\r
844 InterlockedExchange(&m_bThreadRunning, TRUE);
\r
846 bSecondResized = FALSE;
\r
847 m_bFinishedItemAdded = false;
\r
848 CTime startTime = CTime::GetCurrentTime();
\r
851 case GitProgress_Add:
\r
852 bSuccess = CmdAdd(sWindowTitle, localoperation);
\r
854 case GitProgress_Checkout:
\r
855 bSuccess = CmdCheckout(sWindowTitle, localoperation);
\r
857 case GitProgress_Commit:
\r
858 bSuccess = CmdCommit(sWindowTitle, localoperation);
\r
860 case GitProgress_Copy:
\r
861 bSuccess = CmdCopy(sWindowTitle, localoperation);
\r
863 case GitProgress_Export:
\r
864 bSuccess = CmdExport(sWindowTitle, localoperation);
\r
866 case GitProgress_Import:
\r
867 bSuccess = CmdImport(sWindowTitle, localoperation);
\r
869 case GitProgress_Lock:
\r
870 bSuccess = CmdLock(sWindowTitle, localoperation);
\r
872 case GitProgress_Merge:
\r
873 bSuccess = CmdMerge(sWindowTitle, localoperation);
\r
875 case GitProgress_MergeAll:
\r
876 bSuccess = CmdMergeAll(sWindowTitle, localoperation);
\r
878 case GitProgress_MergeReintegrate:
\r
879 bSuccess = CmdMergeReintegrate(sWindowTitle, localoperation);
\r
881 case GitProgress_Rename:
\r
882 bSuccess = CmdRename(sWindowTitle, localoperation);
\r
884 case GitProgress_Resolve:
\r
885 bSuccess = CmdResolve(sWindowTitle, localoperation);
\r
887 case GitProgress_Revert:
\r
888 bSuccess = CmdRevert(sWindowTitle, localoperation);
\r
890 case GitProgress_Switch:
\r
891 bSuccess = CmdSwitch(sWindowTitle, localoperation);
\r
893 case GitProgress_Unlock:
\r
894 bSuccess = CmdUnlock(sWindowTitle, localoperation);
\r
896 case GitProgress_Update:
\r
897 bSuccess = CmdUpdate(sWindowTitle, localoperation);
\r
901 temp.LoadString(IDS_PROGRS_TITLEFAILED);
\r
903 temp.LoadString(IDS_PROGRS_TITLEFIN);
\r
904 sWindowTitle = sWindowTitle + _T(" ") + temp;
\r
905 SetWindowText(sWindowTitle);
\r
907 KillTimer(TRANSFERTIMER);
\r
908 KillTimer(VISIBLETIMER);
\r
910 DialogEnableWindow(IDCANCEL, FALSE);
\r
911 DialogEnableWindow(IDOK, TRUE);
\r
913 CString info = BuildInfoString();
\r
915 info.LoadString(IDS_PROGRS_INFOFAILED);
\r
916 SetDlgItemText(IDC_INFOTEXT, info);
\r
918 SendMessage(DM_SETDEFID, IDOK);
\r
919 GetDlgItem(IDOK)->SetFocus();
\r
921 CString sFinalInfo;
\r
922 if (!m_sTotalBytesTransferred.IsEmpty())
\r
924 CTimeSpan time = CTime::GetCurrentTime() - startTime;
\r
925 temp.Format(IDS_PROGRS_TIME, (LONG)time.GetTotalMinutes(), (LONG)time.GetSeconds());
\r
926 sFinalInfo.Format(IDS_PROGRS_FINALINFO, m_sTotalBytesTransferred, (LPCTSTR)temp);
\r
927 SetDlgItemText(IDC_PROGRESSLABEL, sFinalInfo);
\r
930 GetDlgItem(IDC_PROGRESSLABEL)->ShowWindow(SW_HIDE);
\r
932 GetDlgItem(IDC_PROGRESSBAR)->ShowWindow(SW_HIDE);
\r
934 if (!m_bFinishedItemAdded)
\r
936 // there's no "finished: xxx" line at the end. We add one here to make
\r
937 // sure the user sees that the command is actually finished.
\r
938 NotificationData * data = new NotificationData();
\r
939 data->bAuxItem = true;
\r
940 data->sActionColumnText.LoadString(IDS_PROGRS_FINISHED);
\r
941 m_arData.push_back(data);
\r
945 int count = m_ProgList.GetItemCount();
\r
946 if ((count > 0)&&(m_bLastVisible))
\r
947 m_ProgList.EnsureVisible(count-1, FALSE);
\r
950 if (logfile.Open())
\r
952 logfile.AddTimeLine();
\r
953 for (size_t i=0; i<m_arData.size(); i++)
\r
955 NotificationData * data = m_arData[i];
\r
956 temp.Format(_T("%-20s : %s"), (LPCTSTR)data->sActionColumnText, (LPCTSTR)data->sPathColumnText);
\r
957 logfile.AddLine(temp);
\r
959 if (!sFinalInfo.IsEmpty())
\r
960 logfile.AddLine(sFinalInfo);
\r
964 m_bCancelled = TRUE;
\r
965 InterlockedExchange(&m_bThreadRunning, FALSE);
\r
968 DWORD dwAutoClose = CRegStdWORD(_T("Software\\TortoiseGit\\AutoClose"));
\r
969 if (m_options & ProgOptDryRun)
\r
970 dwAutoClose = 0; // dry run means progress dialog doesn't auto close at all
\r
971 if (!m_bLastVisible)
\r
973 if (m_dwCloseOnEnd != (DWORD)-1)
\r
974 dwAutoClose = m_dwCloseOnEnd; // command line value has priority over setting value
\r
975 if ((dwAutoClose == CLOSE_NOERRORS)&&(!m_bErrorsOccurred))
\r
976 PostMessage(WM_COMMAND, 1, (LPARAM)GetDlgItem(IDOK)->m_hWnd);
\r
977 if ((dwAutoClose == CLOSE_NOCONFLICTS)&&(!m_bErrorsOccurred)&&(m_nConflicts==0))
\r
978 PostMessage(WM_COMMAND, 1, (LPARAM)GetDlgItem(IDOK)->m_hWnd);
\r
979 if ((dwAutoClose == CLOSE_NOMERGES)&&(!m_bErrorsOccurred)&&(m_nConflicts==0)&&(!m_bMergesAddsDeletesOccurred))
\r
980 PostMessage(WM_COMMAND, 1, (LPARAM)GetDlgItem(IDOK)->m_hWnd);
\r
981 if ((dwAutoClose == CLOSE_LOCAL)&&(!m_bErrorsOccurred)&&(m_nConflicts==0)&&(localoperation))
\r
982 PostMessage(WM_COMMAND, 1, (LPARAM)GetDlgItem(IDOK)->m_hWnd);
\r
984 //Don't do anything here which might cause messages to be sent to the window
\r
985 //The window thread is probably now blocked in OnOK if we've done an auto close
\r
989 void CGitProgressDlg::OnBnClickedLogbutton()
\r
992 if (m_targetPathList.GetCount() != 1)
\r
994 StringRevMap::iterator it = m_UpdateStartRevMap.begin();
\r
995 svn_revnum_t rev = -1;
\r
996 if (it != m_UpdateStartRevMap.end())
\r
1001 dlg.SetParams(m_targetPathList[0], m_RevisionEnd, m_RevisionEnd, rev, 0, TRUE);
\r
1007 void CGitProgressDlg::OnClose()
\r
1011 TerminateThread(m_pThread->m_hThread, (DWORD)-1);
\r
1012 InterlockedExchange(&m_bThreadRunning, FALSE);
\r
1016 m_bCancelled = TRUE;
\r
1019 DialogEnableWindow(IDCANCEL, TRUE);
\r
1020 __super::OnClose();
\r
1023 void CGitProgressDlg::OnOK()
\r
1025 if ((m_bCancelled)&&(!m_bThreadRunning))
\r
1027 // I have made this wait a sensible amount of time (10 seconds) for the thread to finish
\r
1028 // You must be careful in the thread that after posting the WM_COMMAND/IDOK message, you
\r
1029 // don't do any more operations on the window which might require message passing
\r
1030 // If you try to send windows messages once we're waiting here, then the thread can't finished
\r
1031 // because the Window's message loop is blocked at this wait
\r
1032 WaitForSingleObject(m_pThread->m_hThread, 10000);
\r
1035 m_bCancelled = TRUE;
\r
1038 void CGitProgressDlg::OnCancel()
\r
1040 if ((m_bCancelled)&&(!m_bThreadRunning))
\r
1041 __super::OnCancel();
\r
1042 m_bCancelled = TRUE;
\r
1045 void CGitProgressDlg::OnLvnGetdispinfoSvnprogress(NMHDR *pNMHDR, LRESULT *pResult)
\r
1047 NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
\r
1051 if (pDispInfo->item.mask & LVIF_TEXT)
\r
1053 if (pDispInfo->item.iItem < (int)m_arData.size())
\r
1055 const NotificationData * data = m_arData[pDispInfo->item.iItem];
\r
1056 switch (pDispInfo->item.iSubItem)
\r
1059 lstrcpyn(m_columnbuf, data->sActionColumnText, MAX_PATH);
\r
1062 lstrcpyn(m_columnbuf, data->sPathColumnText, pDispInfo->item.cchTextMax);
\r
1063 if (!data->bAuxItem)
\r
1065 int cWidth = m_ProgList.GetColumnWidth(1);
\r
1066 cWidth = max(12, cWidth-12);
\r
1067 CDC * pDC = m_ProgList.GetDC();
\r
1070 CFont * pFont = pDC->SelectObject(m_ProgList.GetFont());
\r
1071 PathCompactPath(pDC->GetSafeHdc(), m_columnbuf, cWidth);
\r
1072 pDC->SelectObject(pFont);
\r
1078 lstrcpyn(m_columnbuf, data->mime_type, MAX_PATH);
\r
1081 m_columnbuf[0] = 0;
\r
1083 pDispInfo->item.pszText = m_columnbuf;
\r
1090 void CGitProgressDlg::OnNMCustomdrawSvnprogress(NMHDR *pNMHDR, LRESULT *pResult)
\r
1092 NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
\r
1094 // Take the default processing unless we set this to something else below.
\r
1095 *pResult = CDRF_DODEFAULT;
\r
1097 // First thing - check the draw stage. If it's the control's prepaint
\r
1098 // stage, then tell Windows we want messages for every item.
\r
1100 if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
\r
1102 *pResult = CDRF_NOTIFYITEMDRAW;
\r
1104 else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
\r
1106 // This is the prepaint stage for an item. Here's where we set the
\r
1107 // item's text color. Our return value will tell Windows to draw the
\r
1108 // item itself, but it will use the new color we set here.
\r
1110 // Tell Windows to paint the control itself.
\r
1111 *pResult = CDRF_DODEFAULT;
\r
1113 ASSERT(pLVCD->nmcd.dwItemSpec < m_arData.size());
\r
1114 if(pLVCD->nmcd.dwItemSpec >= m_arData.size())
\r
1118 const NotificationData * data = m_arData[pLVCD->nmcd.dwItemSpec];
\r
1119 ASSERT(data != NULL);
\r
1123 // Store the color back in the NMLVCUSTOMDRAW struct.
\r
1124 pLVCD->clrText = data->color;
\r
1128 void CGitProgressDlg::OnNMDblclkSvnprogress(NMHDR *pNMHDR, LRESULT *pResult)
\r
1131 LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
\r
1133 if (pNMLV->iItem < 0)
\r
1135 if (m_options & ProgOptDryRun)
\r
1136 return; //don't do anything in a dry-run.
\r
1138 const NotificationData * data = m_arData[pNMLV->iItem];
\r
1142 if (data->bConflictedActionItem)
\r
1144 // We've double-clicked on a conflicted item - do a three-way merge on it
\r
1145 SVNDiff::StartConflictEditor(data->path);
\r
1147 else if ((data->action == svn_wc_notify_update_update) && ((data->content_state == svn_wc_notify_state_merged)||(GitProgress_Merge == m_Command)) || (data->action == svn_wc_notify_resolved))
\r
1149 // This is a modified file which has been merged on update. Diff it against base
\r
1150 CTGitPath temporaryFile;
\r
1151 SVNDiff diff(this, this->m_hWnd, true);
\r
1152 diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));
\r
1153 svn_revnum_t baseRev = 0;
\r
1154 diff.DiffFileAgainstBase(data->path, baseRev);
\r
1156 else if ((!data->bAuxItem)&&(data->path.Exists())&&(!data->path.IsDirectory()))
\r
1158 bool bOpenWith = false;
\r
1159 int ret = (int)ShellExecute(m_hWnd, NULL, data->path.GetWinPath(), NULL, NULL, SW_SHOWNORMAL);
\r
1160 if (ret <= HINSTANCE_ERROR)
\r
1164 CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");
\r
1165 cmd += data->path.GetWinPathString() + _T(" ");
\r
1166 CAppUtils::LaunchApplication(cmd, NULL, false);
\r
1172 void CGitProgressDlg::OnHdnItemclickSvnprogress(NMHDR *pNMHDR, LRESULT *pResult)
\r
1174 LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
\r
1175 if (m_bThreadRunning)
\r
1177 if (m_nSortedColumn == phdr->iItem)
\r
1178 m_bAscending = !m_bAscending;
\r
1180 m_bAscending = TRUE;
\r
1181 m_nSortedColumn = phdr->iItem;
\r
1185 m_ProgList.SetRedraw(FALSE);
\r
1186 m_ProgList.DeleteAllItems();
\r
1187 m_ProgList.SetItemCountEx (static_cast<int>(m_arData.size()));
\r
1189 m_ProgList.SetRedraw(TRUE);
\r
1194 bool CGitProgressDlg::NotificationDataIsAux(const NotificationData* pData)
\r
1196 return pData->bAuxItem;
\r
1199 LRESULT CGitProgressDlg::OnGitProgress(WPARAM /*wParam*/, LPARAM lParam)
\r
1202 SVNProgress * pProgressData = (SVNProgress *)lParam;
\r
1203 CProgressCtrl * progControl = (CProgressCtrl *)GetDlgItem(IDC_PROGRESSBAR);
\r
1204 if ((pProgressData->total > 1000)&&(!progControl->IsWindowVisible()))
\r
1206 progControl->ShowWindow(SW_SHOW);
\r
1208 if (((pProgressData->total < 0)&&(pProgressData->progress > 1000)&&(progControl->IsWindowVisible()))&&(m_itemCountTotal<0))
\r
1210 progControl->ShowWindow(SW_HIDE);
\r
1212 if (!GetDlgItem(IDC_PROGRESSLABEL)->IsWindowVisible())
\r
1213 GetDlgItem(IDC_PROGRESSLABEL)->ShowWindow(SW_SHOW);
\r
1214 SetTimer(TRANSFERTIMER, 2000, NULL);
\r
1215 if ((pProgressData->total > 0)&&(pProgressData->progress > 1000))
\r
1217 progControl->SetPos((int)pProgressData->progress);
\r
1218 progControl->SetRange32(0, (int)pProgressData->total);
\r
1221 if (pProgressData->overall_total < 1024)
\r
1222 m_sTotalBytesTransferred.Format(IDS_SVN_PROGRESS_TOTALBYTESTRANSFERRED, pProgressData->overall_total);
\r
1223 else if (pProgressData->overall_total < 1200000)
\r
1224 m_sTotalBytesTransferred.Format(IDS_SVN_PROGRESS_TOTALTRANSFERRED, pProgressData->overall_total / 1024);
\r
1226 m_sTotalBytesTransferred.Format(IDS_SVN_PROGRESS_TOTALMBTRANSFERRED, (double)((double)pProgressData->overall_total / 1024000.0));
\r
1227 progText.Format(IDS_SVN_PROGRESS_TOTALANDSPEED, (LPCTSTR)m_sTotalBytesTransferred, (LPCTSTR)pProgressData->SpeedString);
\r
1228 SetDlgItemText(IDC_PROGRESSLABEL, progText);
\r
1233 void CGitProgressDlg::OnTimer(UINT_PTR nIDEvent)
\r
1235 if (nIDEvent == TRANSFERTIMER)
\r
1238 CString progSpeed;
\r
1239 progSpeed.Format(IDS_SVN_PROGRESS_BYTES_SEC, 0);
\r
1240 progText.Format(IDS_SVN_PROGRESS_TOTALANDSPEED, (LPCTSTR)m_sTotalBytesTransferred, (LPCTSTR)progSpeed);
\r
1241 SetDlgItemText(IDC_PROGRESSLABEL, progText);
\r
1242 KillTimer(TRANSFERTIMER);
\r
1244 if (nIDEvent == VISIBLETIMER)
\r
1246 if (nEnsureVisibleCount)
\r
1247 m_ProgList.EnsureVisible(m_ProgList.GetItemCount()-1, false);
\r
1248 nEnsureVisibleCount = 0;
\r
1252 void CGitProgressDlg::Sort()
\r
1254 if(m_arData.size() < 2)
\r
1259 // We need to sort the blocks which lie between the auxiliary entries
\r
1260 // This is so that any aux data stays where it was
\r
1261 NotificationDataVect::iterator actionBlockBegin;
\r
1262 NotificationDataVect::iterator actionBlockEnd = m_arData.begin(); // We start searching from here
\r
1266 // Search to the start of the non-aux entry in the next block
\r
1267 actionBlockBegin = std::find_if(actionBlockEnd, m_arData.end(), std::not1(std::ptr_fun(&CGitProgressDlg::NotificationDataIsAux)));
\r
1268 if(actionBlockBegin == m_arData.end())
\r
1270 // There are no more actions
\r
1273 // Now search to find the end of the block
\r
1274 actionBlockEnd = std::find_if(actionBlockBegin+1, m_arData.end(), std::ptr_fun(&CGitProgressDlg::NotificationDataIsAux));
\r
1275 // Now sort the block
\r
1276 std::sort(actionBlockBegin, actionBlockEnd, &CGitProgressDlg::SortCompare);
\r
1280 bool CGitProgressDlg::SortCompare(const NotificationData * pData1, const NotificationData * pData2)
\r
1283 switch (m_nSortedColumn)
\r
1285 case 0: //action column
\r
1286 result = pData1->sActionColumnText.Compare(pData2->sActionColumnText);
\r
1288 case 1: //path column
\r
1289 // Compare happens after switch()
\r
1291 case 2: //mime-type column
\r
1292 result = pData1->mime_type.Compare(pData2->mime_type);
\r
1298 // Sort by path if everything else is equal
\r
1301 result = CTGitPath::Compare(pData1->path, pData2->path);
\r
1304 if (!m_bAscending)
\r
1306 return result < 0;
\r
1309 BOOL CGitProgressDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
\r
1311 if (!GetDlgItem(IDOK)->IsWindowEnabled())
\r
1313 // only show the wait cursor over the list control
\r
1314 if ((pWnd)&&(pWnd == GetDlgItem(IDC_SVNPROGRESS)))
\r
1316 HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT));
\r
1321 HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
\r
1323 return CResizableStandAloneDialog::OnSetCursor(pWnd, nHitTest, message);
\r
1326 BOOL CGitProgressDlg::PreTranslateMessage(MSG* pMsg)
\r
1328 if (pMsg->message == WM_KEYDOWN)
\r
1330 if (pMsg->wParam == VK_ESCAPE)
\r
1332 // pressing the ESC key should close the dialog. But since we disabled the escape
\r
1333 // key (so the user doesn't get the idea that he could simply undo an e.g. update)
\r
1334 // this won't work.
\r
1335 // So if the user presses the ESC key, change it to VK_RETURN so the dialog gets
\r
1336 // the impression that the OK button was pressed.
\r
1337 if ((!m_bThreadRunning)&&(!GetDlgItem(IDCANCEL)->IsWindowEnabled())
\r
1338 &&(GetDlgItem(IDOK)->IsWindowEnabled())&&(GetDlgItem(IDOK)->IsWindowVisible()))
\r
1340 // since we convert ESC to RETURN, make sure the OK button has the focus.
\r
1341 GetDlgItem(IDOK)->SetFocus();
\r
1342 pMsg->wParam = VK_RETURN;
\r
1345 if (pMsg->wParam == 'A')
\r
1347 if (GetKeyState(VK_CONTROL)&0x8000)
\r
1349 // Ctrl-A -> select all
\r
1350 m_ProgList.SetSelectionMark(0);
\r
1351 for (int i=0; i<m_ProgList.GetItemCount(); ++i)
\r
1353 m_ProgList.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
\r
1357 if ((pMsg->wParam == 'C')||(pMsg->wParam == VK_INSERT))
\r
1359 int selIndex = m_ProgList.GetSelectionMark();
\r
1360 if (selIndex >= 0)
\r
1362 if (GetKeyState(VK_CONTROL)&0x8000)
\r
1364 //Ctrl-C -> copy to clipboard
\r
1365 CString sClipdata;
\r
1366 POSITION pos = m_ProgList.GetFirstSelectedItemPosition();
\r
1371 int nItem = m_ProgList.GetNextSelectedItem(pos);
\r
1372 CString sAction = m_ProgList.GetItemText(nItem, 0);
\r
1373 CString sPath = m_ProgList.GetItemText(nItem, 1);
\r
1374 CString sMime = m_ProgList.GetItemText(nItem, 2);
\r
1375 CString sLogCopyText;
\r
1376 sLogCopyText.Format(_T("%s: %s %s\r\n"),
\r
1377 (LPCTSTR)sAction, (LPCTSTR)sPath, (LPCTSTR)sMime);
\r
1378 sClipdata += sLogCopyText;
\r
1380 CStringUtils::WriteAsciiStringToClipboard(sClipdata);
\r
1385 } // if (pMsg->message == WM_KEYDOWN)
\r
1386 return __super::PreTranslateMessage(pMsg);
\r
1389 void CGitProgressDlg::OnContextMenu(CWnd* pWnd, CPoint point)
\r
1392 if (m_options & ProgOptDryRun)
\r
1393 return; // don't do anything in a dry-run.
\r
1395 if (pWnd == &m_ProgList)
\r
1397 int selIndex = m_ProgList.GetSelectionMark();
\r
1398 if ((point.x == -1) && (point.y == -1))
\r
1400 // Menu was invoked from the keyboard rather than by right-clicking
\r
1402 m_ProgList.GetItemRect(selIndex, &rect, LVIR_LABEL);
\r
1403 m_ProgList.ClientToScreen(&rect);
\r
1404 point = rect.CenterPoint();
\r
1407 if ((selIndex >= 0)&&(!m_bThreadRunning))
\r
1409 // entry is selected, thread has finished with updating so show the popup menu
\r
1411 if (popup.CreatePopupMenu())
\r
1413 bool bAdded = false;
\r
1414 NotificationData * data = m_arData[selIndex];
\r
1415 if ((data)&&(!data->path.IsDirectory()))
\r
1417 if (data->action == svn_wc_notify_update_update || data->action == svn_wc_notify_resolved)
\r
1419 if (m_ProgList.GetSelectedCount() == 1)
\r
1421 popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARE, IDI_DIFF);
\r
1425 if (data->bConflictedActionItem)
\r
1427 if (m_ProgList.GetSelectedCount() == 1)
\r
1429 popup.AppendMenuIcon(ID_EDITCONFLICT, IDS_MENUCONFLICT,IDI_CONFLICT);
\r
1430 popup.SetDefaultItem(ID_EDITCONFLICT, FALSE);
\r
1431 popup.AppendMenuIcon(ID_CONFLICTRESOLVE, IDS_SVNPROGRESS_MENUMARKASRESOLVED,IDI_RESOLVE);
\r
1433 popup.AppendMenuIcon(ID_CONFLICTUSETHEIRS, IDS_SVNPROGRESS_MENUUSETHEIRS,IDI_RESOLVE);
\r
1434 popup.AppendMenuIcon(ID_CONFLICTUSEMINE, IDS_SVNPROGRESS_MENUUSEMINE,IDI_RESOLVE);
\r
1436 else if ((data->content_state == svn_wc_notify_state_merged)||(GitProgress_Merge == m_Command)||(data->action == svn_wc_notify_resolved))
\r
1437 popup.SetDefaultItem(ID_COMPARE, FALSE);
\r
1439 if (m_ProgList.GetSelectedCount() == 1)
\r
1441 if ((data->action == svn_wc_notify_add)||
\r
1442 (data->action == svn_wc_notify_update_add)||
\r
1443 (data->action == svn_wc_notify_commit_added)||
\r
1444 (data->action == svn_wc_notify_commit_modified)||
\r
1445 (data->action == svn_wc_notify_restore)||
\r
1446 (data->action == svn_wc_notify_revert)||
\r
1447 (data->action == svn_wc_notify_resolved)||
\r
1448 (data->action == svn_wc_notify_commit_replaced)||
\r
1449 (data->action == svn_wc_notify_commit_modified)||
\r
1450 (data->action == svn_wc_notify_commit_postfix_txdelta)||
\r
1451 (data->action == svn_wc_notify_update_update))
\r
1453 popup.AppendMenuIcon(ID_LOG, IDS_MENULOG,IDI_LOG);
\r
1454 if (data->action == svn_wc_notify_update_update)
\r
1455 popup.AppendMenu(MF_SEPARATOR, NULL);
\r
1456 popup.AppendMenuIcon(ID_OPEN, IDS_LOG_POPUP_OPEN, IDI_OPEN);
\r
1457 popup.AppendMenuIcon(ID_OPENWITH, IDS_LOG_POPUP_OPENWITH, IDI_OPEN);
\r
1461 } // if ((data)&&(!data->path.IsDirectory()))
\r
1462 if (m_ProgList.GetSelectedCount() == 1)
\r
1466 CString sPath = GetPathFromColumnText(data->sPathColumnText);
\r
1467 if ((!sPath.IsEmpty())&&(!SVN::PathIsURL(CTGitPath(sPath))))
\r
1469 CTGitPath path = CTGitPath(sPath);
\r
1470 if (path.GetDirectory().Exists())
\r
1472 popup.AppendMenuIcon(ID_EXPLORE, IDS_SVNPROGRESS_MENUOPENPARENT, IDI_EXPLORER);
\r
1478 if (m_ProgList.GetSelectedCount() > 0)
\r
1481 popup.AppendMenu(MF_SEPARATOR, NULL);
\r
1482 popup.AppendMenuIcon(ID_COPY, IDS_LOG_POPUP_COPYTOCLIPBOARD,IDI_COPYCLIP);
\r
1487 int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0);
\r
1488 DialogEnableWindow(IDOK, FALSE);
\r
1489 this->SetPromptApp(&theApp);
\r
1490 theApp.DoWaitCursor(1);
\r
1491 bool bOpenWith = false;
\r
1497 POSITION pos = m_ProgList.GetFirstSelectedItemPosition();
\r
1500 int nItem = m_ProgList.GetNextSelectedItem(pos);
\r
1501 NotificationData * data = m_arData[nItem];
\r
1504 sLines += data->sPathColumnText;
\r
1505 sLines += _T("\r\n");
\r
1508 sLines.TrimRight();
\r
1509 if (!sLines.IsEmpty())
\r
1511 CStringUtils::WriteAsciiStringToClipboard(sLines, GetSafeHwnd());
\r
1517 CString sPath = GetPathFromColumnText(data->sPathColumnText);
\r
1519 CTGitPath path = CTGitPath(sPath);
\r
1520 ShellExecute(m_hWnd, _T("explore"), path.GetDirectory().GetWinPath(), NULL, path.GetDirectory().GetWinPath(), SW_SHOW);
\r
1525 svn_revnum_t rev = -1;
\r
1526 StringRevMap::iterator it = m_UpdateStartRevMap.end();
\r
1527 if (data->basepath.IsEmpty())
\r
1528 it = m_UpdateStartRevMap.begin();
\r
1530 it = m_UpdateStartRevMap.find(data->basepath.GetSVNApiPath(pool));
\r
1531 if (it != m_UpdateStartRevMap.end())
\r
1533 // if the file was merged during update, do a three way diff between OLD, MINE, THEIRS
\r
1534 if (data->content_state == svn_wc_notify_state_merged)
\r
1536 CTGitPath basefile = CTempFiles::Instance().GetTempFilePath(false, data->path, rev);
\r
1537 CTGitPath newfile = CTempFiles::Instance().GetTempFilePath(false, data->path, SVNRev::REV_HEAD);
\r
1539 if (!svn.Cat(data->path, SVNRev(SVNRev::REV_WC), rev, basefile))
\r
1541 CMessageBox::Show(m_hWnd, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
\r
1542 DialogEnableWindow(IDOK, TRUE);
\r
1545 // If necessary, convert the line-endings on the file before diffing
\r
1546 if ((DWORD)CRegDWORD(_T("Software\\TortoiseGit\\ConvertBase"), TRUE))
\r
1548 CTGitPath temporaryFile = CTempFiles::Instance().GetTempFilePath(false, data->path, SVNRev::REV_BASE);
\r
1549 if (!svn.Cat(data->path, SVNRev(SVNRev::REV_BASE), SVNRev(SVNRev::REV_BASE), temporaryFile))
\r
1551 temporaryFile.Reset();
\r
1556 newfile = temporaryFile;
\r
1560 SetFileAttributes(newfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);
\r
1561 SetFileAttributes(basefile.GetWinPath(), FILE_ATTRIBUTE_READONLY);
\r
1562 CString revname, wcname, basename;
\r
1563 revname.Format(_T("%s Revision %ld"), (LPCTSTR)data->path.GetUIFileOrDirectoryName(), rev);
\r
1564 wcname.Format(IDS_DIFF_WCNAME, (LPCTSTR)data->path.GetUIFileOrDirectoryName());
\r
1565 basename.Format(IDS_DIFF_BASENAME, (LPCTSTR)data->path.GetUIFileOrDirectoryName());
\r
1566 CAppUtils::StartExtMerge(basefile, newfile, data->path, data->path, basename, revname, wcname, CString(), true);
\r
1570 CTGitPath tempfile = CTempFiles::Instance().GetTempFilePath(false, data->path, rev);
\r
1572 if (!svn.Cat(data->path, SVNRev(SVNRev::REV_WC), rev, tempfile))
\r
1574 CMessageBox::Show(m_hWnd, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
\r
1575 DialogEnableWindow(IDOK, TRUE);
\r
1580 SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);
\r
1581 CString revname, wcname;
\r
1582 revname.Format(_T("%s Revision %ld"), (LPCTSTR)data->path.GetUIFileOrDirectoryName(), rev);
\r
1583 wcname.Format(IDS_DIFF_WCNAME, (LPCTSTR)data->path.GetUIFileOrDirectoryName());
\r
1584 CAppUtils::StartExtDiff(
\r
1585 tempfile, data->path, revname, wcname,
\r
1586 CAppUtils::DiffFlags().AlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000)));
\r
1591 case ID_EDITCONFLICT:
\r
1593 CString sPath = GetPathFromColumnText(data->sPathColumnText);
\r
1594 SVNDiff::StartConflictEditor(CTGitPath(sPath));
\r
1597 case ID_CONFLICTUSETHEIRS:
\r
1598 case ID_CONFLICTUSEMINE:
\r
1599 case ID_CONFLICTRESOLVE:
\r
1601 svn_wc_conflict_choice_t result = svn_wc_conflict_choose_merged;
\r
1604 case ID_CONFLICTUSETHEIRS:
\r
1605 result = svn_wc_conflict_choose_theirs_full;
\r
1607 case ID_CONFLICTUSEMINE:
\r
1608 result = svn_wc_conflict_choose_mine_full;
\r
1610 case ID_CONFLICTRESOLVE:
\r
1611 result = svn_wc_conflict_choose_merged;
\r
1615 POSITION pos = m_ProgList.GetFirstSelectedItemPosition();
\r
1616 CString sResolvedPaths;
\r
1619 int nItem = m_ProgList.GetNextSelectedItem(pos);
\r
1620 NotificationData * data = m_arData[nItem];
\r
1623 if (data->bConflictedActionItem)
\r
1625 if (!svn.Resolve(data->path, result, FALSE))
\r
1627 CMessageBox::Show(m_hWnd, svn.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
\r
1628 DialogEnableWindow(IDOK, TRUE);
\r
1633 data->color = ::GetSysColor(COLOR_WINDOWTEXT);
\r
1634 data->action = svn_wc_notify_resolved;
\r
1635 data->sActionColumnText.LoadString(IDS_SVNACTION_RESOLVE);
\r
1636 data->bConflictedActionItem = false;
\r
1639 if (m_nConflicts==0)
\r
1641 // When the last conflict is resolved we remove
\r
1642 // the warning which we assume is in the last line.
\r
1643 int nIndex = m_ProgList.GetItemCount()-1;
\r
1644 VERIFY(m_ProgList.DeleteItem(nIndex));
\r
1646 delete m_arData[nIndex];
\r
1647 m_arData.pop_back();
\r
1649 sResolvedPaths += data->path.GetWinPathString() + _T("\n");
\r
1654 m_ProgList.Invalidate();
\r
1655 CString info = BuildInfoString();
\r
1656 SetDlgItemText(IDC_INFOTEXT, info);
\r
1658 if (!sResolvedPaths.IsEmpty())
\r
1661 msg.Format(IDS_SVNPROGRESS_RESOLVED, (LPCTSTR)sResolvedPaths);
\r
1662 CMessageBox::Show(m_hWnd, msg, _T("TortoiseSVN"), MB_OK | MB_ICONINFORMATION);
\r
1668 CRegDWORD reg = CRegDWORD(_T("Software\\TortoiseGit\\NumberOfLogs"), 100);
\r
1669 int limit = (int)(DWORD)reg;
\r
1670 svn_revnum_t rev = m_RevisionEnd;
\r
1671 if (!data->basepath.IsEmpty())
\r
1673 StringRevMap::iterator it = m_FinishedRevMap.find(data->basepath.GetSVNApiPath(pool));
\r
1674 if (it != m_FinishedRevMap.end())
\r
1678 // fetch the log from HEAD, not the revision we updated to:
\r
1679 // the path might be inside an external folder which has its own
\r
1681 CString sPath = GetPathFromColumnText(data->sPathColumnText);
\r
1682 dlg.SetParams(CTGitPath(sPath), SVNRev(), SVNRev::REV_HEAD, 1, limit, TRUE);
\r
1691 CString sWinPath = GetPathFromColumnText(data->sPathColumnText);
\r
1693 ret = (int)ShellExecute(this->m_hWnd, NULL, (LPCTSTR)sWinPath, NULL, NULL, SW_SHOWNORMAL);
\r
1694 if ((ret <= HINSTANCE_ERROR)||bOpenWith)
\r
1696 CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");
\r
1697 cmd += sWinPath + _T(" ");
\r
1698 CAppUtils::LaunchApplication(cmd, NULL, false);
\r
1702 DialogEnableWindow(IDOK, TRUE);
\r
1703 theApp.DoWaitCursor(-1);
\r
1711 void CGitProgressDlg::OnEnSetfocusInfotext()
\r
1714 GetDlgItemText(IDC_INFOTEXT, sTemp);
\r
1715 if (sTemp.IsEmpty())
\r
1716 GetDlgItem(IDC_INFOTEXT)->HideCaret();
\r
1719 void CGitProgressDlg::OnLvnBegindragSvnprogress(NMHDR* , LRESULT *pResult)
\r
1721 //LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
\r
1723 int selIndex = m_ProgList.GetSelectionMark();
\r
1727 CDropFiles dropFiles; // class for creating DROPFILES struct
\r
1730 POSITION pos = m_ProgList.GetFirstSelectedItemPosition();
\r
1731 while ( (index = m_ProgList.GetNextSelectedItem(pos)) >= 0 )
\r
1733 NotificationData * data = m_arData[index];
\r
1735 if ( data->kind==svn_node_file || data->kind==svn_node_dir )
\r
1737 CString sPath = GetPathFromColumnText(data->sPathColumnText);
\r
1739 dropFiles.AddFile( sPath );
\r
1743 if ( dropFiles.GetCount()>0 )
\r
1745 dropFiles.CreateStructure();
\r
1751 void CGitProgressDlg::OnSize(UINT nType, int cx, int cy)
\r
1753 CResizableStandAloneDialog::OnSize(nType, cx, cy);
\r
1754 if ((nType == SIZE_RESTORED)&&(m_bLastVisible))
\r
1756 if(!m_ProgList.m_hWnd)
\r
1759 int count = m_ProgList.GetItemCount();
\r
1761 m_ProgList.EnsureVisible(count-1, false);
\r
1765 //////////////////////////////////////////////////////////////////////////
\r
1767 //////////////////////////////////////////////////////////////////////////
\r
1768 bool CGitProgressDlg::CmdAdd(CString& sWindowTitle, bool& localoperation)
\r
1771 localoperation = true;
\r
1772 sWindowTitle.LoadString(IDS_PROGRS_TITLE_ADD);
\r
1773 SetWindowText(sWindowTitle);
\r
1774 SetBackgroundImage(IDI_ADD_BKG);
\r
1775 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_ADD)));
\r
1777 for(int i=0;i<m_targetPathList.GetCount();i++)
\r
1780 cmd.Format(_T("git.exe add -f \"%s\""),m_targetPathList[i].GetGitPathString());
\r
1781 if(g_Git.Run(cmd,&out,CP_ACP))
\r
1783 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
\r
1784 m_bErrorsOccurred=true;
\r
1787 Notify(m_targetPathList[i],git_wc_notify_add);
\r
1790 if (!Add(m_targetPathList, &m_ProjectProperties, svn_depth_empty, FALSE, TRUE, TRUE))
\r
1796 //CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList);
\r
1797 m_bErrorsOccurred=false;
\r
1801 bool CGitProgressDlg::CmdCheckout(CString& sWindowTitle, bool& /*localoperation*/)
\r
1804 ASSERT(m_targetPathList.GetCount() == 1);
\r
1805 sWindowTitle.LoadString(IDS_PROGRS_TITLE_CHECKOUT);
\r
1806 SetBackgroundImage(IDI_CHECKOUT_BKG);
\r
1807 CTGitPathList urls;
\r
1808 urls.LoadFromAsteriskSeparatedString(m_url.GetSVNPathString());
\r
1809 CTGitPath checkoutdir = m_targetPathList[0];
\r
1810 for (int i=0; i<urls.GetCount(); ++i)
\r
1812 sWindowTitle = urls[i].GetUIFileOrDirectoryName()+_T(" - ")+sWindowTitle;
\r
1813 SetWindowText(sWindowTitle);
\r
1814 checkoutdir = m_targetPathList[0];
\r
1815 if (urls.GetCount() > 1)
\r
1817 CString fileordir = urls[i].GetFileOrDirectoryName();
\r
1818 fileordir = CPathUtils::PathUnescape(fileordir);
\r
1819 checkoutdir.AppendPathString(fileordir);
\r
1822 sCmdInfo.Format(IDS_PROGRS_CMD_CHECKOUT,
\r
1823 (LPCTSTR)urls[i].GetSVNPathString(), (LPCTSTR)m_Revision.ToString(),
\r
1824 (LPCTSTR)SVNStatus::GetDepthString(m_depth),
\r
1825 m_options & ProgOptIgnoreExternals ? (LPCTSTR)sExtExcluded : (LPCTSTR)sExtIncluded);
\r
1826 ReportCmd(sCmdInfo);
\r
1828 if (!Checkout(urls[i], checkoutdir, m_Revision, m_Revision, m_depth, m_options & ProgOptIgnoreExternals))
\r
1830 if (m_ProgList.GetItemCount()!=0)
\r
1835 // if the checkout fails with the peg revision set to the checkout revision,
\r
1836 // try again with HEAD as the peg revision.
\r
1839 if (!Checkout(urls[i], checkoutdir, SVNRev::REV_HEAD, m_Revision, m_depth, m_options & ProgOptIgnoreExternals))
\r
1851 bool CGitProgressDlg::CmdCommit(CString& sWindowTitle, bool& /*localoperation*/)
\r
1854 sWindowTitle.LoadString(IDS_PROGRS_TITLE_COMMIT);
\r
1855 SetWindowText(sWindowTitle);
\r
1856 SetBackgroundImage(IDI_COMMIT_BKG);
\r
1857 if (m_targetPathList.GetCount()==0)
\r
1859 SetWindowText(sWindowTitle);
\r
1861 DialogEnableWindow(IDCANCEL, FALSE);
\r
1862 DialogEnableWindow(IDOK, TRUE);
\r
1864 InterlockedExchange(&m_bThreadRunning, FALSE);
\r
1867 if (m_targetPathList.GetCount()==1)
\r
1869 sWindowTitle = m_targetPathList[0].GetUIFileOrDirectoryName()+_T(" - ")+sWindowTitle;
\r
1870 SetWindowText(sWindowTitle);
\r
1872 BOOL isTag = FALSE;
\r
1873 BOOL bURLFetched = FALSE;
\r
1875 for (int i=0; i<m_targetPathList.GetCount(); ++i)
\r
1877 if (bURLFetched == FALSE)
\r
1879 url = GetURLFromPath(m_targetPathList[i]);
\r
1880 if (!url.IsEmpty())
\r
1881 bURLFetched = TRUE;
\r
1882 CString urllower = url;
\r
1883 urllower.MakeLower();
\r
1884 // test if the commit goes to a tag.
\r
1885 // now since Subversion doesn't force users to
\r
1886 // create tags in the recommended /tags/ folder
\r
1887 // only a warning is shown. This won't work if the tags
\r
1888 // are stored in a non-recommended place, but the check
\r
1889 // still helps those who do.
\r
1890 if (urllower.Find(_T("/tags/"))>=0)
\r
1897 if (CMessageBox::Show(m_hWnd, IDS_PROGRS_COMMITT_TRUNK, IDS_APPNAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONEXCLAMATION)==IDNO)
\r
1900 DWORD exitcode = 0;
\r
1902 if (CHooks::Instance().PreCommit(m_selectedPaths, m_depth, m_sMessage, exitcode, error))
\r
1907 temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
\r
1908 ReportError(temp);
\r
1913 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_COMMIT)));
\r
1914 CStringArray changelists;
\r
1915 if (!m_changelist.IsEmpty())
\r
1916 changelists.Add(m_changelist);
\r
1917 bool commitSuccessful = true;
\r
1918 if (!Commit(m_targetPathList, m_sMessage, changelists, m_keepchangelist,
\r
1919 m_depth, m_options & ProgOptKeeplocks))
\r
1922 error = GetLastErrorMessage();
\r
1923 // if a non-recursive commit failed with SVN_ERR_UNSUPPORTED_FEATURE,
\r
1924 // that means a folder deletion couldn't be committed.
\r
1925 if ((m_Revision != 0)&&(Err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE))
\r
1927 ReportError(CString(MAKEINTRESOURCE(IDS_PROGRS_NONRECURSIVEHINT)));
\r
1929 commitSuccessful = false;
\r
1932 if (!PostCommitErr.IsEmpty())
\r
1934 ReportWarning(PostCommitErr);
\r
1936 if (commitSuccessful)
\r
1938 if (m_BugTraqProvider)
\r
1940 CComPtr<IBugTraqProvider2> pProvider = NULL;
\r
1941 HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider);
\r
1942 if (SUCCEEDED(hr))
\r
1944 BSTR commonRoot = SysAllocString(m_targetPathList.GetCommonRoot().GetDirectory().GetWinPath());
\r
1945 SAFEARRAY *pathList = SafeArrayCreateVector(VT_BSTR, 0, m_targetPathList.GetCount());
\r
1947 for (LONG index = 0; index < m_targetPathList.GetCount(); ++index)
\r
1948 SafeArrayPutElement(pathList, &index, m_targetPathList[index].GetSVNPathString().AllocSysString());
\r
1950 BSTR logMessage = m_sMessage.AllocSysString();
\r
1953 if (FAILED(hr = pProvider->OnCommitFinished(GetSafeHwnd(),
\r
1957 (LONG)m_RevisionEnd,
\r
1960 CString sErr = temp;
\r
1961 if (!sErr.IsEmpty())
\r
1962 ReportError(temp);
\r
1965 SysFreeString(temp);
\r
1969 if (CHooks::Instance().PostCommit(m_selectedPaths, m_depth, m_RevisionEnd, m_sMessage, exitcode, error))
\r
1974 temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
\r
1975 ReportError(temp);
\r
1983 bool CGitProgressDlg::CmdCopy(CString& sWindowTitle, bool& /*localoperation*/)
\r
1986 ASSERT(m_targetPathList.GetCount() == 1);
\r
1987 sWindowTitle.LoadString(IDS_PROGRS_TITLE_COPY);
\r
1988 SetWindowText(sWindowTitle);
\r
1989 SetBackgroundImage(IDI_COPY_BKG);
\r
1992 sCmdInfo.Format(IDS_PROGRS_CMD_COPY,
\r
1993 m_targetPathList[0].IsUrl() ? (LPCTSTR)m_targetPathList[0].GetSVNPathString() : m_targetPathList[0].GetWinPath(),
\r
1994 (LPCTSTR)m_url.GetSVNPathString(), (LPCTSTR)m_Revision.ToString());
\r
1995 ReportCmd(sCmdInfo);
\r
1997 if (!Copy(m_targetPathList, m_url, m_Revision, m_pegRev, m_sMessage))
\r
2002 if (m_options & ProgOptSwitchAfterCopy)
\r
2004 sCmdInfo.Format(IDS_PROGRS_CMD_SWITCH,
\r
2005 m_targetPathList[0].GetWinPath(),
\r
2006 (LPCTSTR)m_url.GetSVNPathString(), (LPCTSTR)m_Revision.ToString());
\r
2007 ReportCmd(sCmdInfo);
\r
2008 if (!Switch(m_targetPathList[0], m_url, SVNRev::REV_HEAD, SVNRev::REV_HEAD, m_depth, TRUE, m_options & ProgOptIgnoreExternals))
\r
2010 if (!Switch(m_targetPathList[0], m_url, SVNRev::REV_HEAD, m_Revision, m_depth, TRUE, m_options & ProgOptIgnoreExternals))
\r
2019 if (SVN::PathIsURL(m_url))
\r
2021 CString sMsg(MAKEINTRESOURCE(IDS_PROGRS_COPY_WARNING));
\r
2022 ReportNotification(sMsg);
\r
2029 bool CGitProgressDlg::CmdExport(CString& sWindowTitle, bool& /*localoperation*/)
\r
2032 ASSERT(m_targetPathList.GetCount() == 1);
\r
2033 sWindowTitle.LoadString(IDS_PROGRS_TITLE_EXPORT);
\r
2034 sWindowTitle = m_url.GetUIFileOrDirectoryName()+_T(" - ")+sWindowTitle;
\r
2035 SetWindowText(sWindowTitle);
\r
2036 SetBackgroundImage(IDI_EXPORT_BKG);
\r
2038 if (m_options & ProgOptEolCRLF)
\r
2040 if (m_options & ProgOptEolLF)
\r
2042 if (m_options & ProgOptEolCR)
\r
2044 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_EXPORT)));
\r
2045 if (!Export(m_url, m_targetPathList[0], m_Revision, m_Revision, TRUE, m_options & ProgOptIgnoreExternals, m_depth, NULL, FALSE, eol))
\r
2054 bool CGitProgressDlg::CmdImport(CString& sWindowTitle, bool& /*localoperation*/)
\r
2057 ASSERT(m_targetPathList.GetCount() == 1);
\r
2058 sWindowTitle.LoadString(IDS_PROGRS_TITLE_IMPORT);
\r
2059 sWindowTitle = m_targetPathList[0].GetUIFileOrDirectoryName()+_T(" - ")+sWindowTitle;
\r
2060 SetWindowText(sWindowTitle);
\r
2061 SetBackgroundImage(IDI_IMPORT_BKG);
\r
2063 sCmdInfo.Format(IDS_PROGRS_CMD_IMPORT,
\r
2064 m_targetPathList[0].GetWinPath(), (LPCTSTR)m_url.GetSVNPathString(),
\r
2065 m_options & ProgOptIncludeIgnored ? (LPCTSTR)(_T(", ") + sIgnoredIncluded) : _T(""));
\r
2066 ReportCmd(sCmdInfo);
\r
2067 if (!Import(m_targetPathList[0], m_url, m_sMessage, &m_ProjectProperties, svn_depth_infinity, m_options & ProgOptIncludeIgnored ? true : false, false))
\r
2076 bool CGitProgressDlg::CmdLock(CString& sWindowTitle, bool& /*localoperation*/)
\r
2079 sWindowTitle.LoadString(IDS_PROGRS_TITLE_LOCK);
\r
2080 SetWindowText(sWindowTitle);
\r
2081 SetBackgroundImage(IDI_LOCK_BKG);
\r
2082 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_LOCK)));
\r
2083 if (!Lock(m_targetPathList, m_options & ProgOptLockForce, m_sMessage))
\r
2088 CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList);
\r
2089 if (m_bLockWarning)
\r
2091 // the lock failed, because the file was outdated.
\r
2092 // ask the user whether to update the file and try again
\r
2093 if (CMessageBox::Show(m_hWnd, IDS_WARN_LOCKOUTDATED, IDS_APPNAME, MB_ICONQUESTION|MB_YESNO)==IDYES)
\r
2095 ReportString(CString(MAKEINTRESOURCE(IDS_SVNPROGRESS_UPDATEANDRETRY)), CString(MAKEINTRESOURCE(IDS_WARN_NOTE)));
\r
2096 if (!Update(m_targetPathList, SVNRev::REV_HEAD, svn_depth_files, false, true))
\r
2101 if (!Lock(m_targetPathList, m_options & ProgOptLockForce, m_sMessage))
\r
2108 if (m_bLockExists)
\r
2110 // the locking failed because there already is a lock.
\r
2111 // if the locking-dialog is skipped in the settings, tell the
\r
2112 // user how to steal the lock anyway (i.e., how to get the lock
\r
2113 // dialog back without changing the settings)
\r
2114 if (!DWORD(CRegDWORD(_T("Software\\TortoiseGit\\ShowLockDlg"), TRUE)))
\r
2116 ReportString(CString(MAKEINTRESOURCE(IDS_SVNPROGRESS_LOCKHINT)), CString(MAKEINTRESOURCE(IDS_WARN_NOTE)));
\r
2124 bool CGitProgressDlg::CmdMerge(CString& sWindowTitle, bool& /*localoperation*/)
\r
2127 bool bFailed = false;
\r
2128 ASSERT(m_targetPathList.GetCount() == 1);
\r
2129 sWindowTitle.LoadString(IDS_PROGRS_TITLE_MERGE);
\r
2130 SetBackgroundImage(IDI_MERGE_BKG);
\r
2131 if (m_options & ProgOptDryRun)
\r
2133 sWindowTitle += _T(" ") + sDryRun;
\r
2135 if (m_options & ProgOptRecordOnly)
\r
2137 sWindowTitle += _T(" ") + sRecordOnly;
\r
2139 SetWindowText(sWindowTitle);
\r
2141 GetDlgItem(IDC_INFOTEXT)->ShowWindow(SW_HIDE);
\r
2142 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_SHOW);
\r
2143 CRegDWORD nonint = CRegDWORD(_T("Software\\TortoiseGit\\MergeNonInteractive"), FALSE);
\r
2144 if (DWORD(nonint))
\r
2146 ::SendMessage(GetDlgItem(IDC_NONINTERACTIVE)->GetSafeHwnd(), BM_SETCHECK, BST_CHECKED, 0);
\r
2147 m_AlwaysConflicted = true;
\r
2149 // we only accept a revision list to merge for peg merges
\r
2150 ATLASSERT((m_revisionArray.GetCount()==0) || (m_revisionArray.GetCount() && (m_url.IsEquivalentTo(m_url2))));
\r
2152 if (m_url.IsEquivalentTo(m_url2))
\r
2154 CString sSuggestedMessage;
\r
2155 CString sMergedLogMessage;
\r
2156 CString sSeparator = CRegString(_T("Software\\TortoiseGit\\MergeLogSeparator"), _T("........"));
\r
2159 // Merging revisions %s of %s to %s into %s, %s%s
\r
2161 sCmdInfo.Format(IDS_PROGRS_CMD_MERGEPEG,
\r
2162 (LPCTSTR)m_revisionArray.ToListString(),
\r
2163 (LPCTSTR)m_url.GetSVNPathString(),
\r
2164 m_targetPathList[0].GetWinPath(),
\r
2165 m_options & ProgOptIgnoreAncestry ? (LPCTSTR)sIgnoreAncestry : (LPCTSTR)sRespectAncestry,
\r
2166 m_options & ProgOptDryRun ? ((LPCTSTR)_T(", ") + sDryRun) : _T(""));
\r
2167 ReportCmd(sCmdInfo);
\r
2169 if (!PegMerge(m_url, m_revisionArray,
\r
2170 m_pegRev.IsValid() ? m_pegRev : (m_url.IsUrl() ? SVNRev::REV_HEAD : SVNRev(SVNRev::REV_WC)),
\r
2171 m_targetPathList[0], true, m_depth, m_diffoptions, !!(m_options & ProgOptIgnoreAncestry), !!(m_options & ProgOptDryRun), !!(m_options & ProgOptRecordOnly)))
\r
2173 // if the merge fails with the peg revision set,
\r
2174 // try again with HEAD as the peg revision.
\r
2175 if (!PegMerge(m_url, m_revisionArray, SVNRev::REV_HEAD,
\r
2176 m_targetPathList[0], true, m_depth, m_diffoptions, !!(m_options & ProgOptIgnoreAncestry), !!(m_options & ProgOptDryRun), !!(m_options & ProgOptRecordOnly)))
\r
2186 sCmdInfo.Format(IDS_PROGRS_CMD_MERGEURL,
\r
2187 (LPCTSTR)m_url.GetSVNPathString(), (LPCTSTR)m_Revision.ToString(),
\r
2188 (LPCTSTR)m_url2.GetSVNPathString(), (LPCTSTR)m_RevisionEnd.ToString(),
\r
2189 m_targetPathList[0].GetWinPath(),
\r
2190 m_options & ProgOptIgnoreAncestry ? (LPCTSTR)sIgnoreAncestry : (LPCTSTR)sRespectAncestry,
\r
2191 m_options & ProgOptDryRun ? ((LPCTSTR)_T(", ") + sDryRun) : _T(""));
\r
2192 ReportCmd(sCmdInfo);
\r
2194 if (!Merge(m_url, m_Revision, m_url2, m_RevisionEnd, m_targetPathList[0],
\r
2195 true, m_depth, m_diffoptions, !!(m_options & ProgOptIgnoreAncestry), !!(m_options & ProgOptDryRun), !!(m_options & ProgOptRecordOnly)))
\r
2201 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_HIDE);
\r
2202 GetDlgItem(IDC_INFOTEXT)->ShowWindow(SW_SHOW);
\r
2208 bool CGitProgressDlg::CmdMergeAll(CString& sWindowTitle, bool& /*localoperation*/)
\r
2211 ASSERT(m_targetPathList.GetCount() == 1);
\r
2212 sWindowTitle.LoadString(IDS_PROGRS_TITLE_MERGE);
\r
2213 SetBackgroundImage(IDI_MERGE_BKG);
\r
2214 SetWindowText(sWindowTitle);
\r
2216 ATLASSERT(m_targetPathList.GetCount() == 1);
\r
2219 sCmdInfo.LoadString(IDS_PROGRS_INFOGETTINGINFO);
\r
2220 ReportCmd(sCmdInfo);
\r
2221 CTGitPathList suggestedSources;
\r
2222 if (!SuggestMergeSources(m_targetPathList[0], m_Revision, suggestedSources))
\r
2228 if (suggestedSources.GetCount() == 0)
\r
2231 sErr.Format(IDS_PROGRS_MERGEALLNOSOURCES, m_targetPathList[0].GetWinPath());
\r
2232 ReportError(sErr);
\r
2235 sCmdInfo.Format(IDS_PROGRS_CMD_MERGEALL,
\r
2236 (LPCTSTR)suggestedSources[0].GetSVNPathString(),
\r
2237 m_targetPathList[0].GetWinPath(),
\r
2238 m_options & ProgOptIgnoreAncestry ? (LPCTSTR)sIgnoreAncestry : (LPCTSTR)sRespectAncestry);
\r
2239 ReportCmd(sCmdInfo);
\r
2241 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_SHOW);
\r
2242 CRegDWORD nonint = CRegDWORD(_T("Software\\TortoiseGit\\MergeNonInteractive"), FALSE);
\r
2243 if (DWORD(nonint))
\r
2245 ::SendMessage(GetDlgItem(IDC_NONINTERACTIVE)->GetSafeHwnd(), BM_SETCHECK, BST_CHECKED, 0);
\r
2246 m_AlwaysConflicted = true;
\r
2249 SVNRevRangeArray revarray;
\r
2250 if (!PegMerge(suggestedSources[0], revarray,
\r
2252 m_targetPathList[0], true, m_depth, m_diffoptions, !!(m_options & ProgOptIgnoreAncestry), FALSE))
\r
2254 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_HIDE);
\r
2259 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_HIDE);
\r
2264 bool CGitProgressDlg::CmdMergeReintegrate(CString& sWindowTitle, bool& /*localoperation*/)
\r
2267 ASSERT(m_targetPathList.GetCount() == 1);
\r
2268 sWindowTitle.LoadString(IDS_PROGRS_TITLE_MERGEREINTEGRATE);
\r
2269 SetBackgroundImage(IDI_MERGE_BKG);
\r
2270 SetWindowText(sWindowTitle);
\r
2273 sCmdInfo.Format(IDS_PROGRS_CMD_MERGEREINTEGRATE,
\r
2274 (LPCTSTR)m_url.GetSVNPathString(),
\r
2275 m_targetPathList[0].GetWinPath());
\r
2276 ReportCmd(sCmdInfo);
\r
2278 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_SHOW);
\r
2279 CRegDWORD nonint = CRegDWORD(_T("Software\\TortoiseGit\\MergeNonInteractive"), FALSE);
\r
2280 if (DWORD(nonint))
\r
2282 ::SendMessage(GetDlgItem(IDC_NONINTERACTIVE)->GetSafeHwnd(), BM_SETCHECK, BST_CHECKED, 0);
\r
2283 m_AlwaysConflicted = true;
\r
2286 if (!MergeReintegrate(m_url, SVNRev::REV_HEAD, m_targetPathList[0], !!(m_options & ProgOptDryRun), m_diffoptions))
\r
2289 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_HIDE);
\r
2293 GetDlgItem(IDC_NONINTERACTIVE)->ShowWindow(SW_HIDE);
\r
2298 bool CGitProgressDlg::CmdRename(CString& sWindowTitle, bool& localoperation)
\r
2301 ASSERT(m_targetPathList.GetCount() == 1);
\r
2302 if ((!m_targetPathList[0].IsUrl())&&(!m_url.IsUrl()))
\r
2303 localoperation = true;
\r
2304 sWindowTitle.LoadString(IDS_PROGRS_TITLE_RENAME);
\r
2305 SetWindowText(sWindowTitle);
\r
2306 SetBackgroundImage(IDI_RENAME_BKG);
\r
2307 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_RENAME)));
\r
2308 if (!Move(m_targetPathList, m_url, m_Revision, m_sMessage))
\r
2317 bool CGitProgressDlg::CmdResolve(CString& sWindowTitle, bool& localoperation)
\r
2320 localoperation = true;
\r
2321 ASSERT(m_targetPathList.GetCount() == 1);
\r
2322 sWindowTitle.LoadString(IDS_PROGRS_TITLE_RESOLVE);
\r
2323 SetWindowText(sWindowTitle);
\r
2324 SetBackgroundImage(IDI_RESOLVE_BKG);
\r
2325 // check if the file may still have conflict markers in it.
\r
2326 BOOL bMarkers = FALSE;
\r
2328 for(int i=0;i<m_targetPathList.GetCount();i++)
\r
2330 CString cmd,out,tempmergefile;
\r
2331 cmd.Format(_T("git.exe add -f \"%s\""),m_targetPathList[i].GetGitPathString());
\r
2332 if(g_Git.Run(cmd,&out,CP_ACP))
\r
2334 CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
\r
2335 m_bErrorsOccurred=true;
\r
2342 tempmergefile = CAppUtils::GetMergeTempFile(_T("LOCAL"),(CTGitPath &)m_targetPathList[i]);
\r
2343 CFile::Remove(tempmergefile);
\r
2350 tempmergefile = CAppUtils::GetMergeTempFile(_T("REMOTE"),(CTGitPath &)m_targetPathList[i]);
\r
2351 CFile::Remove(tempmergefile);
\r
2358 tempmergefile = CAppUtils::GetMergeTempFile(_T("BASE"),(CTGitPath &)m_targetPathList[i]);
\r
2359 CFile::Remove(tempmergefile);
\r
2365 Notify(m_targetPathList[i],git_wc_notify_resolved);
\r
2368 if ((m_options & ProgOptSkipConflictCheck) == 0)
\r
2372 for (INT_PTR fileindex=0; (fileindex<m_targetPathList.GetCount()) && (bMarkers==FALSE); ++fileindex)
\r
2374 if (!m_targetPathList[fileindex].IsDirectory())
\r
2376 CStdioFile file(m_targetPathList[fileindex].GetWinPath(), CFile::typeBinary | CFile::modeRead);
\r
2377 CString strLine = _T("");
\r
2378 while (file.ReadString(strLine))
\r
2380 if (strLine.Find(_T("<<<<<<<"))==0)
\r
2390 catch (CFileException* pE)
\r
2392 TRACE(_T("CFileException in Resolve!\n"));
\r
2393 TCHAR error[10000] = {0};
\r
2394 pE->GetErrorMessage(error, 10000);
\r
2395 ReportError(error);
\r
2402 if (CMessageBox::Show(m_hWnd, IDS_PROGRS_REVERTMARKERS, IDS_APPNAME, MB_YESNO | MB_ICONQUESTION)==IDYES)
\r
2404 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_RESOLVE)));
\r
2405 for (INT_PTR fileindex=0; fileindex<m_targetPathList.GetCount(); ++fileindex)
\r
2406 Resolve(m_targetPathList[fileindex], svn_wc_conflict_choose_merged, true);
\r
2411 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_RESOLVE)));
\r
2412 for (INT_PTR fileindex=0; fileindex<m_targetPathList.GetCount(); ++fileindex)
\r
2413 Resolve(m_targetPathList[fileindex], svn_wc_conflict_choose_merged, true);
\r
2416 CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList);
\r
2421 bool CGitProgressDlg::CmdRevert(CString& sWindowTitle, bool& localoperation)
\r
2424 localoperation = true;
\r
2425 sWindowTitle.LoadString(IDS_PROGRS_TITLE_REVERT);
\r
2426 SetWindowText(sWindowTitle);
\r
2427 SetBackgroundImage(IDI_REVERT_BKG);
\r
2429 CTGitPathList delList = m_selectedPaths;
\r
2430 if (DWORD(CRegDWORD(_T("Software\\TortoiseGit\\RevertWithRecycleBin"), TRUE)))
\r
2431 delList.DeleteAllFiles(true);
\r
2433 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_REVERT)));
\r
2434 if (!Revert(m_targetPathList, CStringArray(), !!(m_options & ProgOptRecursive)))
\r
2439 CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList);
\r
2444 bool CGitProgressDlg::CmdSwitch(CString& sWindowTitle, bool& /*localoperation*/)
\r
2447 ASSERT(m_targetPathList.GetCount() == 1);
\r
2449 sWindowTitle.LoadString(IDS_PROGRS_TITLE_SWITCH);
\r
2450 SetWindowText(sWindowTitle);
\r
2451 SetBackgroundImage(IDI_SWITCH_BKG);
\r
2453 if (st.GetStatus(m_targetPathList[0]) != (-2))
\r
2455 if (st.status->entry != NULL)
\r
2457 rev = st.status->entry->revision;
\r
2462 sCmdInfo.Format(IDS_PROGRS_CMD_SWITCH,
\r
2463 m_targetPathList[0].GetWinPath(), (LPCTSTR)m_url.GetSVNPathString(),
\r
2464 (LPCTSTR)m_Revision.ToString());
\r
2465 ReportCmd(sCmdInfo);
\r
2467 bool depthIsSticky = true;
\r
2468 if (m_depth == svn_depth_unknown)
\r
2469 depthIsSticky = false;
\r
2470 if (!Switch(m_targetPathList[0], m_url, m_Revision, m_Revision, m_depth, depthIsSticky, m_options & ProgOptIgnoreExternals))
\r
2475 m_UpdateStartRevMap[m_targetPathList[0].GetSVNApiPath(pool)] = rev;
\r
2476 if ((m_RevisionEnd >= 0)&&(rev >= 0)
\r
2477 &&((LONG)m_RevisionEnd > (LONG)rev))
\r
2479 GetDlgItem(IDC_LOGBUTTON)->ShowWindow(SW_SHOW);
\r
2485 bool CGitProgressDlg::CmdUnlock(CString& sWindowTitle, bool& /*localoperation*/)
\r
2488 sWindowTitle.LoadString(IDS_PROGRS_TITLE_UNLOCK);
\r
2489 SetWindowText(sWindowTitle);
\r
2490 SetBackgroundImage(IDI_UNLOCK_BKG);
\r
2491 ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_UNLOCK)));
\r
2492 if (!Unlock(m_targetPathList, m_options & ProgOptLockForce))
\r
2497 CShellUpdater::Instance().AddPathsForUpdate(m_targetPathList);
\r
2502 bool CGitProgressDlg::CmdUpdate(CString& sWindowTitle, bool& /*localoperation*/)
\r
2505 sWindowTitle.LoadString(IDS_PROGRS_TITLE_UPDATE);
\r
2506 SetWindowText(sWindowTitle);
\r
2507 SetBackgroundImage(IDI_UPDATE_BKG);
\r
2509 int targetcount = m_targetPathList.GetCount();
\r