@@ -102,7 +102,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
102102 do %request .Set (" EXPIRES" ,0 )
103103 do ##class (%CSP.StreamServer ).OnPreHTTP () // Need to call this to set headers properly
104104 set %stream = 1 // Leak this to webuidriver.csp
105- } elseif $match (pathStart ," git-command|git|dirname|hostname|viewonly|discarded-states|restore-discarded|contexts" ) {
105+ } elseif $match (pathStart ," git-command|git|dirname|hostname|viewonly|discarded-states|restore-discarded|contexts|create-branch " ) {
106106 if (%request .Method = " GET" ) {
107107 set %data = ##class (%Stream.TmpCharacter ).%New ()
108108 // Things not handled from Python backend:
@@ -218,6 +218,7 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
218218 } else {
219219 set inFile = " "
220220 }
221+
221222 set returnCode = ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" -c" ,inFile ,.errStream ,.outStream ,gitArgs ...)
222223
223224 set %data = ##class (%Stream.TmpCharacter ).%New ()
@@ -328,6 +329,18 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
328329 do %data .Rewind ()
329330 do ##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 )
330331 set handled = 1
332+ } elseif (pathStart = " create-branch" ) {
333+ merge data = %request .Data
334+ set branchName = data (" branch" ,1 )
335+
336+ set %data = ##class (%Stream.TmpCharacter ).%New ()
337+
338+ set st = ##class (SourceControl.Git.Utils ).NewBranch (branchName )
339+ if $$$ISERR(st ) {
340+ do %data .Write (" Error! " _st )
341+ } else {
342+ do %data .Write (branchName _" branch created!" )
343+ }
331344 }
332345 }
333346 }
@@ -426,4 +439,3 @@ ClassMethod GetRemote() As %Library.DynamicObject
426439}
427440
428441}
429-
0 commit comments