From fab868a3c8e4a40fdc7a9fd2bcf9593ae15d8cfc Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 13 Mar 2024 20:20:56 -0700 Subject: [PATCH] push: set the remote branch field when selecting a local branch Keep the behavior of the "Push" dialog closer to the original behavior where selecting the local branch would implicitly push that remote branch to the same-named remote branch. We now clear selections from the remote branch list when a local branch is clicked. But, we also pre-populate the "Remote Branch" field so that it's clear that the selected branch will be pushed to the remote. We can still push a disjoint set of branches by explicitly selecting a remote branch, but that is more of an uncommon operation. Closes: #729 Suggested-by: @pkzc on github.com Signed-off-by: David Aguilar --- cola/widgets/remote.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cola/widgets/remote.py b/cola/widgets/remote.py index e775de3c..064a325d 100644 --- a/cola/widgets/remote.py +++ b/cola/widgets/remote.py @@ -139,7 +139,7 @@ class RemoteActionDialog(standard.Dialog): self.local_label.setText(N_('Local Branch')) self.local_branch = QtWidgets.QLineEdit() - self.local_branch.textChanged.connect(lambda x: self.update_command_display()) + self.local_branch.textChanged.connect(self.local_branch_text_changed) local_branches = self.get_local_branches() qtutils.add_completer(self.local_branch, local_branches) @@ -439,6 +439,13 @@ class RemoteActionDialog(standard.Dialog): commands.append(core.list2cmdline(cmd)) self.command_display.set_output('\n'.join(commands)) + def local_branch_text_changed(self, value): + """Update the remote branch field in response to local branch text edits""" + if self.action == PUSH: + self.remote_branches.clearSelection() + self.set_remote_branch(value) + self.update_command_display() + def set_remote_name(self, remote_name): """Set the remote name""" self.remote_name.setText(remote_name) -- 2.11.4.GIT