From c9dce1933911e4160614d243c59961a4c3bfd075 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 18 Mar 2014 20:05:39 +0100 Subject: [PATCH] RefBrowser: Display tracked branch Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 4 ++++ src/Resources/TortoiseProcENG.rc | 1 + src/TortoiseProc/BrowseRefsDlg.cpp | 11 ++++++++--- src/TortoiseProc/BrowseRefsDlg.h | 4 +++- src/TortoiseProc/resource.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index c978dc2cd..5ffe4675e 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -9226,6 +9226,10 @@ msgstr "" msgid "Tracked Remote Branch:" msgstr "" +#. Resource IDs: (94) +msgid "Tracked branch" +msgstr "" + #. Resource IDs: (357) #, c-format msgid "Transferring at %s" diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index c0bbde92c..48e434509 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -3370,6 +3370,7 @@ BEGIN "Cannot force updating current branch. Use reset command if you want to do so." IDS_REPOBROWSEASKSUBMODULEUPDATE "Commit %s not found in ""%s"". Update submodule now?" + IDS_TRACKEDBRANCH "Tracked branch" IDS_EXPORTFILE_TT "Location where the contents of the\nselected revision of the repository will be saved to." IDS_CHECKOUT_EXPORTDIR "Export directory:" END diff --git a/src/TortoiseProc/BrowseRefsDlg.cpp b/src/TortoiseProc/BrowseRefsDlg.cpp index e760317c6..79ac377aa 100644 --- a/src/TortoiseProc/BrowseRefsDlg.cpp +++ b/src/TortoiseProc/BrowseRefsDlg.cpp @@ -123,6 +123,7 @@ public: switch(m_col) { case CBrowseRefsDlg::eCol_Name: return SortStrCmp(pLeft->GetRefName(), pRight->GetRefName()); + case CBrowseRefsDlg::eCol_Upstream: return SortStrCmp(pLeft->m_csUpstream, pRight->m_csUpstream); case CBrowseRefsDlg::eCol_Date: return pLeft->m_csDate_Iso8601.CompareNoCase(pRight->m_csDate_Iso8601); case CBrowseRefsDlg::eCol_Msg: return SortStrCmp(pLeft->m_csSubject, pRight->m_csSubject); case CBrowseRefsDlg::eCol_LastAuthor: return SortStrCmp(pLeft->m_csAuthor, pRight->m_csAuthor); @@ -261,9 +262,9 @@ BOOL CBrowseRefsDlg::OnInitDialog() AddAnchor(IDHELP, BOTTOM_RIGHT); m_ListRefLeafs.SetExtendedStyle(m_ListRefLeafs.GetExtendedStyle()|LVS_EX_FULLROWSELECT); - static UINT columnNames[] = { IDS_BRANCHNAME, IDS_DATELASTCOMMIT, IDS_LASTCOMMIT, IDS_LASTAUTHOR, IDS_HASH, IDS_DESCRIPTION }; - static int columnWidths[] = { 150, 100, 300, 100, 80, 80 }; - DWORD dwDefaultColumns = (1 << eCol_Name) | (1 << eCol_Date) | (1 << eCol_Msg) | + static UINT columnNames[] = { IDS_BRANCHNAME, IDS_TRACKEDBRANCH, IDS_DATELASTCOMMIT, IDS_LASTCOMMIT, IDS_LASTAUTHOR, IDS_HASH, IDS_DESCRIPTION }; + static int columnWidths[] = { 150, 100, 100, 300, 100, 80, 80 }; + DWORD dwDefaultColumns = (1 << eCol_Name) | (1 << eCol_Upstream ) | (1 << eCol_Date) | (1 << eCol_Msg) | (1 << eCol_LastAuthor) | (1 << eCol_Hash) | (1 << eCol_Description); m_ColumnManager.SetNames(columnNames, _countof(columnNames)); m_ColumnManager.ReadSettings(dwDefaultColumns, 0, _T("BrowseRefs"), _countof(columnNames), columnWidths); @@ -434,6 +435,7 @@ void CBrowseRefsDlg::Refresh(CString selectRef) if (g_Git.Run(L"git.exe for-each-ref --format=" L"%(refname)%04" L"%(objectname)%04" + L"%(upstream)%04" L"%(authordate:relative)%04" L"%(subject)%04" L"%(authorname)%04" @@ -481,6 +483,7 @@ void CBrowseRefsDlg::Refresh(CString selectRef) int valuePos=0; treeLeaf.m_csRefHash= values.Tokenize(L"\04",valuePos); if(valuePos < 0) continue; + treeLeaf.m_csUpstream = values.Tokenize(L"\04", valuePos); if (valuePos < 0) continue; treeLeaf.m_csDate= values.Tokenize(L"\04",valuePos); if(valuePos < 0) continue; treeLeaf.m_csSubject= values.Tokenize(L"\04",valuePos); if(valuePos < 0) continue; treeLeaf.m_csAuthor= values.Tokenize(L"\04",valuePos); if(valuePos < 0) continue; @@ -591,6 +594,7 @@ void CBrowseRefsDlg::FillListCtrlForTreeNode(HTREEITEM treeNode) return; } FillListCtrlForShadowTree(pTree,L"",true); + m_ColumnManager.SetVisible(eCol_Upstream, (wcsncmp(pTree->GetRefName(), L"refs/heads", 11) == 0)); } void CBrowseRefsDlg::FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel) @@ -607,6 +611,7 @@ void CBrowseRefsDlg::FillListCtrlForShadowTree(CShadowTree* pTree, CString refNa m_ListRefLeafs.SetItemData(indexItem,(DWORD_PTR)pTree); m_ListRefLeafs.SetItemText(indexItem,eCol_Name, ref); + m_ListRefLeafs.SetItemText(indexItem, eCol_Upstream, pTree->m_csUpstream); m_ListRefLeafs.SetItemText(indexItem,eCol_Date, pTree->m_csDate); m_ListRefLeafs.SetItemText(indexItem,eCol_Msg, pTree->m_csSubject); m_ListRefLeafs.SetItemText(indexItem,eCol_LastAuthor, pTree->m_csAuthor); diff --git a/src/TortoiseProc/BrowseRefsDlg.h b/src/TortoiseProc/BrowseRefsDlg.h index 38b66466d..c8aa1d5f6 100644 --- a/src/TortoiseProc/BrowseRefsDlg.h +++ b/src/TortoiseProc/BrowseRefsDlg.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2009-2013 - TortoiseGit +// Copyright (C) 2009-2014 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -55,6 +55,7 @@ public: CShadowTree* FindLeaf(CString partialRefName); CString m_csRefName; + CString m_csUpstream; CString m_csRefHash; CString m_csDate; CString m_csDate_Iso8601; @@ -105,6 +106,7 @@ public: enum eCol { eCol_Name, + eCol_Upstream, eCol_Date, eCol_Msg, eCol_LastAuthor, diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index d066f83b0..69a10ec14 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1069,6 +1069,7 @@ #define IDC_REMOTE 1496 #define IDS_REPOBROWSEASKSUBMODULEUPDATE 1496 #define IDC_PACK 1497 +#define IDS_TRACKEDBRANCH 1497 #define IDC_TAGS 1499 #define IDS_EXPORTFILE_TT 1500 #define IDC_BRANCH_GROUP 1500 -- 2.11.4.GIT