diff options
author | nfnty <git@nfnty.se> | 2015-10-28 04:29:47 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:04 +0100 |
commit | 5b14517afec332127610a087f0717f7f96b96b37 (patch) | |
tree | cb82e139a0db41694ccd92f2c01608a7cb0be6b3 | |
parent | 87e473e0921f05b5e66f84d5bdc9e810a65218cc (diff) | |
download | ranger-5b14517afec332127610a087f0717f7f96b96b37.tar.gz |
VCS: Fix python2 compatibility
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | ranger/ext/vcs/bzr.py | 6 | ||||
-rw-r--r-- | ranger/ext/vcs/git.py | 6 | ||||
-rw-r--r-- | ranger/ext/vcs/hg.py | 6 | ||||
-rw-r--r-- | ranger/ext/vcs/svn.py | 9 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 39 |
6 files changed, 24 insertions, 44 deletions
diff --git a/AUTHORS b/AUTHORS index ec17affb..d3789119 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,6 +21,8 @@ Copyright 2015 Delisa Mason <iskanamagus@gmail.com> Copyright 2015 No Suck <admin@nosuck.org> Copyright 2015 Randy Nance <randynobx@gmail.com> Copyright 2015 Wojciech Siewierski <wojciech.siewierski@onet.pl> +Copyright 2015 Ryan Burns <rdburns@gmail.com> +Copyright 2015 nfnty <git@nfnty.se> Ideally, all contributors of non-trivial code are named here to the extent that a name and e-mail address is available. Please write a mail to hut@hut.pm if diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py index 8e9f44d3..7b870d7d 100644 --- a/ranger/ext/vcs/bzr.py +++ b/ranger/ext/vcs/bzr.py @@ -1,8 +1,4 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. -# Author: Abdó Roig-Maranges <abdo.roig@gmail.com>, 2012 -# -# vcs - a python module to handle various version control systems +"""GNU Bazaar module""" import os import re diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index b7c51fa6..ab971423 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -1,8 +1,4 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. -# Author: Abdó Roig-Maranges <abdo.roig@gmail.com>, 2011-2012 -# -# vcs - a python module to handle various version control systems +"""Git module""" import os import re diff --git a/ranger/ext/vcs/hg.py b/ranger/ext/vcs/hg.py index 77587408..48e991bf 100644 --- a/ranger/ext/vcs/hg.py +++ b/ranger/ext/vcs/hg.py @@ -1,8 +1,4 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. -# Author: Abdó Roig-Maranges <abdo.roig@gmail.com>, 2011-2012 -# -# vcs - a python module to handle various version control systems +"""Mercurial module""" import os import re diff --git a/ranger/ext/vcs/svn.py b/ranger/ext/vcs/svn.py index 9868b5fd..f7e4bbf4 100644 --- a/ranger/ext/vcs/svn.py +++ b/ranger/ext/vcs/svn.py @@ -1,11 +1,4 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. -# Author: Abdó Roig-Maranges <abdo.roig@gmail.com>, 2011-2012 -# Ryan Burns <rdburns@gmail.com>, 2015 -# -# R. Burns start with Abdó's Hg module and modified it for Subversion. -# -# vcs - a python module to handle various version control systems +"""Subversion module""" from __future__ import with_statement import os diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index a6d12db7..2ea2773e 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -1,9 +1,4 @@ -# This file is part of ranger, the console file manager. -# License: GNU GPL version 3, see the file "AUTHORS" for details. -# Author: Abdó Roig-Maranges <abdo.roig@gmail.com>, 2011-2012 -# -# vcs - a python module to handle various version control systems -"""Vcs module""" +"""VCS module""" import os import subprocess @@ -14,22 +9,23 @@ class VcsError(Exception): pass class Vcs(object): - """ This class represents a version controlled path, abstracting the usual - operations from the different supported backends. + """ + This class represents a version controlled path, abstracting the usual + operations from the different supported backends. - The backends are declared in te variable self.repo_types, and are derived - classes from Vcs with the following restrictions: + The backends are declared in te variable self.repo_types, and are derived + classes from Vcs with the following restrictions: - * do NOT implement __init__. Vcs takes care of this. + * do NOT implement __init__. Vcs takes care of this. - * do not create change internal state. All internal state should be - handled in Vcs + * do not create change internal state. All internal state should be + handled in Vcs - Objects from backend classes should never be created directly. Instead - create objects of Vcs class. The initialization calls update, which takes - care of detecting the right Vcs backend to use and dynamically changes the - object type accordingly. - """ + Objects from backend classes should never be created directly. Instead + create objects of Vcs class. The initialization calls update, which takes + care of detecting the right Vcs backend to use and dynamically changes the + object type accordingly. + """ # These are abstracted revs, representing the current index (staged files), # the current head and nothing. Every backend should redefine them if the @@ -206,7 +202,7 @@ class Vcs(object): fileobj.vcspathstatus = wroot_obj.vcs.get_status_subpath(fileobj.path) # Remove dead directories - for wdir in wdirs.copy(): + for wdir in list(wdirs): try: wdir_obj = self.obj.fm.directories[os.path.join(wroot, wdir)] except KeyError: @@ -218,7 +214,7 @@ class Vcs(object): def update_tree(self, purge=False): """Update tree""" self._update_walk(self.root, purge) - for path in self.rootvcs.links.copy(): + for path in list(self.rootvcs.links): self._update_walk(path, purge) try: dirobj = self.obj.fm.directories[path] @@ -355,7 +351,8 @@ class Vcs(object): class VcsThread(threading.Thread): """Vcs thread""" def __init__(self, ui, idle_delay): - super(VcsThread, self).__init__(daemon=True) + super(VcsThread, self).__init__() + self.daemon = True self.ui = ui self.delay = idle_delay / 1000 self.wake = threading.Event() |