Skip to content

Commit

Permalink
Merge pull request #15895 from ccordoba12/issue-15458
Browse files Browse the repository at this point in the history
PR: Fix VCS browse and commit functionality (Files)
  • Loading branch information
ccordoba12 committed Jun 17, 2021
2 parents 0d4138a + 489c6d5 commit d59d470
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions spyder/plugins/explorer/widgets/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,7 @@ def update_actions(self):
dirname = ''
basedir = ''

vcs_visible = (only_files and len(fnames) == 1
and vcs.is_vcs_repository(dirname))
vcs_visible = vcs.is_vcs_repository(dirname)

# Make actions visible conditionally
self.move_action.setVisible(
Expand Down Expand Up @@ -1443,9 +1442,17 @@ def check_launch_error_codes(self, return_codes):
def vcs_command(self, action):
"""VCS action (commit, browse)"""
fnames = self.get_selected_filenames()

# Get dirname of selection
if osp.isdir(fnames[0]):
dirname = fnames[0]
else:
dirname = osp.dirname(fnames[0])

# Run action
try:
for path in sorted(fnames):
vcs.run_vcs_tool(path, action)
vcs.run_vcs_tool(dirname, action)
except vcs.ActionToolNotFound as error:
msg = _("For %s support, please install one of the<br/> "
"following tools:<br/><br/> %s")\
Expand Down

0 comments on commit d59d470

Please sign in to comment.