Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Tortoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NotFoundError(Exception):


file_status_cache = {}

plugin_dir = os.path.dirname(os.path.realpath(__file__))

class TortoiseCommand():
def get_path(self, paths):
Expand Down Expand Up @@ -60,7 +60,7 @@ def handles_not_found(fn):
def handler(self, *args, **kwargs):
try:
fn(self, *args, **kwargs)
except (NotFoundError) as (exception):
except NotFoundError as exception:
sublime.error_message('Tortoise: ' + str(exception))
return handler

Expand Down Expand Up @@ -337,15 +337,15 @@ def process_status(self, vcs, path):
if path in file_status_cache and file_status_cache[path]['time'] > \
time.time() - settings.get('cache_length'):
if settings.get('debug'):
print 'Fetching cached status for %s' % path
print('Fetching cached status for %s' % path)
return file_status_cache[path]['status']

if settings.get('debug'):
start_time = time.time()

try:
status = vcs.check_status(path)
except (Exception) as (exception):
except Exception as exception:
sublime.error_message(str(exception))

file_status_cache[path] = {
Expand All @@ -354,8 +354,8 @@ def process_status(self, vcs, path):
}

if settings.get('debug'):
print 'Fetching status for %s in %s seconds' % (path,
str(time.time() - start_time))
print('Fetching status for %s in %s seconds' % (path,
str(time.time() - start_time)))

return status

Expand Down Expand Up @@ -525,19 +525,22 @@ def run(self):
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo, cwd=self.cwd)

return proc.stdout.read().replace('\r\n', '\n').rstrip(' \n\r')
return str(proc.stdout.read()).replace('\r\n', '\n').rstrip(' \n\r')


class SVN():
def __init__(self, root_dir):
self.root_dir = root_dir

def check_status(self, path):
svn_path = os.path.join(sublime.packages_path(), __name__, 'svn',
'svn.exe')
settings = sublime.load_settings('Tortoise.sublime-settings')
svn_path = settings.get('svn_path', os.path.join(plugin_dir, 'svn', 'svn.exe'))

proc = NonInteractiveProcess([svn_path, 'status', path],
cwd=self.root_dir)

result = proc.run().split('\n')

for line in result:
if len(line) < 1:
continue
Expand Down
5 changes: 4 additions & 1 deletion Tortoise.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
// The path to the TortoiseSVN TortoiseProc.exe executable
//"svn_tortoiseproc_path": "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe",
// "svn_tortoiseproc_path": "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe",

// The path to the svn.exe executable. By default, svn.exe provided with sublime_tortoise is used.
// "svn_path": "",

// The path to the TortoiseGit TortoiseProc.exe executable
//"git_tortoiseproc_path": "C:\\Program Files\\TortoiseGit\\bin\\TortoiseProc.exe",
Expand Down