@@ -446,82 +446,8 @@ ClassMethod Pull(remote As %String = "origin", preview As %Boolean = 0) As %Stat
446
446
set branchName = outStream .ReadLine (outStream .Size )
447
447
write !, " Pulling from branch: " , branchName
448
448
449
- set sc = ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" fetch" ,,.errStream ,.outStream , remote , branchName )
450
- if (sc =1 ){
451
- do ..PrintStreams (errStream )
452
- quit sc
453
- }
454
-
455
- write !, " Fetch done"
456
- write !, " Files that will be modified by git pull: "
457
-
458
- do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errStream ,.outStream , branchName _" .." _remote _" /" _branchName , " --name-status" )
459
- while (outStream .AtEnd = 0 ) {
460
- set file = outStream .ReadLine ()
461
- set modification = ##class (SourceControl.Git.Modification ).%New ()
462
- set modification .changeType = $piece (file , $c (9 ), 1 )
463
- set modification .externalName = $zstrip ($piece (file , $c (9 ),2 )," <W" )
464
- if (modification .changeType '= " A" ){
465
- set modification .internalName = ##class (SourceControl.Git.Utils ).NameToInternalName (modification .externalName ,,0 )
466
- }
467
- else {
468
- set modification .internalName = " "
469
- }
470
- set files ($increment (files )) = modification
471
- write !, ?4 , modification .changeType , ?4 , modification .internalName , ?4 , modification .externalName
472
- }
473
- if ('$data (files )) {
474
- write !, ?4 , " None"
475
- if preview {
476
- quit $$$OK
477
- }
478
- write !, " Already up to date."
479
- quit $$$OK
480
- } elseif preview {
481
- quit $$$OK
482
- }
483
-
484
449
set sc = ..RunGitWithArgs (.errStream , .outStream , " pull" , remote , branchName )
485
- if (sc =1 ){
486
- do ..PrintStreams (errStream , outStream )
487
- quit $$$ERROR(5001 , " Pull event handler not called. Fix errors before compiling." )
488
- }
489
- do ..PrintStreams (outStream )
490
- write !
491
450
492
- set key = $order (files (" " ))
493
- set deletedFiles = " "
494
- set addedFiles = " "
495
- while (key '= " " ) {
496
- set modification = files (key )
497
- if (modification .changeType = " D" ){
498
- if (modification .internalName '= " " ) {
499
- set deletedFiles = deletedFiles _" ," _modification .internalName
500
- }
501
- } elseif (modification .changeType = " A" ){
502
- set modification .internalName = ##class (SourceControl.Git.Utils ).NameToInternalName (modification .externalName ,,0 )
503
- if (modification .internalName '= " " ) {
504
- set addedFiles = addedFiles _" ," _modification .internalName
505
- set files (key ) = modification
506
- }
507
- }
508
- set key = $order (files (key ))
509
- }
510
-
511
- set deletedFiles = $extract (deletedFiles , 2 , *)
512
- set addedFiles = $extract (addedFiles , 2 , *)
513
-
514
- if (deletedFiles '= " " ){
515
- set sc = ##class (SourceControl.Git.Utils ).RemoveFromServerSideSourceControl (deletedFiles )
516
- }
517
- if (addedFiles '= " " ){
518
- set sc = ##class (SourceControl.Git.Utils ).AddToServerSideSourceControl (addedFiles )
519
- }
520
-
521
- set event = $classmethod (..PullEventClass ()," %New" )
522
- set event .LocalRoot = ..TempFolder ()
523
- merge event .ModifiedFiles = files
524
- quit event .OnPull ()
525
451
}
526
452
527
453
ClassMethod Clone (remote As %String ) As %Status
@@ -1609,7 +1535,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1609
1535
set syncIris = 0
1610
1536
set diffBase = " "
1611
1537
set diffCompare = " "
1612
- if (command = " checkout" ) || (command = " merge" ) || (command = " rebase" ) {
1538
+ if (command = " checkout" ) || (command = " merge" ) || (command = " rebase" ) || ( command = " pull " ) {
1613
1539
set syncIris = 1
1614
1540
set diffCompare = args (args )
1615
1541
}
@@ -1618,7 +1544,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1618
1544
for i =1 :1 :$get (args ) {
1619
1545
if ($data (args (i ))) {
1620
1546
set newArgs ($increment (newArgs )) = args (i )
1621
- if (args (i ) = " checkout" ) || (args (i ) = " merge" ) || (args (i ) = " rebase" ) {
1547
+ if (args (i ) = " checkout" ) || (args (i ) = " merge" ) || (args (i ) = " rebase" ) || ( args ( i ) = " pull " ) {
1622
1548
set syncIris = 1
1623
1549
set diffCompare = args (i + 1 )
1624
1550
@@ -1634,11 +1560,11 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1634
1560
}
1635
1561
1636
1562
if syncIris {
1637
- set ^mtemphw (" diffc" , $i (^mtemphw (" diffc" ))) = diffCompare
1638
1563
if diffBase = " " {
1639
1564
set diffBase = ..GetCurrentBranch ()
1640
1565
}
1641
- set ^mtemphw (" diffb" , $i (^mtemphw (" diffb" ))) = diffBase
1566
+ do ..RunGitCommand (" fetch" , .errorStream , .outputStream )
1567
+ kill errorStream , outputStream
1642
1568
do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _" .." _diffCompare , " --name-status" )
1643
1569
while (outputStream .AtEnd = 0 ) {
1644
1570
set file = outputStream .ReadLine ()
0 commit comments