Skip to content

Commit a3e97a1

Browse files
committed
Merge branch 'main' into instance-wide-uncommitted-queue
2 parents 633114d + 317c644 commit a3e97a1

File tree

11 files changed

+103
-12
lines changed

11 files changed

+103
-12
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [2.5.0] - Unreleased
8+
## [2.5.1] - Unreleased
9+
10+
### Fixed
11+
- Changed prompts in configure from 0/1 to no/yes (#461)
12+
- Added warnings when user is using incompatible git version (#488)
13+
14+
## [2.5.0] - 2024-09-24
915

1016
### Added
1117
- New UI for the basic mode Sync (#415)
@@ -24,6 +30,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2430
- Pull event handler will attempt compile even if there are failures to load (#457)
2531
- Improved logging in preview and when errors occur via WebSocket commands (#467)
2632
- Fixed pull event handler handling of extremely long class names from diff (#467)
33+
- Fixed Git web UI prompt to update file list when file selected/unselected (#478)
34+
- Fixed folder settings in mappings to be saved and persist (#483)
35+
- Preview on the pull.csp page now shows commits from the correct branch (#490)
2736

2837
## [2.4.1] - 2024-08-02
2938

@@ -172,4 +181,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
172181
- #201: fix behavior with CSP files
173182

174183
## [2.0.1] - 2022-06-02
175-
- Last released version before CHANGELOG existed.
184+
- Last released version before CHANGELOG existed.

cls/SourceControl/Git/API.cls

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ ClassMethod Configure()
1717
}
1818
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
1919
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)
20+
21+
// Make sure they are using an appropriate git version
22+
if (+$PIECE(version,"version ",2))<2.31 {
23+
write !!, "WARNING: You are using an older version of git which is not compatible with git-source-control. Please upgrade to git version 2.31.0 or greater to continue"
24+
write !!, "Cancelling git-source-control configuration..."
25+
quit
26+
}
2027
if gitExists && isDefault {
2128
// Note: version starts with "git version"
2229
write !,version," is available via PATH. You may enter a path to a different version if needed."
@@ -65,4 +72,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
6572
}
6673

6774
}
68-

cls/SourceControl/Git/Settings.cls

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,24 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
156156
set prompt = $$$comMemberKeyGet(%class.Name,$$$cCLASSproperty,property,$$$cPROPdescription)
157157
set promptQuoted = $$$QUOTE(prompt_":")
158158
set promptQuoted = $replace(promptQuoted,"${username}","'""_$Username_""'")
159-
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
159+
set propertyDef = ##class(%Dictionary.PropertyDefinition).%OpenId("SourceControl.Git.Settings||"_property_"")
160+
if ((propertyDef) && (propertyDef.Type = "%Boolean")) {
161+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetYesNo("_promptQuoted_",.value,,"_defaultPromptFlag_")")
162+
} elseif ((propertyDef) && (propertyDef.Name = "basicMode")) {
163+
set basicModePromptFlag = defaultPromptFlag + $$$MatchExactArrayMask + $$$InitialDisplayMask
164+
do %code.WriteLine(" set list(1) = ""Yes""")
165+
do %code.WriteLine(" set list(2) = ""No""")
166+
do %code.WriteLine(" set list(3) = ""System's Default Mode""")
167+
do %code.WriteLine(" if inst.userBasicMode = ""system"" { set value = ""System's Default Mode""}")
168+
do %code.WriteLine(" elseif inst.userBasicMode = 1 { set value = ""Yes""}")
169+
do %code.WriteLine(" elseif inst.userBasicMode = 0 { set value = ""No""}")
170+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetArray("_promptQuoted_",.value,.list,,,,"_basicModePromptFlag_")")
171+
do %code.WriteLine(" if value = ""System's Default Mode"" { set value = ""system""}")
172+
do %code.WriteLine(" elseif value = ""Yes"" { set value = 1}")
173+
do %code.WriteLine(" elseif value = ""No"" { set value = 0}")
174+
} else {
175+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
176+
}
160177
do %code.WriteLine(" if response '= $$$SuccessResponse { quit 0 }")
161178
do %code.WriteLine(" set inst."_property_" = value")
162179

cls/SourceControl/Git/Utils.cls

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B
11491149
if (name [ "/") && (type = "csp") {
11501150
set cspFilename = $System.CSP.GetFileName(name)
11511151
if (cspFilename '= "") && (cspFilename [ ..TempFolder()) {
1152-
set name = ..NameToInternalName(cspFilename)
1152+
set name = ..NameToInternalName(cspFilename,,,,0)
11531153
set fromWebApp = 1
11541154
} else {
11551155
kill cspFilename
@@ -2195,7 +2195,7 @@ ClassMethod FileIsMapped(InternalName As %String) As %Boolean
21952195
NameToInternalName(name): given a Unix-style slash path relative to repo root,
21962196
returns the internal name for that file (e.g., cls/SourceControl/Git/Utils.cls -> SourceControl.Git.Utils.CLS)
21972197
*/
2198-
ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, Verbose As %Boolean = 0) As %String
2198+
ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, Verbose As %Boolean = 0, normalize As %Boolean = 1) As %String
21992199
{
22002200
set InternalName=""
22012201
set Deleted = 0
@@ -2211,7 +2211,7 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, V
22112211
set InternalName = ##class(SourceControl.Git.File).ExternalNameToInternalName(Name)
22122212
if (InternalName '= "") && (context.IsInGitEnabledPackage) {
22132213
// Don't need mappings!
2214-
return ..NormalizeInternalName(InternalName)
2214+
return $select(normalize:..NormalizeInternalName(InternalName),1:InternalName)
22152215
}
22162216
} else {
22172217
// check for file in uncommitted queue
@@ -2354,7 +2354,7 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, V
23542354
}
23552355
if ((IgnorePercent)&&($extract(InternalName)="%")) { set InternalName = "" } // don't return a result for % items if instructed to ignore them
23562356
if ((IgnoreNonexistent)&&('##class(%RoutineMgr).Exists(InternalName))&&('Deleted)) { set InternalName = "" } // only return item names which exist in the DB
2357-
quit ..NormalizeInternalName(InternalName)
2357+
return $select(normalize:..NormalizeInternalName(InternalName),1:InternalName)
23582358
}
23592359

23602360
ClassMethod OutputConfigureMessage()

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
2020
set responseJSON = ..GetSettingsURL(%request)
2121
} elseif $extract(pagePath, 6, *) = "get-package-version"{
2222
set responseJSON = ..GetPackageVersion()
23+
} elseif $extract(pagePath, 6, *) = "git-version" {
24+
set responseJSON = ..GetGitVersion()
2325
} else {
2426
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
2527
set responseJSON = {"error":("invalid URI: " _ pagePath)}
@@ -331,4 +333,11 @@ ClassMethod GetPackageVersion() As %Library.DynamicObject
331333
quit {"version": (version)}
332334
}
333335

336+
ClassMethod GetGitVersion() As %Library.DynamicObject
337+
{
338+
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
339+
set version = +$PIECE(version,"version ",2)
340+
quit {"version": (version)}
341+
}
342+
334343
}

cls/_zpkg/isc/sc/git/Socket.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ClassMethod Run()
1616
Write !,"Current branch: ",branchName
1717
Do ##class(SourceControl.Git.Utils).RunGitWithArgs(.errStream, .outStream, "fetch")
1818
Kill errStream, outStream
19-
Do ##class(SourceControl.Git.Utils).RunGitWithArgs(.errStream, .outStream, "log", "HEAD..origin", "--name-status")
19+
Do ##class(SourceControl.Git.Utils).RunGitWithArgs(.errStream, .outStream, "log", "HEAD..origin/"_branchName, "--name-status")
2020
Do ##class(SourceControl.Git.Utils).PrintStreams(errStream, outStream)
2121
If (outStream.Size = 0) && (errStream.Size = 0) {
2222
Write !,"Already up to date."

csp/gitprojectsettings.csp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,13 @@ function toggleNoFolders(e){
665665

666666
$('[id^=noFoldersSwitch]').click(toggleNoFolders);
667667

668+
// Check to persist state of no folder switches
669+
$('.mapping-input-group').children('.voca').each(function(){
670+
var currElement = $(this).children().children(".custom-control").children()[0]
671+
if(!$(currElement).hasClass("active")) {
672+
$(currElement).parent().siblings("#NoFolders")[0].value = "NoFolders";
673+
}
674+
});
668675
</script>
669676
</body>
670677
</html>

docs/testing.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# git-source-control Testing Plan
2+
3+
The following is a testing plan that should be followed prior to release of a new version.
4+
5+
- Using a IRIS user with %All permissions, run `##class(SourceControl.Git.API).Configure()` in a terminal on a fresh namespace. Terminal prompts should describe each setting. Create an SSH key and use it to clone a remote repository.
6+
- The following steps should be run with an IRIS user with %Developer role (not %All).
7+
- Use VS Code to create a new class. Use the Source Control menu to Import All from the repository. Check the output to confirm that the contents of the repository were imported and compiled.
8+
- Test changing Git project settings in a web browser and in Studio. Input labels and tooltips should describe each setting.
9+
- In Expert Mode, test:
10+
- Add a new item through Studio / VS Code. Use the Add option in the Source Control Menu. The item should show up in the Workspace view of the WebUI.
11+
- Stash the item in the WebUI. It should be deleted from IRIS. Pop it from the stash. It should be imported and compiled. Discard the item in the WebUI. It should be deleted from IRIS.
12+
- Add, delete, and modify some items in Studio / VS Code. Commit through the WebUI with a commit message and details. The commit should show with the expected commit message and differences in the branch view.
13+
- Select the branch in the branch view and click "Push Branch". It should successfully push changes to the remote repository.
14+
- Create a new local branch. Add a new item and commit it. Switch between the new branch and the old branch. The item should be added and deleted from IRIS. Test merging the new branch to the old branch in the web UI. The item should be added to IRIS.
15+
- Edit a file on the remote repository. Use the "Git Pull" link from the System Management Portal favorites to pull. The preview should show the change without actually pulling it or loading it into IRIS. Confirming should do the pull and load the change into IRIS.
16+
- Edit an item through Studio / VS Code. Log in with a different IRIS user and attempt to edit the same item. The edit should be prohibited. Open the WebUI. The workspace view should list that item and indicate that it is checked out by another user. Stash the item, then try to edit it again. This time the edit should succeed.
17+
- In Basic Mode, test:
18+
- Add, edit, and delete items through Studio / VS Code. Use the Sync option. All changes should be committed and pushed to the remote.
19+
- Add, edit, and delete items on the remote. Add, edit, and delete unrelated items through Studio/VSCode. All changes should be pulled, committed, and pushed.
20+
- Add an item to an interoperability production and sync. Check out a new feature branch. The item should no longer exist in the production. Set the previous branch as the remote merge branch. Sync. The new item should exist in the production.
21+
- Add an item to a production and sync. Check out a new feature branch. The item should no longer exist in the production. Set the previous branch as the remote merge branch. Add a new item to the production. Sync. The production should now have both new items, and the source control output should show it automatically resolved a conflict.

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ webui.showWarning = function(message) {
110110
'</div>').appendTo(messageBox);
111111
}
112112

113+
webui.gitVersion = function() {
114+
$.get("api/git-version", function(version) {
115+
var ver = JSON.parse(version)["version"];
116+
if (ver < 2.31) {
117+
alert("Your git version is incompatible with git-source-control. Please upgrade to git 2.31.0 or greater.")
118+
}
119+
})
120+
}
121+
113122
webui.git_command = function(command, callback) {
114123
$.ajax({
115124
url: "git-command",
@@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) {
313322

314323
webui.TabBox = function(buttons) {
315324

325+
316326
var self = this;
317327

318328
self.itemClicked = function(event) {
@@ -2641,7 +2651,7 @@ webui.NewChangedFilesView = function(workspaceView) {
26412651
}
26422652

26432653
if ($(element).hasClass("other-user") && (selectedItemsFromOtherUser.indexOf(fileName) > -1)) {
2644-
selectedItemsFromOtherUser.splice(selectedItems.indexOf(fileName), 1);
2654+
selectedItemsFromOtherUser.splice(selectedItemsFromOtherUser.indexOf(fileName), 1);
26452655
}
26462656
}
26472657
self.updateButtons();
@@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) {
28082818
function MainUi() {
28092819

28102820
var self = this;
2821+
webui.gitVersion();
28112822

28122823
self.switchTo = function(element) {
28132824
webui.detachChildren(self.mainView);

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ webui.showWarning = function(message) {
110110
'</div>').appendTo(messageBox);
111111
}
112112

113+
webui.gitVersion = function() {
114+
$.get("api/git-version", function(version) {
115+
var ver = JSON.parse(version)["version"];
116+
if (ver < 2.31) {
117+
alert("Your git version is incompatible with git-source-control. Please upgrade to git 2.31.0 or greater.")
118+
}
119+
})
120+
}
121+
113122
webui.git_command = function(command, callback) {
114123
$.ajax({
115124
url: "git-command",
@@ -313,6 +322,7 @@ webui.getNodeIndex = function(element) {
313322

314323
webui.TabBox = function(buttons) {
315324

325+
316326
var self = this;
317327

318328
self.itemClicked = function(event) {
@@ -2641,7 +2651,7 @@ webui.NewChangedFilesView = function(workspaceView) {
26412651
}
26422652

26432653
if ($(element).hasClass("other-user") && (selectedItemsFromOtherUser.indexOf(fileName) > -1)) {
2644-
selectedItemsFromOtherUser.splice(selectedItems.indexOf(fileName), 1);
2654+
selectedItemsFromOtherUser.splice(selectedItemsFromOtherUser.indexOf(fileName), 1);
26452655
}
26462656
}
26472657
self.updateButtons();
@@ -2808,6 +2818,7 @@ webui.NewChangedFilesView = function(workspaceView) {
28082818
function MainUi() {
28092819

28102820
var self = this;
2821+
webui.gitVersion();
28112822

28122823
self.switchTo = function(element) {
28132824
webui.detachChildren(self.mainView);

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="git-source-control.ZPM">
44
<Module>
55
<Name>git-source-control</Name>
6-
<Version>2.4.1</Version>
6+
<Version>2.5.1</Version>
77
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
88
<Keywords>git source control studio vscode</Keywords>
99
<Packaging>module</Packaging>

0 commit comments

Comments
 (0)