Skip to content

Fix recent bugs #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions cls/SourceControl/Git/Change.cls
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,39 @@ ClassMethod RefreshUncommitted(Display = 0, IncludeRevert = 0, Output gitFiles,
do ##class(Utils).GitStatus(.gitFiles)

// Remove entries in the uncommitted queue that don't correspond to changes as tracked by git
set filename="", filename=$order(tFileList(filename),1,action)
while (filename'="") {
set examine=$select(action="add":1,action="edit":1,action="delete":1, IncludeRevert&&(action="revert"):1,1:0)
if 'examine set filename=$order(tFileList(filename),1,action) continue
set filename=""
for {
set filename=$order(tFileList(filename),1,action)
quit:filename=""

set examine=$select(action="add":1,
action="edit":1,
action="delete":1,
IncludeRevert&&(action="revert"):1,
1:0)
if 'examine {
continue
}

set packageRoot = ##class(SourceControl.Git.Utils).TempFolder()
set InternalName = ##class(SourceControl.Git.Utils).NameToInternalName(filename,0,0)

// skip files belonging to other git enabled packages
if ($EXTRACT(filename, 1, $LENGTH(packageRoot)) '= packageRoot) continue


if (('##class(%File).Exists(filename)) || (InternalName = "") || ((InternalName '= "") && ('$data(gitFiles(InternalName), found)) &&
(($data($$$TrackedItems(InternalName))) || ##class(SourceControl.Git.Utils).NormalizeExtension($data($$$TrackedItems(InternalName)))))) {
set sc=..RemoveUncommitted(filename,Display,0,0)
if $$$ISERR(sc) set filename="" continue
if $$$ISERR(sc) continue
}
set filename=$order(tFileList(filename),1,action)
}

// Add missing records to the uncommitted queue that correspond to changes as tracked by git
set filename="", filename=$order(gitFiles(filename),1,details)
while (filename'="") {
set filename=""
for {
set filename=$order(gitFiles(filename),1,details)
quit:filename=""

set InternalName = filename
set ExternalName = ##class(%File).NormalizeFilename(##class(SourceControl.Git.Utils).TempFolder()_$list(details,2))
set changeType = $list(details,1)
Expand All @@ -161,9 +171,8 @@ ClassMethod RefreshUncommitted(Display = 0, IncludeRevert = 0, Output gitFiles,

if ((##class(%File).Exists(ExternalName)) && ('$ISVALIDNUM(InternalName)) && ('..IsUncommitted(ExternalName)) && ($data($$$TrackedItems(InternalName)))) {
set sc=..SetUncommitted(ExternalName, action, InternalName, $USERNAME, "", 1, "", "", 0)
if $$$ISERR(sc) w sc set filename="" continue
if $$$ISERR(sc) continue
}
set filename=$order(gitFiles(filename),1,details)
}
set ^IRIS.Temp.gitsourcecontrol("Refresh") = $zdatetime($ztimestamp,-2)
merge ^IRIS.Temp.gitsourcecontrol("LastUncommitted") = gitFiles
Expand Down
1 change: 1 addition & 0 deletions cls/SourceControl/Git/File.cls
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ Storage Default
}

}

1 change: 1 addition & 0 deletions cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Method DeleteFile(item As %String)
}

}

15 changes: 11 additions & 4 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ ClassMethod Fetch(ByRef diffFiles) As %Status
quit $$$OK
}

ClassMethod GetCurrentBranch() As %String{
ClassMethod GetCurrentBranch() As %String
{
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current")
set branchName = outStream.ReadLine(outStream.Size)
quit branchName
Expand Down Expand Up @@ -2075,9 +2076,14 @@ ClassMethod CheckInitialization()

ClassMethod GetPackageVersion() As %String
{
do ##class(%ZPM.PackageManager).GetVersion("git-source-control",.out)
set scVersion = out("git-source-control")
quit $LIST(scVersion, 2)
set package = $$$NULLOREF
if $$$comClassDefined("%IPM.Storage.Module") {
set package = ##class(%IPM.Storage.Module).NameOpen("git-source-control")
} elseif $$$comClassDefined("%ZPM.PackageManager.Developer.Module") {
set package = ##class(%ZPM.PackageManager.Developer.Module).NameOpen("git-source-control")
}
quit $select($IsObject(package):package.VersionString,
1:"unknown")
}

ClassMethod GetSourceControlInclude() As %String
Expand Down Expand Up @@ -2276,3 +2282,4 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
}

}

Loading