Skip to content

Commit 0172210

Browse files
committed
(split from main repo) Changed deprecated options for publish type and topic in Gerrit to support newer versions. Issue #6127
1 parent 288bd01 commit 0172210

File tree

2 files changed

+51
-24
lines changed

2 files changed

+51
-24
lines changed

FormGerritPublish.Designer.cs

Lines changed: 30 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FormGerritPublish.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ public partial class FormGerritPublish : FormGerritBase
2121

2222
private readonly TranslationString _selectRemote = new TranslationString("Please select a remote repository");
2323
private readonly TranslationString _selectBranch = new TranslationString("Please enter a branch");
24+
25+
private readonly TranslationString _publishTypeReview = new TranslationString("For Review");
26+
private readonly TranslationString _publishTypeWip = new TranslationString("Work-in-Progress");
27+
private readonly TranslationString _publishTypePrivate = new TranslationString("Private");
2428
#endregion
2529

2630
public FormGerritPublish(IGitUICommands uiCommand)
@@ -30,6 +34,13 @@ public FormGerritPublish(IGitUICommands uiCommand)
3034
InitializeComplete();
3135

3236
Publish.Image = Images.Push;
37+
PublishType.Items.AddRange(new object[]
38+
{
39+
new KeyValuePair<string, string>(_publishTypeReview.Text, ""),
40+
new KeyValuePair<string, string>(_publishTypeWip.Text, "%wip"),
41+
new KeyValuePair<string, string>(_publishTypePrivate.Text, "%private"),
42+
});
43+
PublishType.SelectedIndex = 0;
3344
}
3445

3546
private void PublishClick(object sender, EventArgs e)
@@ -68,17 +79,12 @@ private bool PublishChange(IWin32Window owner)
6879

6980
GerritUtil.StartAgent(owner, Module, _NO_TRANSLATE_Remotes.Text);
7081

71-
string targetRef = PublishDraft.Checked ? "drafts" : "publish";
72-
7382
var pushCommand = UICommands.CreateRemoteCommand();
7483

75-
string targetBranch = "refs/" + targetRef + "/" + branch;
76-
string topic = _NO_TRANSLATE_Topic.Text.Trim();
84+
string targetBranch = "refs/for/" + branch;
7785

78-
if (!string.IsNullOrEmpty(topic))
79-
{
80-
targetBranch += "/" + topic;
81-
}
86+
string publishType = ((KeyValuePair<string, string>)PublishType.SelectedItem).Value;
87+
targetBranch += publishType;
8288

8389
string reviewers = _NO_TRANSLATE_Reviewers.Text.Trim();
8490
if (!string.IsNullOrEmpty(reviewers))
@@ -92,9 +98,16 @@ private bool PublishChange(IWin32Window owner)
9298
}
9399
}
94100

101+
string topic = _NO_TRANSLATE_Topic.Text.Trim();
102+
if (!string.IsNullOrEmpty(topic))
103+
{
104+
targetBranch += "%topic=" + topic;
105+
}
106+
95107
pushCommand.CommandText = PushCmd(
96108
_NO_TRANSLATE_Remotes.Text,
97109
targetBranch);
110+
98111
pushCommand.Remote = _NO_TRANSLATE_Remotes.Text;
99112
pushCommand.Title = _publishCaption.Text;
100113

0 commit comments

Comments
 (0)