@@ -459,66 +459,84 @@ def should_attempt_auto_resolve():
459459 pbunreal .ensure_ue_closed ()
460460 pblog .info ("Please wait while getting the latest changes from the repository. It may take a while..." )
461461
462- # Check what files we are going to change
463- diff_proc = run_with_combined_output ([pbgit .get_git_executable (), "diff" , "--name-only" , f"HEAD...origin/{ branch_name } " ])
464- if diff_proc .returncode == 0 :
465- changed_files = diff_proc .stdout .splitlines ()
466- else :
467- changed_files = []
462+ use_new_sync = False
463+ if use_new_sync :
464+ # Check what files we are going to change
465+ diff_proc = run_with_combined_output ([pbgit .get_git_executable (), "diff" , "--name-only" , f"HEAD...origin/{ branch_name } " ])
466+ if diff_proc .returncode == 0 :
467+ changed_files = diff_proc .stdout .splitlines ()
468+ else :
469+ changed_files = []
468470
469- changed_files = [file for file in changed_files if pbgit .is_lfs_file (file )]
471+ changed_files = [file for file in changed_files if pbgit .is_lfs_file (file )]
470472
471- cpus = os .cpu_count ()
472- total = len (changed_files )
473- fetch_processes = min (cpus , math .ceil (total / 50 ))
474- fetch_batch_size = min (50 , math .ceil (total / fetch_processes ))
475- if fetch_batch_size == total :
476- start_lfs_fetch (changed_files )
477- else :
478- fetch_batched = chunks (changed_files , fetch_batch_size )
479- with multiprocessing .Pool (fetch_processes ) as pool :
480- pool .map (do_lfs_fetch , fetch_batched )
481-
482- # Get the latest files, but skip smudge so we can super charge a LFS pull as one batch
483- cmdline = [pbgit .get_git_executable (), "-c" , "filter.lfs.smudge=" , "-c" , "filter.lfs.process=" , "-c" , "filter.lfs.required=false" ]
484- # if we can fast forward merge, do that instead of a rebase (faster, safer)
485- if it_has_any (out , "+0" ):
486- pblog .info ("Fast forwarding workspace to the latest changes from the repository..." )
487- cmdline .extend (["merge" , "--ff-only" ])
488- else :
489- pblog .info ("Rebasing workspace with the latest changes from the repository..." )
490- cmdline .extend (["rebase" , "--autostash" ])
491- cmdline .append (f"origin/{ branch_name } " )
492- result = run_with_combined_output (cmdline )
473+ cpus = os .cpu_count ()
474+ total = len (changed_files )
475+ fetch_processes = min (cpus , math .ceil (total / 50 ))
476+ fetch_batch_size = min (50 , math .ceil (total / fetch_processes ))
477+ if fetch_batch_size == total :
478+ start_lfs_fetch (changed_files )
479+ else :
480+ fetch_batched = chunks (changed_files , fetch_batch_size )
481+ with multiprocessing .Pool (fetch_processes ) as pool :
482+ pool .map (do_lfs_fetch , fetch_batched )
483+
484+ # Get the latest files, but skip smudge so we can super charge a LFS pull as one batch
485+ cmdline = [pbgit .get_git_executable (), "-c" , "filter.lfs.smudge=" , "-c" , "filter.lfs.process=" , "-c" , "filter.lfs.required=false" ]
486+ # if we can fast forward merge, do that instead of a rebase (faster, safer)
487+ if it_has_any (out , "+0" ):
488+ pblog .info ("Fast forwarding workspace to the latest changes from the repository..." )
489+ cmdline .extend (["merge" , "--ff-only" ])
490+ else :
491+ pblog .info ("Rebasing workspace with the latest changes from the repository..." )
492+ cmdline .extend (["rebase" , "--autostash" ])
493+ cmdline .append (f"origin/{ branch_name } " )
494+ result = run_with_combined_output (cmdline )
493495
494- # update plugin submodules
495- run ([pbgit .get_git_executable (), "submodule" , "update" , "--init" , "--" , "Plugins" ])
496+ # update plugin submodules
497+ run ([pbgit .get_git_executable (), "submodule" , "update" , "--init" , "--" , "Plugins" ])
496498
497- processes = min (cpus , math .ceil (total / 5 ))
498- batch_size = min (50 , math .ceil (total / processes ))
499- chunked_files = chunks (changed_files , batch_size )
499+ processes = min (cpus , math .ceil (total / 5 ))
500+ batch_size = min (50 , math .ceil (total / processes ))
501+ chunked_files = chunks (changed_files , batch_size )
500502
501- # make index.lock to block LFS from updating index
502- with open (".git/index.lock" , "w" ) as f :
503- pass
503+ # make index.lock to block LFS from updating index
504+ with open (".git/index.lock" , "w" ) as f :
505+ pass
506+
507+ # Update index without FS monitor
508+ run ([pbgit .get_git_executable (), "config" , "-f" , ".gitconfig" , "core.useBuiltinFSMonitor" , "false" ])
509+
510+ # split it out to multiprocess
511+ with multiprocessing .Pool (processes ) as pool :
512+ # Checkout LFS in one go since we skipped smudge and fetched in the background
513+ finish_lfs_fetch ()
514+ pool .map (do_lfs_checkout , chunked_files )
504515
505- # Update index without FS monitor
506- run ([pbgit .get_git_executable (), "config" , "-f" , ".gitconfig" , "core.useBuiltinFSMonitor" , "false" ])
516+ os .remove (".git/index.lock" )
507517
508- # split it out to multiprocess
509- with multiprocessing .Pool (processes ) as pool :
510- # Checkout LFS in one go since we skipped smudge and fetched in the background
511- finish_lfs_fetch ()
512- pool .map (do_lfs_checkout , chunked_files )
518+ update_index = [pbgit .get_git_executable (), "update-index" , "-q" , "--refresh" , "--unmerged" , "--" ]
519+ update_index .extend (changed_files )
520+ run (update_index )
513521
514- os .remove (".git/index.lock" )
522+ # Revert back to using FS monitor
523+ run ([pbgit .get_git_executable (), "config" , "-f" , ".gitconfig" , "core.useBuiltinFSMonitor" , "true" ])
524+ else :
525+ # Get the latest files
526+ cmdline = [pbgit .get_git_executable ()]
527+ # if we can fast forward merge, do that instead of a rebase (faster, safer)
528+ if it_has_any (out , "+0" ):
529+ pblog .info ("Fast forwarding workspace to the latest changes from the repository..." )
530+ cmdline .extend (["merge" , "--ff-only" ])
531+ else :
532+ pblog .info ("Rebasing workspace with the latest changes from the repository..." )
533+ cmdline .extend (["rebase" , "--autostash" ])
534+ cmdline .append (f"origin/{ branch_name } " )
535+ result = run_with_combined_output (cmdline )
515536
516- update_index = [pbgit .get_git_executable (), "update-index" , "-q" , "--refresh" , "--unmerged" , "--" ]
517- update_index .extend (changed_files )
518- run (update_index )
537+ # update plugin submodules
538+ run ([pbgit .get_git_executable (), "submodule" , "update" , "--init" , "--" , "Plugins" ])
519539
520- # Revert back to using FS monitor
521- run ([pbgit .get_git_executable (), "config" , "-f" , ".gitconfig" , "core.useBuiltinFSMonitor" , "true" ])
522540
523541 # see if the update was successful
524542 code = result .returncode
0 commit comments