Skip to content

Commit

Permalink
[UPD] Version checking is added. UDL works since version 2015.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
MakarovS96 committed Jul 19, 2017
1 parent cdb5aca commit d39bbbf
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
7 changes: 7 additions & 0 deletions %SourceControl.Git.inc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Routine name="%SourceControl.Git" type="INC"><![CDATA[
#define CacheVer ($system.Version.GetMajor()_"."_$system.Version.GetMinor())
#define WorkInThisVersion ##Expression($$$CacheVer >= 2015.2)
]]></Routine>
</Export>
2 changes: 2 additions & 0 deletions %SourceControl/Git.cls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Export generator="Cache" version="25">
<Class name="%SourceControl.Git">
<Import>%SourceControl.Git</Import>
<IncludeCode>%SourceControl.Git</IncludeCode>
<Super>%Studio.Extension.Base</Super>
<TimeCreated>62655,58027.787011</TimeCreated>

Expand Down Expand Up @@ -93,6 +94,7 @@
set DisplayName = "Open Repo Folder"
}elseif name = "%Sources" {
set DisplayName = "Sources: "_$case(##class(Utils).GetTypeOfSources(), 1:"XML", 0:"UDL", :"")
if '$$$WorkInThisVersion set Enabled = 0
}
elseif ##class(Utils).IsMenuGitCommand(name) && ##class(Utils).GitBinExists() {
set DisplayName = $case(name,"%StashSave":"Stash save",
Expand Down
42 changes: 39 additions & 3 deletions %SourceControl/Git/UDL.cls.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Class name="%SourceControl.Git.UDL">
<IncludeCode>%occStatus,%occErrors</IncludeCode>
<IncludeCode>%occStatus,%occErrors,%SourceControl.Git</IncludeCode>
<TimeCreated>64476,66997.781615</TimeCreated>

<Method name="test">
<ClassMethod>1</ClassMethod>
<Implementation><![CDATA[ quit $$$WorkInThisVersion
]]></Implementation>
</Method>

<Method name="Export">
<ClassMethod>1</ClassMethod>
<FormalSpec>InternalName,filename</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set ext = ##class(Utils).Type(InternalName)
#if $$$WorkInThisVersion
if ext = "cls" {
quit ..exportCls(InternalName, filename)
Expand All @@ -26,6 +33,8 @@
else {
quit ..exportOther(InternalName, filename)
}
#endif
quit $$$OK
]]></Implementation>
</Method>
Expand All @@ -36,6 +45,7 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set namespace = $namespace
Expand All @@ -52,6 +62,7 @@
set sc = fileStream.SaveStream()
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -62,6 +73,8 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set rtn = ##class(%RoutineMgr).%OpenId(InternalName)
// write content to file
Expand All @@ -84,7 +97,8 @@
}
set sc = fileStream.%Save()
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -95,6 +109,8 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set rtn = ##class(%RoutineMgr).%OpenId(InternalName)
// write content to file
Expand All @@ -104,6 +120,7 @@
set sc = fileStream.CopyFromAndSave(rtn.Code)
quit:$$$ISERR(sc) sc
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -114,6 +131,7 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set serverFileName = $system.CSP.GetFileName(InternalName)
Expand All @@ -124,6 +142,7 @@
set fileStream.Filename = filename
set sc = fileStream.CopyFromAndSave(serverFileStream)
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -134,6 +153,8 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set ext = ##class(Utils).Type(InternalName)
if ext = "cls" {
Expand All @@ -152,6 +173,7 @@
quit ..importOther(InternalName, filename)
}
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -161,6 +183,7 @@
<FormalSpec>InternalName,filename</FormalSpec>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set name = $replace(InternalName, ".cls", "")
if '##class(%Dictionary.ClassDefinition).%ExistsId(name) {
Expand All @@ -172,6 +195,7 @@
set sc = ##class(%Compiler.UDL.TextServices).SetTextFromFile($namespace, InternalName, filename)
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -181,6 +205,8 @@
<FormalSpec>InternalName,filename</FormalSpec>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set $piece(InternalName, ".", *) = $zconvert($piece(InternalName, ".", *), "U")
Expand All @@ -201,6 +227,7 @@
set sc = rtn.Save()
}
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -210,6 +237,7 @@
<FormalSpec>InternalName,filename</FormalSpec>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set $piece(InternalName, ".", *) = $zconvert($piece(InternalName, ".", *), "U")
Expand All @@ -231,6 +259,7 @@
set sc = tDoc.Save()
}
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -240,6 +269,7 @@
<FormalSpec>InternalName,filename</FormalSpec>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set serverFileName = $system.CSP.GetFileName(InternalName)
Expand All @@ -250,6 +280,7 @@
set fileStream.Filename = filename
set sc = serverFileStream.CopyFromAndSave(fileStream)
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -259,7 +290,9 @@
<FormalSpec><![CDATA[&fileList,dir]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
set sc = $$$OK
#if $$$WorkInThisVersion
set trs = ##class(%ResultSet).%New("%Library.File:FileSet")
set sc = trs.Execute(dir, "*")
while trs.Next() {
Expand All @@ -275,6 +308,7 @@
}
}
#endif
quit sc
]]></Implementation>
</Method>
Expand All @@ -285,6 +319,7 @@
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set sc = $$$OK
#if $$$WorkInThisVersion
set slash = ##class(Utils).#Slash
set tempPath = ##class(Utils).NormalizeFolder(##class(Utils).TempFolder())
Expand Down Expand Up @@ -347,6 +382,7 @@
set itemList(newItem_extensionSuffix) = ""
}
#endif
quit sc
]]></Implementation>
</Method>
Expand Down
5 changes: 3 additions & 2 deletions %SourceControl/Git/Utils.cls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Export generator="Cache" version="25">
<Class name="%SourceControl.Git.Utils">
<Abstract>1</Abstract>
<IncludeCode>%occStatus,%occErrors</IncludeCode>
<IncludeCode>%occStatus,%occErrors,%SourceControl.Git</IncludeCode>
<ProcedureBlock>1</ProcedureBlock>
<TimeCreated>62657,53384.637236</TimeCreated>

Expand Down Expand Up @@ -225,7 +225,8 @@ Type:
<FormalSpec>menuItemName:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
if $data(@..#Storage@("settings","typeOfSources"), res) {
if ('$$$WorkInThisVersion) quit 1
if $data(@..#Storage@("settings","typeOfSources"), res) {
quit res
} else {
quit 1
Expand Down
1 change: 1 addition & 0 deletions sc-list.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%SourceControl.Git.inc
%SourceControl.pkg
<cspapp>/gitprojectsettings.csp
cache-tort-git.prj

0 comments on commit d39bbbf

Please sign in to comment.