This repository has been archived by the owner on Dec 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathclearcase.py
76 lines (56 loc) · 2.64 KB
/
clearcase.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
import os
import sublime
import sublime_plugin
import subprocess
import time
class ClearcaseCommand(sublime_plugin.WindowCommand):
def run(self, cmd):
if len(self.window.active_view().file_name()) > 0:
popen_arg_list = {
"shell": False,
"stdout": subprocess.PIPE,
"stderr": subprocess.PIPE
}
if (sublime.platform() == "windows"):
popen_arg_list["creationflags"] = 0x08000000
subprocess.Popen(cmd, **popen_arg_list)
def is_enabled(self):
return self.window.active_view().file_name() and len(self.window.active_view().file_name()) > 0
class ClearcaseExplorerCommand(ClearcaseCommand):
def run(self):
cmd = ['clearexplorer', os.path.dirname(self.window.active_view().file_name())]
super(ClearcaseExplorerCommand, self).run(cmd)
class ClearcaseCheckoutCommand(ClearcaseCommand):
def run(self):
cmd = ['cleardlg', '/checkout', self.window.active_view().file_name()]
super(ClearcaseCheckoutCommand, self).run(cmd)
class ClearcaseCheckinCommand(ClearcaseCommand):
def run(self):
cmd = ['cleardlg', '/checkin', self.window.active_view().file_name()]
super(ClearcaseCheckinCommand, self).run(cmd)
class ClearcaseVtreeCommand(ClearcaseCommand):
def run(self):
cmd = ['cleartool', 'lsvtree', '-graphical', self.window.active_view().file_name()]
super(ClearcaseVtreeCommand, self).run(cmd)
class ClearcaseHistoryCommand(ClearcaseCommand):
def run(self):
cmd = ['cleartool', 'lshistory', '-graphical', self.window.active_view().file_name()]
super(ClearcaseHistoryCommand, self).run(cmd)
class ClearcasePrevCommand(ClearcaseCommand):
def run(self):
cmd = ['cleartool', 'diff', '-graph', '-pred', self.window.active_view().file_name()]
super(ClearcasePrevCommand, self).run(cmd)
class ClearcaseUncoCommand(ClearcaseCommand):
def run(self):
cmd = ['cleartool', 'unco', self.window.active_view().file_name()]
super(ClearcaseUncoCommand, self).run(cmd)
class ClearcaseAnnotateCommand(ClearcaseCommand):
def run(self):
out = '%s.ann' % self.window.active_view().file_name()
cmd = ['cleartool', 'annotate', '-nco', '-out', out, self.window.active_view().file_name()]
super(ClearcaseAnnotateCommand, self).run(cmd)
while not os.path.exists(out):
time.sleep(1)
while os.path.getsize(out) <= 0:
time.sleep(1)
self.window.open_file(out)