-
Notifications
You must be signed in to change notification settings - Fork 9
Fixes #366 Add merge to sync flow #376
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3817c3b
started code for merging from default branch
isc-hwojnick b3580fb
commiting before checkout another branch
isc-hwojnick d407e35
now commits before merge/rebase
isc-hwojnick 1b3401b
now pushes before merge
isc-hwojnick 9cd6308
new branch option in basic mode comes from default merge branch
isc-hwojnick fee5a7f
now pushes before and after merge
isc-hwojnick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,11 @@ ClassMethod SystemBasicMode() As %Boolean | |
quit $get(@..#Storage@("settings", "basicMode"), 0) | ||
} | ||
|
||
ClassMethod DefaultMergeBranch() As %String | ||
{ | ||
quit $get(@..#Storage@("settings", "defaultMergeBranch"), "") | ||
} | ||
|
||
ClassMethod MappedItemsReadOnly() As %Boolean | ||
{ | ||
quit $get(@..#Storage@("settings", "mappedItemsReadOnly"), 1) | ||
|
@@ -335,6 +340,16 @@ ClassMethod Commit(InternalName As %String, Message As %String = "example commit | |
|
||
ClassMethod NewBranch(newBranchName As %String) As %Status | ||
{ | ||
set settings = ##class(SourceControl.Git.Settings).%New() | ||
if (settings.basicMode) && (settings.defaultMergeBranch '= ""){ | ||
do ..RunGitWithArgs(.errStream, .outStream, "checkout", settings.defaultMergeBranch) | ||
do ..PrintStreams(errStream, outStream) | ||
kill errStream, outStream | ||
do ..RunGitWithArgs(.errStream, .outStream, "pull") | ||
do ..PrintStreams(errStream, outStream) | ||
kill errStream, outStream | ||
} | ||
|
||
do ..RunGitWithArgs(.errStream, .outStream, "checkout", "-b", newBranchName) | ||
do ..PrintStreams(errStream, outStream) | ||
quit $$$OK | ||
|
@@ -379,6 +394,17 @@ ClassMethod StageAddedFiles() | |
} | ||
} | ||
|
||
/// Merges the files from the configured branch as part of the Sync operation | ||
ClassMethod MergeDefaultRemoteBranch() | ||
{ | ||
set settings = ##class(SourceControl.Git.Settings).%New() | ||
set defaultMergeBranch = settings.defaultMergeBranch | ||
if defaultMergeBranch '= "" { | ||
do ..RunGitWithArgs(.errStream, .outStream, "rebase", defaultMergeBranch) | ||
do ..PrintStreams(errStream, outStream) | ||
} | ||
} | ||
|
||
/// Converts the DynamicArray into a list and calls the SourceControl.Git.Change RemoveUncommitted method on the newly created list | ||
ClassMethod ClearUncommitted(filesWithActions) As %Status | ||
{ | ||
|
@@ -405,6 +431,9 @@ ClassMethod Sync(Msg As %String) As %Status | |
do ..Pull() | ||
do ..SyncCommit(Msg) | ||
do ..Push() | ||
do ..MergeDefaultRemoteBranch() | ||
do ..Push() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to Push after the merge as well, so that the merge is reflected in the remote. |
||
} | ||
|
||
quit $$$OK | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.