-
Notifications
You must be signed in to change notification settings - Fork 0
/
cvsGitSublime.py
86 lines (50 loc) · 1.9 KB
/
cvsGitSublime.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sublime, sublime_plugin, subprocess, json
class cvsGitSublime(sublime_plugin.TextCommand):
def run(self, edit):
self.options = [];
self.options.append("Status");
self.options.append("Log");
self.options.append("Pull");
window = sublime.active_window()
window.show_quick_panel(self.options, self.menu, sublime.MONOSPACE_FONT);
def menu(self, escolha):
if(escolha == 0):
self.status()
if(escolha == 1):
self.log()
if(escolha == 2):
self.pull()
def status(self):
# output = subprocess.check_output("cd /var/www/dbportal_prj && cvsgit status -j", shell = True)
# output = output.decode('ascii')
output = self.cvsGit("status")
# aDados = json.loads(output);
# saida = ''
# for sTipoModificacao in aDados :
# aModificacoes = aDados[sTipoModificacao]
# if(len(aModificacoes) > 0):
# saida += sTipoModificacao + "\n"
# for oArquivo in aModificacoes :
# saida += oArquivo['sArquivo'] + "\n";
self.abreTerminal(output);
def log(self):
# window = sublime.active_window()
# teste = window.project_file_name();
# print(teste)
# self.abreTerminal(teste);
sPath = self.view.file_name();
output = self.cvsGit("log " + sPath)
self.abreTerminal(output)
def pull(self):
output = self.cvsGit("pull")
self.abreTerminal(output)
def cvsGit(self, sComando):
output = subprocess.check_output("cd /var/www/dbportal_prj && cvsgit " + sComando, shell = True)
output = output.decode('utf8')
return output;
def abreTerminal(self, texto):
self.output_view = self.view.window().get_output_panel("textarea")
window = sublime.active_window()
window.run_command("show_panel", {"panel": "output.textarea"})
self.output_view.set_read_only(False)
self.output_view.run_command("append", {"characters": texto})