From af3e5448bbf2f1af9091432f739fdcd92f4b4950 Mon Sep 17 00:00:00 2001 From: hongshan Date: Mon, 28 Dec 2015 14:45:48 +0800 Subject: [PATCH 1/3] Update Perforce.py Always say "File is already writable" even the file is not checkouted. --- Perforce.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Perforce.py b/Perforce.py index 174b2e1..e206825 100644 --- a/Perforce.py +++ b/Perforce.py @@ -292,8 +292,8 @@ def IsFileWritable(in_filename): # Checkout section def Checkout(in_filename): - if(IsFileWritable(in_filename)): - return -1, "File is already writable." + # if(IsFileWritable(in_filename)): + # return -1, "File is already writable." folder_name, filename = os.path.split(in_filename) isInDepot = IsFileInDepot(folder_name, filename) From b98e1b1299a1d52061768e13fcbb3fa8524484f1 Mon Sep 17 00:00:00 2001 From: hongshan Date: Mon, 28 Dec 2015 14:55:10 +0800 Subject: [PATCH 2/3] Update Perforce.py Miss part of full path. For example workspace root "d:/wkspace", and workspace name is "work_space_name" , and the project in d:/wkspace/project/file/hello.py, and the map in workspace in p4 is" //project/... //work_space_name/project/... " Then input command "List Checkout Files" in sublime then get path like that "d:/wkspace/file/hello.py" with out string "project". --- Perforce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Perforce.py b/Perforce.py index e206825..319f12c 100644 --- a/Perforce.py +++ b/Perforce.py @@ -649,7 +649,7 @@ def MakeFileListFromChangelist(self, in_changelistline): cleanedfile = line[0:poundindex] # just keep the filename - cleanedfile = '/'.join(cleanedfile.split('/')[3:]) + # cleanedfile = '/'.join(cleanedfile.split('/')[3:]) file_entry = [cleanedfile[cleanedfile.rfind('/')+1:]] file_entry.append("Changelist: " + in_changelistline[1]) From 91a12c3cd299d6575fc248fefcf9b2a0f3bb76b8 Mon Sep 17 00:00:00 2001 From: hongshan Date: Tue, 29 Dec 2015 11:49:46 +0800 Subject: [PATCH 3/3] can checkout when I save I found view.is_dirty() often return true, actually it does not care about if it is dirty I just want checkout when save, even if this file is writable or has been checkout, just checkout again when save. --- Perforce.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Perforce.py b/Perforce.py index 319f12c..cc29275 100644 --- a/Perforce.py +++ b/Perforce.py @@ -330,10 +330,10 @@ def on_pre_save(self, view): if(not perforce_settings.get('perforce_auto_checkout') or not perforce_settings.get('perforce_auto_checkout_on_save')): return - if(view.is_dirty()): - PrepareCommand(); - success, message = Checkout(view.file_name()) - LogResults(success, message); + #if(view.is_dirty()): + PrepareCommand(); + success, message = Checkout(view.file_name()) + LogResults(success, message); class PerforceCheckoutCommand(sublime_plugin.TextCommand): def run(self, edit):