Permalink
Browse files

Added the possibility to submit the default changelist

  • Loading branch information...
ericmartel committed Jul 4, 2012
1 parent 52787d4 commit b59b9f409ef26547f52e0b0a088f823cc4391fe3
Showing with 31 additions and 15 deletions.
  1. +25 −14 Perforce.py
  2. +2 −1 messages.json
  3. +4 −0 messages/1.0.14.txt
View
@@ -18,6 +18,7 @@
# Eric Martel - first implementation of submit
# Eric Martel - Better handling of P4CONFIG files
# Andrew Butt & Eric Martel - threading of the diff task and selector for the graphical diff application
+# Eric Martel - Added the possibility to Submit the default changelist
import sublime
import sublime_plugin
@@ -38,6 +39,7 @@
# global variable used when calling p4 - it stores the path of the file in the current view, used to determine with P4CONFIG to use
# whenever a view is selected, the variable gets updated
global_folder = ''
+
class PerforceP4CONFIGHandler(sublime_plugin.EventListener):
def on_activated(self, view):
if view.file_name():
@@ -585,9 +587,9 @@ def ConvertFileNameToFileOnDisk(self, in_filename):
def MakeFileListFromChangelist(self, in_changelistline):
files_list = []
-
+ currentuser = GetUserFromClientspec()
# Launch p4 opened to retrieve all files from changelist
- command = ConstructCommand('p4 opened -c ' + in_changelistline[1])
+ command = ConstructCommand('p4 opened -c ' + in_changelistline[1] + ' -u ' + currentuser)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
result, err = p.communicate()
if(not err):
@@ -607,6 +609,7 @@ def MakeFileListFromChangelist(self, in_changelistline):
if(localfile != 0):
file_entry.append(localfile)
files_list.append(file_entry)
+
return files_list
def MakeCheckedOutFileList(self):
@@ -617,7 +620,8 @@ def MakeCheckedOutFileList(self):
return files_list
# Launch p4 changes to retrieve all the pending changelists
- command = ConstructCommand('p4 changes -s pending -u ' + currentuser);
+ command = ConstructCommand('p4 changes -s pending -u ' + currentuser);
+
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
result, err = p.communicate()
@@ -879,17 +883,24 @@ def __init__(self, window):
def MakeChangelistsList(self):
success, rawchangelists = GetPendingChangelists();
- resultchangelists = [];
+ resultchangelists = ['Default'];
- if(success):
+ currentuser = GetUserFromClientspec();
+ command = ConstructCommand('p4 opened -c default -u ' + currentuser)
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
+ result, err = p.communicate()
+ if err:
+ resultchangelists.pop()
+
+ if success:
changelists = rawchangelists.splitlines()
# for each line, extract the change
for changelistline in changelists:
changelistlinesplit = changelistline.split(' ')
- # Insert at two because we receive the changelist in the opposite order and want to keep new and default on top
- resultchangelists.insert(2, "Changelist " + changelistlinesplit[1] + " - " + ' '.join(changelistlinesplit[7:]))
+ # Insert at two because we receive the changelist in the opposite order and want to keep default on top
+ resultchangelists.insert(1, "Changelist " + changelistlinesplit[1] + " - " + ' '.join(changelistlinesplit[7:]))
return resultchangelists
@@ -910,8 +921,12 @@ def on_done(self, picked):
changelist = self.changelists_list[picked]
changelistsections = changelist.split(' ')
+ command = ''
# Check in the selected changelist
- command = ConstructCommand('p4 submit -c ' + changelistsections[1]);
+ if changelistsections[0] != 'Default':
+ command = ConstructCommand('p4 submit -c ' + changelistsections[1]);
+ else:
+ command = ConstructCommand('p4 submit')
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
result, err = p.communicate()
@@ -926,7 +941,6 @@ def run(self):
SubmitThread(self.window).start()
-
class PerforceLogoutCommand(sublime_plugin.WindowCommand):
def run(self):
try:
@@ -994,18 +1008,15 @@ def on_done(self, picked):
changelist = changelistlist[1]
else:
changelist = changelistlist[0]
-
- print changelist
-
-
+
if self.shelve:
cmdString = "shelve -c" + changelist
else:
cmdString = "unshelve -s" + changelist + " -f"
command = ConstructCommand("p4 " + cmdString)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
result, err = p.communicate()
- print result
+
if(err):
WarnUser("usererr " + err.strip())
return -1
View
@@ -10,5 +10,6 @@
"1.0.10": "messages/1.0.10.txt",
"1.0.11": "messages/1.0.11.txt",
"1.0.12": "messages/1.0.12.txt",
- "1.0.13": "messages/1.0.13.txt"
+ "1.0.13": "messages/1.0.13.txt",
+ "1.0.14": "messages/1.0.14.txt"
}
View
@@ -0,0 +1,4 @@
+Perforce integration 1.0.14 Changelog:
+
+Change
+- Added the possibility to submit the Default changelist

0 comments on commit b59b9f4

Please sign in to comment.