5
// Lluis Sanchez Gual <lluis@novell.com>
7
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
using MonoDevelop.Core;
30
using MonoDevelop.Ide;
32
namespace MonoDevelop.VersionControl.Git
34
public partial class MergeDialog : Gtk.Dialog
42
public MergeDialog (GitRepository repo, bool rebasing)
47
this.rebasing = rebasing;
49
store = new TreeStore (typeof(string), typeof(Gdk.Pixbuf), typeof (string), typeof(string));
52
CellRendererPixbuf crp = new CellRendererPixbuf ();
53
TreeViewColumn col = new TreeViewColumn ();
54
col.PackStart (crp, false);
55
col.AddAttribute (crp, "pixbuf", 1);
56
CellRendererText crt = new CellRendererText ();
57
col.PackStart (crt, true);
58
col.AddAttribute (crt, "text", 2);
59
tree.AppendColumn (col);
61
tree.Selection.Changed += HandleTreeSelectionChanged;
64
labelHeader.Text = GettextCatalog.GetString ("Select the branch to which to rebase:");
65
checkStage.Label = GettextCatalog.GetString ("Stash/unstash local changes before/after rebasing");
68
checkStage.Active = true;
73
public string SelectedBranch {
74
get { return currentSel; }
77
public bool StageChanges {
78
get { return checkStage.Active; }
81
void HandleTreeSelectionChanged (object sender, EventArgs e)
84
if (tree.Selection.GetSelected (out it)) {
85
currentSel = (string) store.GetValue (it, 0);
86
currentType = (string) store.GetValue (it, 3);
97
foreach (Branch b in repo.GetBranches ())
98
store.AppendValues (b.Name, ImageService.GetPixbuf ("vc-git-branch"), b.Name, "branch");
100
foreach (string t in repo.GetTags ())
101
store.AppendValues (t, ImageService.GetPixbuf ("vc-git-tag"), t, "tag");
103
foreach (RemoteSource r in repo.GetRemotes ()) {
104
TreeIter it = store.AppendValues (null, ImageService.GetPixbuf ("md-web-search-icon"), r.Name, null);
105
foreach (string b in repo.GetRemoteBranches (r.Name))
106
store.AppendValues (it, r.Name + "/" + b, ImageService.GetPixbuf ("vc-git-branch"), b, "remote");
113
if (currentSel != null) {
114
string cb = repo.GetCurrentBranch ();
117
switch (currentType) {
118
case "branch": txt = GettextCatalog.GetString ("The branch <b>{1}</b> will be rebased to the branch <b>{0}</b>.", currentSel, cb); break;
119
case "tag": txt = GettextCatalog.GetString ("The branch <b>{1}</b> witl be rebased to the tag <b>{0}</b>.", currentSel, cb); break;
120
case "remote": txt = GettextCatalog.GetString ("The branch <b>{1}</b> will be rebased to the remote branch <b>{0}</b>.", currentSel, cb); break;
124
switch (currentType) {
125
case "branch": txt = GettextCatalog.GetString ("The branch <b>{0}</b> will be merged into the branch <b>{1}</b>.", currentSel, cb); break;
126
case "tag": txt = GettextCatalog.GetString ("The tag <b>{0}</b> will be merged into the branch <b>{1}</b>.", currentSel, cb); break;
127
case "remote": txt = GettextCatalog.GetString ("The remote branch <b>{0}</b> will be merged into the branch <b>{1}</b>.", currentSel, cb); break;
130
labelOper.Visible = true;
131
labelOper.Markup = txt;
132
buttonOk.Sensitive = true;
134
labelOper.Visible = false;
135
buttonOk.Sensitive = false;