@@ -1605,29 +1605,53 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1605
1605
1606
1606
set newArgs ($increment (newArgs )) = command
1607
1607
1608
-
1608
+ // defining variables for if statement use later
1609
+ set syncIris = 0
1610
+ set diffBase = " "
1609
1611
1610
1612
if (command = " checkout" ) || (command = " merge" ) || (command = " rebase" ) {
1611
1613
set syncIris = 1
1612
1614
set diffCompare = args (args )
1613
- set diffBase = " "
1614
1615
}
1615
1616
1616
-
1617
+
1617
1618
for i =1 :1 :$get (args ) {
1618
1619
if ($data (args (i ))) {
1619
1620
set newArgs ($increment (newArgs )) = args (i )
1620
1621
if (args (i ) = " checkout" ) || (args (i ) = " merge" ) || (args (i ) = " rebase" ) {
1621
1622
set syncIris = 1
1622
1623
set diffCompare = args (i + 1 )
1623
- set diffBase = " "
1624
- if $LISTLENGTH ( args ) = (i + 2 ) {
1624
+
1625
+ if args = (i + 2 ) {
1625
1626
set diffBase = args (i + 2 )
1626
1627
}
1627
1628
}
1628
1629
}
1629
1630
}
1630
1631
1632
+ if syncIris {
1633
+ if diffBase = " " {
1634
+ set diffBase = ..GetCurrentBranch ()
1635
+ }
1636
+ do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _" .." _diffCompare , " --name-status" )
1637
+ while (outputStream .AtEnd = 0 ) {
1638
+ set file = outputStream .ReadLine ()
1639
+ set modification = ##class (SourceControl.Git.Modification ).%New ()
1640
+ set modification .changeType = $piece (file , $c (9 ), 1 )
1641
+
1642
+ set modification .externalName = $zstrip ($piece (file , $c (9 ),2 )," <W" )
1643
+ if (modification .changeType '= " A" ){
1644
+ set modification .internalName = ##class (SourceControl.Git.Utils ).NameToInternalName (modification .externalName ,,0 )
1645
+ }
1646
+ else {
1647
+ set modification .internalName = " "
1648
+ }
1649
+ set files ($increment (files )) = modification
1650
+ set mod = files (files )
1651
+ write !, ?4 , modification .changeType , ?4 , modification .internalName , ?4 , modification .externalName
1652
+ }
1653
+ }
1654
+
1631
1655
set outLog = ##class (%Library.File ).TempFilename ()
1632
1656
set errLog = ##class (%Library.File ).TempFilename ()
1633
1657
@@ -1656,49 +1680,14 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1656
1680
}
1657
1681
1658
1682
if syncIris {
1659
- if diffBase = " " {
1660
- set diffBase = ..GetCurrentBranch ()
1661
- }
1662
- do ..SyncIrisWithRepo (diffBase , diffCompare )
1683
+
1684
+ do ..SyncIrisWithRepo (.files )
1663
1685
}
1664
1686
quit returnCode
1665
1687
}
1666
1688
1667
- ClassMethod SyncIrisWithRepo (diffBase As %String , diffCompare As %String )
1689
+ ClassMethod SyncIrisWithRepo (ByRef files )
1668
1690
{
1669
- do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errStream ,.outStream , diffBase _" .." _diffCompare , " --name-status" )
1670
- while (outStream .AtEnd = 0 ) {
1671
- set file = outStream .ReadLine ()
1672
- set modification = ##class (SourceControl.Git.Modification ).%New ()
1673
- set modification .changeType = $piece (file , $c (9 ), 1 )
1674
- set modification .externalName = $zstrip ($piece (file , $c (9 ),2 )," <W" )
1675
- if (modification .changeType '= " A" ){
1676
- set modification .internalName = ##class (SourceControl.Git.Utils ).NameToInternalName (modification .externalName ,,0 )
1677
- }
1678
- else {
1679
- set modification .internalName = " "
1680
- }
1681
- set files ($increment (files )) = modification
1682
- write !, ?4 , modification .changeType , ?4 , modification .internalName , ?4 , modification .externalName
1683
- }
1684
- if ('$data (files )) {
1685
- write !, ?4 , " None"
1686
- if preview {
1687
- quit $$$OK
1688
- }
1689
- write !, " Already up to date."
1690
- quit $$$OK
1691
- } elseif preview {
1692
- quit $$$OK
1693
- }
1694
-
1695
- set sc = ..RunGitWithArgs (.errStream , .outStream , " pull" , remote , branchName )
1696
- if (sc =1 ){
1697
- do ..PrintStreams (errStream , outStream )
1698
- quit $$$ERROR(5001 , " Pull event handler not called. Fix errors before compiling." )
1699
- }
1700
- do ..PrintStreams (outStream )
1701
- write !
1702
1691
1703
1692
set key = $order (files (" " ))
1704
1693
set deletedFiles = " "
@@ -1714,6 +1703,7 @@ ClassMethod SyncIrisWithRepo(diffBase As %String, diffCompare As %String)
1714
1703
if (modification .internalName '= " " ) {
1715
1704
set addedFiles = addedFiles _" ," _modification .internalName
1716
1705
set files (key ) = modification
1706
+
1717
1707
}
1718
1708
}
1719
1709
set key = $order (files (key ))
0 commit comments