diff --git a/GitFlow.VS.Extension/GitFlow.VS.Extension.csproj b/GitFlow.VS.Extension/GitFlow.VS.Extension.csproj index cbc60d1..44805e2 100644 --- a/GitFlow.VS.Extension/GitFlow.VS.Extension.csproj +++ b/GitFlow.VS.Extension/GitFlow.VS.Extension.csproj @@ -444,6 +444,7 @@ Always true + Designer diff --git a/GitFlow.VS.Extension/Resources/upstreambranch.png b/GitFlow.VS.Extension/Resources/upstreambranch.png new file mode 100644 index 0000000..4f86884 Binary files /dev/null and b/GitFlow.VS.Extension/Resources/upstreambranch.png differ diff --git a/GitFlow.VS.Extension/UI/FeaturesUI.xaml b/GitFlow.VS.Extension/UI/FeaturesUI.xaml index 3e332c1..246285c 100644 --- a/GitFlow.VS.Extension/UI/FeaturesUI.xaml +++ b/GitFlow.VS.Extension/UI/FeaturesUI.xaml @@ -22,11 +22,8 @@ - + + + + + + + + @@ -56,8 +60,8 @@ - - + + diff --git a/GitFlow.VS.Extension/UI/FeaturesUI.xaml.cs b/GitFlow.VS.Extension/UI/FeaturesUI.xaml.cs index a592e38..2aa40ef 100644 --- a/GitFlow.VS.Extension/UI/FeaturesUI.xaml.cs +++ b/GitFlow.VS.Extension/UI/FeaturesUI.xaml.cs @@ -14,17 +14,6 @@ public FeaturesUI(FeaturesViewModel model) { InitializeComponent(); DataContext = model; - - FeaturesGrid.Loaded += FeaturesGridOnLoaded; - } - - private void FeaturesGridOnLoaded(object sender, RoutedEventArgs routedEventArgs) - { - foreach (var column in FeaturesGrid.Columns) - { - column.MinWidth = column.ActualWidth; - column.Width = new DataGridLength(1, DataGridLengthUnitType.Star); - } } private void FeaturesGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) diff --git a/GitFlow.VS.Extension/ViewModels/FeaturesViewModel.cs b/GitFlow.VS.Extension/ViewModels/FeaturesViewModel.cs index 185bd29..58e85a8 100644 --- a/GitFlow.VS.Extension/ViewModels/FeaturesViewModel.cs +++ b/GitFlow.VS.Extension/ViewModels/FeaturesViewModel.cs @@ -44,7 +44,7 @@ public bool CanCheckoutFeatureBranch { get { - return SelectedFeature != null && !SelectedFeature.IsCurrentBranch; + return SelectedFeature != null && !SelectedFeature.IsCurrentBranch && !SelectedFeature.IsRemote; } } diff --git a/GitFlow.VS/BranchItem.cs b/GitFlow.VS/BranchItem.cs index 598914d..2c0c117 100644 --- a/GitFlow.VS/BranchItem.cs +++ b/GitFlow.VS/BranchItem.cs @@ -1,4 +1,5 @@ using System; +using System.Windows; namespace GitFlow.VS { @@ -25,6 +26,16 @@ public string LastCommitAsString } } + public Visibility IsRemoteBranchVisibility + { + get + { + if (IsRemote) + return Visibility.Visible; + return Visibility.Hidden; + } + } + public string ToolTip { get { return "Commit: " + CommitId + "\nAuthor: " + Author + "\nDate: " + LastCommit.Date.ToShortDateString() + "\n\n" + Message; } diff --git a/GitFlow.VS/GitFlow.VS.csproj b/GitFlow.VS/GitFlow.VS.csproj index afb6ee3..4a3a9a8 100644 --- a/GitFlow.VS/GitFlow.VS.csproj +++ b/GitFlow.VS/GitFlow.VS.csproj @@ -61,6 +61,7 @@ ..\packages\LibGit2Sharp.0.20.1.0\lib\net40\LibGit2Sharp.dll + diff --git a/GitFlow.VS/GitFlowWrapper.cs b/GitFlow.VS/GitFlowWrapper.cs index d4721e1..59dffc5 100644 --- a/GitFlow.VS/GitFlowWrapper.cs +++ b/GitFlow.VS/GitFlowWrapper.cs @@ -122,12 +122,12 @@ public IEnumerable AllFeatureBranches using (var repo = new Repository(repoDirectory)) { var prefix = repo.Config.Get("gitflow.prefix.feature").Value; - return - repo.Branches.Where(b => (!b.IsRemote && b.Name.StartsWith(prefix)) /*|| (b.IsRemote && b.Name.Contains(prefix))*/) + var featureBranches = + repo.Branches.Where(b => !b.IsRemote && b.Name.StartsWith(prefix) ) .Select(c => new BranchItem { Author = c.Tip.Author.Name, - Name = c.IsRemote ? c.Name : c.Name.Replace(prefix,""), + Name = c.Name.Replace(prefix,""), LastCommit = c.Tip.Author.When, IsTracking = c.IsTracking, IsCurrentBranch = c.IsCurrentRepositoryHead, @@ -135,6 +135,24 @@ public IEnumerable AllFeatureBranches CommitId = c.Tip.Id.ToString(), Message = c.Tip.MessageShort }).ToList(); + + var remoteFeatureBranches = + repo.Branches.Where(b => b.IsRemote && b.Name.Contains(prefix) + && !repo.Branches.Any(br => !br.IsRemote && br.IsTracking && br.TrackedBranch.CanonicalName== b.CanonicalName)) + .Select(c => new BranchItem + { + Author = c.Tip.Author.Name, + Name = c.Name, + LastCommit = c.Tip.Author.When, + IsTracking = c.IsTracking, + IsCurrentBranch = c.IsCurrentRepositoryHead, + IsRemote = c.IsRemote, + CommitId = c.Tip.Id.ToString(), + Message = c.Tip.MessageShort + }).ToList(); + + featureBranches.AddRange(remoteFeatureBranches); + return featureBranches; } } @@ -148,6 +166,10 @@ public GitFlowCommandResult PublishFeature(string featureName) private string TrimBranchName(string branchName) { + if( branchName.LastIndexOf('/') >= 0) + { + branchName = branchName.Substring(branchName.LastIndexOf('/')+1); + } return branchName.Trim().Replace(" ", "_"); }