Skip to content
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

Suppress deletion in locked environment #307

Merged
merged 7 commits into from
Jan 4, 2024
Merged

Conversation

isc-vgao
Copy link
Contributor

Testing Steps:

  1. In Terminal/Windows Powershell, clone git-source-control repository and switch to testDelete branch
git clone git@github.com:intersystems/git-source-control.git

(enter passcode for deploy key if prompted)

cd git-source-control
git checkout suppressDelete

In IRIS terminal
2. Load git-source-control repository into IRIS from the community package registry.

zpm "install git-source-control"
  1. Configure settings by running the following method and answering the prompts:
zpm "q"
d ##class(SourceControl.Git.API).Configure()
  1. Load git-source-control into the current namespace
zpm "load <path to local git-source-control repo cloned in step 1>"
  1. Open Studio
    If you see "Dubious Ownership" error in Output window, you have to change owner of local git-source-control repo. Steps to do that on Windows:
    1. Open Windows Powershell as Administrator
    2. Run
      a. $objSID = New-Object System.Security.Principal.SecurityIdentifier("<SID>")
      Note: replace <SID> with <SID> in "the current user is: '<SID>'" part of dubious ownership error message
      b. $objUser = $objSID.Translate([System.Security.Principal.NTAccount])
      c. icacls <path to local git-source-control repo cloned in step 1> /setowner $objUser.value /T
      Note: replace <path to local git-source-control repo cloned in step 1> with a path like C:\Users<your username>\
    3. Close and reopen Studio
  2. Lock the environment
d ##class(SourceControl.Git.API).Lock()
  1. In Studio's Workspace window Namespace tab, click Classes > SourceControl > Git > TestDelete.cls
  2. Right-click on TestDelete and then click "Delete Class 'SourceControl.Git.TestDelete'" An error message should pop up with message "Can't delete in locked environment"
  3. Open git-source-control repo in VS Code.

In VS Code,
10. Click the ObjectScript icon in the left side menu to open ObjectScript Explorer window, click "Choose Server and Namespace" and sign in using InterSystems Server Credentials.
11. Open an InterSystems Websocket Terminal.
12. Verify that you are still in locked environment

w ##class(SourceControl.Git.Utils).Locked()

should print 1
13. In ObjectScript Explorer window, click Classes > SourceControl > Git > TestDelete.cls
14. Right-click on TestDelete and then click "Delete" > "Confirm". Verify that TestDelete file wasn't deleted.

@isc-vgao isc-vgao self-assigned this Dec 28, 2023
Copy link
Collaborator

@isc-pbarton isc-pbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks great. I would say that the SourceControl.Git.TestDelete class should be deleted entirely, since its only purpose is for manual testing of this change.

@isc-vgao isc-vgao requested a review from isc-pbarton January 2, 2024 21:44
Copy link
Collaborator

@isc-tleavitt isc-tleavitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update CHANGELOG.md with a note about this in the "Fixed" section

@isc-vgao isc-vgao requested a review from isc-tleavitt January 3, 2024 17:23
@isc-tleavitt isc-tleavitt merged commit 8b1b391 into main Jan 4, 2024
2 checks passed
@isc-tleavitt isc-tleavitt deleted the suppressDelete branch January 4, 2024 13:28
@isc-tleavitt
Copy link
Collaborator

This fixes #302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants