diff options
author | nfnty <git@nfnty.se> | 2015-10-19 22:26:57 +0200 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:04 +0100 |
commit | 431349cb771621fc336902695b724dfd193b924c (patch) | |
tree | 7a58362d218c63195aaa27b90a15c8500d983b91 /ranger | |
parent | c4abb96c41ed3dd9688f32198d2cd2e8a3320b4e (diff) | |
download | ranger-431349cb771621fc336902695b724dfd193b924c.tar.gz |
VCS: Fix class for non-root; fixes action commands
Diffstat (limited to 'ranger')
-rwxr-xr-x | ranger/config/commands.py | 39 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 1 |
2 files changed, 19 insertions, 21 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 9aee9f29..b2c704c7 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1336,18 +1336,16 @@ class stage(Command): def execute(self): from ranger.ext.vcs import VcsError - filelist = [f.path for f in self.fm.thistab.get_selection()] - self.fm.thisdir.vcs_outdated = True -# for f in self.fm.thistab.get_selection(): -# f.vcs_outdated = True - - try: - self.fm.thisdir.vcs.add(filelist) - except VcsError: - self.fm.notify("Could not stage files.") - - self.fm.reload_cwd() + if self.fm.thisdir.vcs and self.fm.thisdir.vcs.track: + filelist = [f.path for f in self.fm.thistab.get_selection()] + try: + self.fm.thisdir.vcs.add(filelist) + except VcsError as error: + self.fm.notify('Unable to unstage files: {0:s}'.format(str(error))) + self.fm.reload_cwd() + else: + self.fm.notify('Unable to stage files: Not in repository') class unstage(Command): """ @@ -1358,17 +1356,16 @@ class unstage(Command): def execute(self): from ranger.ext.vcs import VcsError - filelist = [f.path for f in self.fm.thistab.get_selection()] - self.fm.thisdir.vcs_outdated = True -# for f in self.fm.thistab.get_selection(): -# f.vcs_outdated = True - try: - self.fm.thisdir.vcs.reset(filelist) - except VcsError: - self.fm.notify("Could not unstage files.") - - self.fm.reload_cwd() + if self.fm.thisdir.vcs and self.fm.thisdir.vcs.track: + filelist = [f.path for f in self.fm.thistab.get_selection()] + try: + self.fm.thisdir.vcs.reset(filelist) + except VcsError as error: + self.fm.notify('Unable to unstage files: {0:s}'.format(str(error))) + self.fm.reload_cwd() + else: + self.fm.notify('Unable to unstage files: Not in repository') class diff(Command): diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 9cf84663..5e9f03c1 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -107,6 +107,7 @@ class Vcs(object): self.track = False self.in_repodir = True else: + self.__class__ = self.rootvcs.__class__ self.track = self.rootvcs.track self.in_repodir = False else: |