vscode-objectscript icon indicating copy to clipboard operation
vscode-objectscript copied to clipboard

Support for Git Feature Branching

Open TwaHendrik opened this issue 1 year ago • 7 comments
trafficstars

We have noticed that a switch between two branches leads to a code change in the workspace. However, the change is not automatically forwarded to the IRIS instance. This leads to an inconsistent state. It would be great if the workspace was the only place of truth. This would enable code reviews and later deployment via CI/CD.

TwaHendrik avatar Oct 29 '24 10:10 TwaHendrik

Thanks for opening this issue @TwaHendrik! I believe this issue a duplicate of #1451 (see https://github.com/intersystems-community/vscode-objectscript/issues/1451#issuecomment-2422451598).

isc-bsaviano avatar Oct 29 '24 11:10 isc-bsaviano

@TwaHendrik After thinking about this more, I'm a little concerned that implementing this could have some unintended consequences. The VS Code API for watching the file system does not batch events, so if you have a lot of classes and routines in your git repo the server will be hammered with a lot of requests. VS Code will also only be able to sync changes that happen when it's open, so if you change branches and then open VS Code the changes wouldn't be synced automatically. I still am generally in favor of this idea, but I'd like to think about it more before adding it to that existing PR.

cc @gjsjohnmurray @isc-rsingh

isc-bsaviano avatar Oct 30 '24 15:10 isc-bsaviano

I don't think there's a good answer here. Sounds like the only way this works elegantly is if you change branches from within VS Code. Is it true that changing branches via a CLI wouldn't work whether or not VS Code is open? And even if you change branches in VS Code you trigger all those requests to the server. I fear this feature could be impossible to get right.

isc-rsingh avatar Oct 30 '24 17:10 isc-rsingh

@isc-rsingh If VS Code has the folder open I can respond to file system events, even if they originate from the git CLI and not the VS Code UI. I need to do more research on what git does when you switch branches. For example, if there are 1000 files and only 1 changes content when you switch branches, does 1 file system event get fired, or 1000? If the former then this could work fine. If the latter, not so much.

isc-bsaviano avatar Oct 30 '24 17:10 isc-bsaviano

This wouldn't be git specific by the way. Changes that happen to the files on disk triggered by any application would be picked up by VS Code.

isc-bsaviano avatar Oct 30 '24 17:10 isc-bsaviano

if there are 1000 files and only 1 changes content when you switch branches, does 1 file system event get fired, or 1000?

Exactly what I was wondering

isc-rsingh avatar Oct 30 '24 22:10 isc-rsingh

@isc-rsingh I did a quick test and git only changes the files that it has to. In the example above, only one change event would fire, not 1000. I can't guarantee that other SCM tools/tools in general behave this way, but this increases my confidence that this feature is worth implementing.

isc-bsaviano avatar Oct 31 '24 12:10 isc-bsaviano

Agreed

regards, Raj

Raj Singh | PM, Developer Experience | InterSystems https://www.intersystems.com/developing-with-intersystems-iris/


From: Brett Saviano @.> Sent: Thursday, October 31, 2024 8:41:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Raj Singh @.>; Mention @.> Subject: Re: [intersystems-community/vscode-objectscript] Support for Git Feature Branching (Issue #1454)

@isc-rsinghhttps://github.com/isc-rsingh I did a quick test and git only changes the files that it has to. In the example above, only one change event would fire, not 1000. I can't guarantee that other SCM tools/tools in general behave this way, but this increases my confidence that this feature is worth implementing.

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/1454#issuecomment-2449753088, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4YC5YQZJPV7W5MO2OFS4LZ6IQQFAVCNFSM6AAAAABQZRE43WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBZG42TGMBYHA. You are receiving this because you were mentioned.Message ID: @.***>

isc-rsingh avatar Oct 31 '24 12:10 isc-rsingh

I'm going to tackle this as part of #1401

isc-bsaviano avatar Nov 08 '24 13:11 isc-bsaviano