summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2015-12-20 12:12:55 +0100
committernfnty <git@nfnty.se>2016-02-08 04:43:04 +0100
commit89a97553f9175ba6b007c594eb6f25a9310583cc (patch)
tree4dea491b1be01174832f66281647e2f7beca917b /ranger
parent464986684615c8baf24b1dfb13bc150f10a38746 (diff)
downloadranger-89a97553f9175ba6b007c594eb6f25a9310583cc.tar.gz
VCS: _vcs remove args parameter
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/vcs/bzr.py2
-rw-r--r--ranger/ext/vcs/git.py2
-rw-r--r--ranger/ext/vcs/vcs.py13
3 files changed, 7 insertions, 10 deletions
diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py
index aa7112dc..b06f28ec 100644
--- a/ranger/ext/vcs/bzr.py
+++ b/ranger/ext/vcs/bzr.py
@@ -23,7 +23,7 @@ class Bzr(Vcs):
 
     def _bzr(self, args, path=None, catchout=True, retbytes=False):
         """Run a bzr command"""
-        return self._vcs(path or self.path, 'bzr', args, catchout=catchout, retbytes=retbytes)
+        return self._vcs(['bzr'] + args, path or self.path, catchout=catchout, retbytes=retbytes)
 
     def _remote_url(self):
         """Returns remote url"""
diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py
index 41961795..1741ceff 100644
--- a/ranger/ext/vcs/git.py
+++ b/ranger/ext/vcs/git.py
@@ -29,7 +29,7 @@ class Git(Vcs):
 
     def _git(self, args, path=None, catchout=True, retbytes=False):
         """Run a git command"""
-        return self._vcs(path or self.path, 'git', args, catchout=catchout, retbytes=retbytes)
+        return self._vcs(['git'] + args, path or self.path, catchout=catchout, retbytes=retbytes)
 
     def _head_ref(self):
         """Returns HEAD reference"""
diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py
index ae770699..fbcfc9c4 100644
--- a/ranger/ext/vcs/vcs.py
+++ b/ranger/ext/vcs/vcs.py
@@ -106,21 +106,18 @@ class Vcs(object):
     # Generic
     #---------------------------
 
-    def _vcs(self, path, cmd, args, catchout=True, retbytes=False):
+    def _vcs(self, cmd, path, catchout=True, retbytes=False):
         """Run a VCS command"""
         try:
             if catchout:
-                output = subprocess.check_output([cmd] + args, cwd=path,
+                output = subprocess.check_output(cmd, cwd=path,
                                                  stderr=subprocess.DEVNULL)
                 return output if retbytes else output.decode('UTF-8')
             else:
-                subprocess.check_call([cmd] + args, cwd=path,
+                subprocess.check_call(cmd, cwd=path,
                                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-        except subprocess.CalledProcessError:
-            raise VcsError("{0:s} error on {1:s}. Command: {2:s}"\
-                           .format(cmd, path, ' '.join([cmd] + args)))
-        except FileNotFoundError:
-            raise VcsError("{0:s} error on {1:s}: File not found".format(cmd, path))
+        except (subprocess.CalledProcessError, FileNotFoundError):
+            raise VcsError('{0:s}: {1:s}'.format(str(cmd), path))
 
     def _get_repotype(self, path):
         """Get type for path"""