//\r
#include "stdafx.h"\r
#include "TortoiseProc.h"\r
+#include "CommonResource.h"\r
#include "..\version.h"\r
#include "MessageBox.h"\r
#include ".\checkforupdatesdlg.h"\r
, m_bShowInfo(FALSE)\r
, m_bVisible(FALSE)\r
{\r
- m_sUpdateDownloadLink = _T("http://tortoisesvn.tigris.org");\r
+ m_sUpdateDownloadLink = _T("http://code.google.com/p/tortoisegit/downloads");\r
+ m_sUpdateChangeLogLink = _T("http://code.google.com/p/tortoisegit/wiki/ReleaseNotes");\r
}\r
\r
CCheckForUpdatesDlg::~CCheckForUpdatesDlg()\r
{\r
CStandAloneDialog::DoDataExchange(pDX);\r
DDX_Control(pDX, IDC_LINK, m_link);\r
+ DDX_Control(pDX, IDC_LINK_CHANGE_LOG, m_ChangeLogLink);\r
}\r
\r
\r
{\r
sCheckURL = checkurlmachine;\r
if (sCheckURL.IsEmpty())\r
- sCheckURL = _T("http://tortoisesvn.tigris.org/version.txt");\r
+ sCheckURL = _T("http://code.google.com/p/tortoisegit/downloads/list");\r
}\r
+ CoInitialize(NULL);\r
HRESULT res = URLDownloadToFile(NULL, sCheckURL, tempfile, 0, NULL);\r
if (res == S_OK)\r
{\r
{\r
CStdioFile file(tempfile, CFile::modeRead | CFile::shareDenyWrite);\r
CString ver;\r
- if (file.ReadString(ver))\r
+ int major,minor,micro,build;\r
+ major=minor=micro=build=0;\r
+ unsigned __int64 version=0;\r
+\r
+ if(file.GetLength()>100)\r
+ {\r
+ while(file.ReadString(ver))\r
+ {\r
+ int start;\r
+ while( (start=ver.Find(_T("TortoiseGit-"))) > 0 )\r
+ {\r
+ ver = ver.Mid(start+CString(_T("TortoiseGit-")).GetLength());\r
+ int x1,x2,x3,x4;\r
+ x1=_ttoi(ver)&0xFFFF;\r
+ ver = ver.Mid(ver.Find('.')+1);\r
+ x2=_ttoi(ver)&0xFFFF;\r
+ ver = ver.Mid(ver.Find('.')+1);\r
+ x3=_ttoi(ver)&0xFFFF;\r
+ ver = ver.Mid(ver.Find('.')+1);\r
+ x4=_ttoi(ver)&0xFFFF;\r
+ \r
+ unsigned __int64 newversion;\r
+ newversion = (x1<<48) + (x2<<32) + (x3<<16)+x4;\r
+ if(newversion>version)\r
+ {\r
+ major=x1;\r
+ minor=x2;\r
+ micro=x3;\r
+ build=x4;\r
+ version = newversion;\r
+ }\r
+ }\r
+ }\r
+\r
+ }else if (file.ReadString(ver))\r
{\r
CString vertemp = ver;\r
- int major = _ttoi(vertemp);\r
+ major = _ttoi(vertemp);\r
vertemp = vertemp.Mid(vertemp.Find('.')+1);\r
- int minor = _ttoi(vertemp);\r
+ minor = _ttoi(vertemp);\r
vertemp = vertemp.Mid(vertemp.Find('.')+1);\r
- int micro = _ttoi(vertemp);\r
+ micro = _ttoi(vertemp);\r
vertemp = vertemp.Mid(vertemp.Find('.')+1);\r
- int build = _ttoi(vertemp);\r
+ build = _ttoi(vertemp);\r
+ version = (major<<48) + (minor<<32) + (micro<<16)+build;\r
+ }\r
+\r
+ {\r
BOOL bNewer = FALSE;\r
if (major > TSVN_VERMAJOR)\r
bNewer = TRUE;\r
else if ((build > TSVN_VERBUILD)&&(micro == TSVN_VERMICRO)&&(minor == TSVN_VERMINOR)&&(major == TSVN_VERMAJOR))\r
bNewer = TRUE;\r
\r
- if (_ttoi(ver)!=0)\r
+ if (version != 0)\r
{\r
+ ver.Format(_T("%d.%d.%d.%d"),major,minor,micro,build);\r
temp.Format(IDS_CHECKNEWER_CURRENTVERSION, (LPCTSTR)ver);\r
SetDlgItemText(IDC_CURRENTVERSION, temp);\r
temp.Format(_T("%d.%d.%d.%d"), TSVN_VERMAJOR, TSVN_VERMINOR, TSVN_VERMICRO, TSVN_VERBUILD);\r
}\r
\r
- if (_ttoi(ver)==0)\r
+ if (version == 0)\r
{\r
temp.LoadString(IDS_CHECKNEWER_NETERROR);\r
SetDlgItemText(IDC_CHECKRESULT, temp);\r
}\r
else\r
{\r
+ // Try to cache web page;\r
+\r
temp.LoadString(IDS_CHECKNEWER_NETERROR);\r
SetDlgItemText(IDC_CHECKRESULT, temp);\r
}\r
m_link.ShowWindow(SW_SHOW);\r
m_link.SetURL(m_sUpdateDownloadLink);\r
}\r
+ if (!m_sUpdateDownloadLink.IsEmpty())\r
+ {\r
+ m_ChangeLogLink.ShowWindow(SW_SHOW);\r
+ m_ChangeLogLink.SetURL(m_sUpdateChangeLogLink);\r
+ }\r
\r
DeleteFile(tempfile);\r
m_bThreadRunning = FALSE;\r
\r
private:\r
CString m_sUpdateDownloadLink; ///< Where to send a user looking to download a update\r
+ CString m_sUpdateChangeLogLink; ///< Where to send a user looking to change log\r
CHyperLink m_link;\r
+ CHyperLink m_ChangeLogLink;\r
};\r
\r
#include "SVNDCommitCommand.h"\r
#include "SVNRebaseCommand.h"\r
#include "SyncCommand.h"\r
+#include "UpdateCheckCommand.h"\r
\r
#if 0\r
\r
\r
#include "UnIgnoreCommand.h"\r
#include "UnLockCommand.h"\r
-#include "UpdateCheckCommand.h"\r
+\r
#include "UpdateCommand.h"\r
#include "UrlDiffCommand.h"\r
#endif\r
return new SVNRebaseCommand;\r
case cmdSync:\r
return new SyncCommand;\r
+ case cmdUpdateCheck:\r
+ return new UpdateCheckCommand;\r
+\r
#if 0\r
\r
\r
return new UnLockCommand;\r
case cmdUpdate:\r
return new UpdateCommand;\r
- case cmdUpdateCheck:\r
- return new UpdateCheckCommand;\r
case cmdUrlDiff:\r
return new UrlDiffCommand;\r
#endif\r
GetModuleFileName(NULL, com, MAX_PATH);\r
_tcscat_s(com, MAX_PATH+100, _T(" /command:updatecheck"));\r
\r
- //CAppUtils::LaunchApplication(com, 0, false);\r
+ CAppUtils::LaunchApplication(com, 0, false);\r
}\r
}\r
}\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\copy.ico"\r
+ RelativePath=".\copy.ico"\r
>\r
</File>\r
<File\r
- RelativePath=".\copy.ico"\r
+ RelativePath="..\Resources\copy.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath=".\explorer.ico"\r
+ RelativePath="..\Resources\explorer.ico"\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\explorer.ico"\r
+ RelativePath=".\explorer.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\newfolder.ico"\r
+ RelativePath=".\newfolder.ico"\r
>\r
</File>\r
<File\r
- RelativePath=".\newfolder.ico"\r
+ RelativePath="..\Resources\newfolder.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\refresh.ico"\r
+ RelativePath=".\refresh.ico"\r
>\r
</File>\r
<File\r
- RelativePath=".\refresh.ico"\r
+ RelativePath="..\Resources\refresh.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath=".\save.ico"\r
+ RelativePath="..\Resources\save.ico"\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\save.ico"\r
+ RelativePath=".\save.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath="..\Resources\up.ico"\r
+ RelativePath=".\up.ico"\r
>\r
</File>\r
<File\r
- RelativePath=".\up.ico"\r
+ RelativePath="..\Resources\up.ico"\r
>\r
</File>\r
<File\r
>\r
</File>\r
</Filter>\r
+ <Filter\r
+ Name="UpdateCheck"\r
+ >\r
+ <File\r
+ RelativePath=".\CheckForUpdatesDlg.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\CheckForUpdatesDlg.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\Commands\UpdateCheckCommand.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\Commands\UpdateCheckCommand.h"\r
+ >\r
+ </File>\r
+ </Filter>\r
</Filter>\r
<Filter\r
Name="Utility Dialogs"\r
#include "StdAfx.h"\r
#include "Registry.h"\r
#include "TempFile.h"\r
+#include "TGitPath.h"\r
\r
CTempFiles::CTempFiles(void)\r
{\r
return instance;\r
}\r
\r
-CTSVNPath CTempFiles::GetTempFilePath(bool bRemoveAtEnd, const CTSVNPath& path /* = CTSVNPath() */, const SVNRev revision /* = SVNRev() */)\r
+CTGitPath CTempFiles::GetTempFilePath(bool bRemoveAtEnd, const CTGitPath& path /* = CTGitPath() */, const GitRev revision /* = GitRev() */)\r
{\r
DWORD len = ::GetTempPath(0, NULL);\r
TCHAR * temppath = new TCHAR[len+1];\r
TCHAR * tempF = new TCHAR[len+50];\r
::GetTempPath (len+1, temppath);\r
- CTSVNPath tempfile;\r
+ CTGitPath tempfile;\r
CString possibletempfile;\r
if (path.IsEmpty())\r
{\r
- ::GetTempFileName (temppath, TEXT("svn"), 0, tempF);\r
- tempfile = CTSVNPath(tempF);\r
+ ::GetTempFileName (temppath, TEXT("git"), 0, tempF);\r
+ tempfile = CTGitPath(tempF);\r
}\r
else\r
{\r
int i=0;\r
do\r
{\r
- if (revision.IsValid())\r
+ if (!revision.m_CommitHash.IsEmpty())\r
{\r
- possibletempfile.Format(_T("%s%s-rev%s.svn%3.3x.tmp%s"), temppath, (LPCTSTR)path.GetFileOrDirectoryName(), (LPCTSTR)revision.ToString(), i, (LPCTSTR)path.GetFileExtension());\r
+ possibletempfile.Format(_T("%s%s-rev%s.git%3.3x.tmp%s"), temppath, (LPCTSTR)path.GetFileOrDirectoryName(), (LPCTSTR)revision.m_CommitHash.Left(7), i, (LPCTSTR)path.GetFileExtension());\r
}\r
else\r
{\r
- possibletempfile.Format(_T("%s%s.svn%3.3x.tmp%s"), temppath, (LPCTSTR)path.GetFileOrDirectoryName(), i, (LPCTSTR)path.GetFileExtension());\r
+ possibletempfile.Format(_T("%s%s.git%3.3x.tmp%s"), temppath, (LPCTSTR)path.GetFileOrDirectoryName(), i, (LPCTSTR)path.GetFileExtension());\r
}\r
tempfile.SetFromWin(possibletempfile);\r
i++;\r
>\r
</File>\r
<File\r
+ RelativePath=".\TempFile.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\TempFile.h"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\UnicodeUtils.cpp"\r
>\r
</File>\r