Skip to content

Commit a6974bc

Browse files
authored
Standardize code style (#64)
* Standardize code style Used AppS.CodeTidy with the new tab setting set to 4 spaces. * Remove comments with Python for things we implemented in ObjectScript Leaves in comments for things we didn't implement (particularly around serving as a git remote)
1 parent ebe0863 commit a6974bc

File tree

13 files changed

+779
-826
lines changed

13 files changed

+779
-826
lines changed

cls/SourceControl/Git/API.cls

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Class SourceControl.Git.API
55
ClassMethod Configure()
66
{
77
set sc = $$$OK
8-
set initTLevel = $TLevel
8+
set initTLevel = $tlevel
99
try {
10-
TSTART
10+
tstart
1111
$$$ThrowOnError(##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension"))
1212
write !,"Configured SourceControl.Git.Extension as source control class for namespace ",$namespace
1313
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
14-
if '$Data(@mappingsNode) {
14+
if '$data(@mappingsNode) {
1515
set @mappingsNode@("CLS","*")="cls/"
1616
set @mappingsNode@("CLS","UnitTest")="test/"
1717
set @mappingsNode@("INC","*")="inc/"
@@ -29,13 +29,13 @@ ClassMethod Configure()
2929
write !,"Cancelled."
3030
quit
3131
}
32-
TCOMMIT
32+
tcommit
3333
} catch e {
3434
set sc = e.AsStatus()
35-
write !,$System.Status.GetErrorText(sc)
35+
write !,$system.Status.GetErrorText(sc)
3636
}
37-
while $TLevel > initTLevel {
38-
TROLLBACK 1
37+
while $tlevel > initTLevel {
38+
trollback 1
3939
}
4040
}
4141

cls/SourceControl/Git/Change.cls

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,61 +30,62 @@ Storage Default
3030
/// </ul>
3131
ClassMethod RemoveUncommitted(FileList, Display = 1, Revert = 0, ActiveCommit = 1, CommitCCR) As %Status
3232
{
33-
If '$DATA(FileList) Quit $$$ERROR($$$GeneralError,"No filenames were passed")
34-
Set filename=FileList,SCs=$$$OK
35-
If $DATA(FileList)>1 Set filename=$ORDER(FileList(""))
36-
While (filename'="") {
37-
If Display Write !,filename_" removed from uncommitted list"
38-
If '..IsUncommitted(filename) Set filename=$ORDER(FileList(filename)) continue
39-
Set obj=..OpenUncommitted(filename)
40-
If (obj.Source="trakcare")&&($D(^SYS("ChangeControlClass"))) {
41-
Set changeSourceClass=^SYS("ChangeControlClass")
42-
} Else {
43-
Set changeSourceClass=##class(%Studio.SourceControl.Interface).SourceControlClassGet()
44-
}
45-
If ('$G(^SYS("SourceControl","ChangeConfig","KeepHistory")))||(Revert) {
46-
Set sc=..%DeleteId(obj.%Id())
47-
} Else {
48-
If $G(CommitCCR)'="" Set obj.CCR=CommitCCR
49-
Set obj.P4Issued=$zdt($H,3)
50-
Set obj.Committed=1
51-
Set obj.ActivelyCommitted=ActiveCommit
52-
Set obj.CommittedTime=$zdt($H,3)
53-
Set sc=obj.%Save()
54-
If $$$ISERR(sc) Do $SYSTEM.Status.AppendStatus(SCs, sc) If Display Do $System.Status.DisplayError(sc)
55-
}
56-
Set filename=$ORDER(FileList(filename))
57-
}
58-
Quit SCs
33+
if '$data(FileList) quit $$$ERROR($$$GeneralError,"No filenames were passed")
34+
set filename=FileList,SCs=$$$OK
35+
if $data(FileList)>1 set filename=$order(FileList(""))
36+
while (filename'="") {
37+
if Display write !,filename_" removed from uncommitted list"
38+
if '..IsUncommitted(filename) set filename=$order(FileList(filename)) continue
39+
set obj=..OpenUncommitted(filename)
40+
if (obj.Source="trakcare")&&($data(^SYS("ChangeControlClass"))) {
41+
set changeSourceClass=^SYS("ChangeControlClass")
42+
} else {
43+
set changeSourceClass=##class(%Studio.SourceControl.Interface).SourceControlClassGet()
44+
}
45+
if ('$get(^SYS("SourceControl","ChangeConfig","KeepHistory")))||(Revert) {
46+
set sc=..%DeleteId(obj.%Id())
47+
} else {
48+
if $get(CommitCCR)'="" set obj.CCR=CommitCCR
49+
set obj.P4Issued=$zdatetime($h,3)
50+
set obj.Committed=1
51+
set obj.ActivelyCommitted=ActiveCommit
52+
set obj.CommittedTime=$zdatetime($h,3)
53+
set sc=obj.%Save()
54+
if $$$ISERR(sc) do $system.Status.AppendStatus(SCs, sc) if Display do $system.Status.DisplayError(sc)
55+
}
56+
set filename=$order(FileList(filename))
57+
}
58+
quit SCs
5959
}
6060

6161
ClassMethod IsUncommitted(Filename, ByRef ID) As %Boolean
6262
{
63-
&sql(SELECT ID into :ID FROM SourceControl_Git.Change WHERE ItemFile = :Filename AND Committed = '0')
64-
If (SQLCODE=0) {
65-
Quit 1
66-
} Else {
67-
Set ID=""
68-
Quit 0
69-
}
63+
&SQL(SELECT ID INTO :ID FROM SourceControl_Git.Change WHERE ItemFile = :Filename AND Committed = '0')
64+
if (SQLCODE=0) {
65+
quit 1
66+
} else {
67+
set ID=""
68+
quit 0
69+
}
7070
}
7171

7272
/// Goes through Uncommitted queue and removes any items of action 'edit' or 'add' which are ReadOnly or non-existent on the filesystem
7373
ClassMethod RefreshUncommitted(Display = 1, IncludeRevert = 0) As %Status
7474
{
75-
Set sc=..ListUncommitted(.tFileList,IncludeRevert,0)
76-
If $$$ISERR(sc) Quit sc
77-
Set filename="", filename=$ORDER(tFileList(filename),1,action)
78-
While (filename'="") {
79-
Set examine=$Select(action="add":1,action="edit":1,IncludeRevert&&(action="revert"):1,1:0)
80-
If 'examine Set filename=$ORDER(tFileList(filename),1,action) continue
81-
If ('##class(%File).Exists(filename)) {
82-
Set sc=..RemoveUncommitted(filename,Display,0,0)
83-
If $$$ISERR(sc) s filename="" continue
84-
}
85-
Set filename=$ORDER(tFileList(filename),1,action)
86-
}
87-
Quit sc
75+
set sc=..ListUncommitted(.tFileList,IncludeRevert,0)
76+
if $$$ISERR(sc) quit sc
77+
set filename="", filename=$order(tFileList(filename),1,action)
78+
while (filename'="") {
79+
set examine=$select(action="add":1,action="edit":1,IncludeRevert&&(action="revert"):1,1:0)
80+
if 'examine set filename=$order(tFileList(filename),1,action) continue
81+
if ('##class(%File).Exists(filename)) {
82+
set sc=..RemoveUncommitted(filename,Display,0,0)
83+
if $$$ISERR(sc) set filename="" continue
84+
}
85+
set filename=$order(tFileList(filename),1,action)
86+
}
87+
quit sc
8888
}
8989

9090
}
91+

0 commit comments

Comments
 (0)