Skip to content

Commit

Permalink
Remove workaround code + prevent duplicated branches
Browse files Browse the repository at this point in the history
  • Loading branch information
trollodel committed Sep 23, 2020
1 parent 668c773 commit 61e9a13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
15 changes: 0 additions & 15 deletions spyder/plugins/vcs/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,3 @@ def _create_actions(self):
shortcut_context=self.NAME,
triggered=lambda: None,
)

# workarounds when imported as 3rd party plugin
register_plugin = register

DESCRIPTION = get_description(None)

@property
def dockwidget(self):
dockwidget = self.get_widget().dockwidget
if dockwidget is None:
self.is_compatible, _ = self.check_compatibility()
self.get_main().add_dockwidget(self)
dockwidget = self.get_widget().dockwidget

return dockwidget
12 changes: 7 additions & 5 deletions spyder/plugins/vcs/widgets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,26 @@ def refresh(self) -> None:
"""Clear and re-add branches."""
def _task():
"""Task executed in another thread."""
branches = []
if manager.type.branch.fget.enabled:
current_branch = manager.branch
else:
current_branch = None

if manager.type.editable_branches.fget.enabled:
try:
self._branches.extend(manager.editable_branches)
branches.extend(manager.editable_branches)
except VCSPropertyError:
# Suppress editable_branches fail
pass
elif current_branch is not None:
self._branches.append(manager.branch)
return current_branch
branches.append(manager.branch)
return (current_branch, branches)

@Slot(object)
def _handle_result(current_branch):
if self._branches:
def _handle_result(result):
if any(result):
current_branch, self._branches = result
# Block signals to reduce useless signal emissions
oldstate = self.blockSignals(True)

Expand Down

0 comments on commit 61e9a13

Please sign in to comment.