22
22
ExtractRulesFile ,
23
23
flatten_declarations ,
24
24
)
25
- from collections import defaultdict
26
- from cumulusci .tasks .salesforce .nonsourcetracking import ListComponents , ListNonSourceTrackable
27
- from cumulusci .core .config import TaskConfig
28
25
from cumulusci .core .runtime import BaseCumulusCI
29
26
from cumulusci .salesforce_api .org_schema import Field , Filters , Schema , get_org_schema
30
27
from cumulusci .salesforce_api .utils import get_simple_salesforce_connection
31
28
from cumulusci .tasks .github .util import CommitDir
29
+ from cumulusci .tasks .salesforce .nonsourcetracking import (
30
+ ListComponents ,
31
+ ListNonSourceTrackable ,
32
+ )
32
33
from cumulusci .tasks .vlocity .vlocity import VlocityRetrieveTask
33
34
from cumulusci .utils import temporary_dir
34
35
from cumulusci .utils .http .requests_utils import safe_json_from_response
@@ -276,7 +277,7 @@ def create_repository(
276
277
277
278
else :
278
279
repo = org .create_repository (
279
- project .repo_name , description = project .description , private = True
280
+ project .repo_name , description = project .description , private = True
280
281
)
281
282
team .add_repository (repo .full_name , permission = "push" )
282
283
project .repo_id = repo .id
@@ -605,6 +606,7 @@ def refresh_scratch_org(scratch_org, *, originating_user_id):
605
606
606
607
refresh_scratch_org_job = job (refresh_scratch_org )
607
608
609
+
608
610
def get_unsaved_changes (scratch_org , * , originating_user_id ):
609
611
try :
610
612
scratch_org .refresh_from_db ()
@@ -624,14 +626,14 @@ def get_unsaved_changes(scratch_org, *, originating_user_id):
624
626
)
625
627
scratch_org .unsaved_changes = unsaved_changes
626
628
with dataset_env (scratch_org ) as (project_config , org_config , sf , schema , repo ):
627
- components = ListNonSourceTrackable (
629
+ components = ListNonSourceTrackable (
628
630
org_config = org_config ,
629
631
project_config = project_config ,
630
- task_config = TaskConfig ({"options" :{}}),
632
+ task_config = TaskConfig ({"options" : {}}),
631
633
)()
632
- scratch_org .metadatatype_changes = {}
634
+ scratch_org .non_source_changes = {}
633
635
for types in components :
634
- scratch_org .metadatatype_changes [types ]= []
636
+ scratch_org .non_source_changes [types ] = []
635
637
except Exception as e :
636
638
scratch_org .refresh_from_db ()
637
639
scratch_org .finalize_get_unsaved_changes (
@@ -644,29 +646,41 @@ def get_unsaved_changes(scratch_org, *, originating_user_id):
644
646
scratch_org .finalize_get_unsaved_changes (
645
647
originating_user_id = originating_user_id
646
648
)
649
+
650
+
647
651
get_unsaved_changes_job = job (get_unsaved_changes )
648
652
649
- def get_nonsource_components (* ,scratch_org ,desiredType ,originating_user_id ):
653
+
654
+ def get_nonsource_components (* , scratch_org , desiredType , originating_user_id ):
650
655
try :
651
656
scratch_org .refresh_from_db ()
652
657
with dataset_env (scratch_org ) as (project_config , org_config , sf , schema , repo ):
653
- components = ListComponents (
658
+ components = ListComponents (
654
659
org_config = org_config ,
655
660
project_config = project_config ,
656
- task_config = TaskConfig ({"options" :{"metadata_types" :desiredType }}),
661
+ task_config = TaskConfig ({"options" : {"metadata_types" : desiredType }}),
657
662
)()
658
663
659
- scratch_org .metadatatype_changes [desiredType ]= [cmp ["MemberName" ] for cmp in components ]
664
+ scratch_org .non_source_changes [desiredType ] = [
665
+ cmp ["MemberName" ] for cmp in components
666
+ ]
660
667
except Exception as e :
661
668
scratch_org .refresh_from_db ()
662
-
669
+ scratch_org .finalize_get_nonsource_components (
670
+ error = e , originating_user_id = originating_user_id
671
+ )
672
+ tb = traceback .format_exc ()
673
+ logger .error (tb )
674
+ raise
663
675
else :
664
676
scratch_org .finalize_get_nonsource_components (
665
677
originating_user_id = originating_user_id
666
678
)
667
679
680
+
668
681
get_nonsource_components_job = job (get_nonsource_components )
669
682
683
+
670
684
def commit_changes_from_org (
671
685
* ,
672
686
scratch_org ,
@@ -712,9 +726,9 @@ def commit_changes_from_org(
712
726
latest_revision_numbers = get_latest_revision_numbers (
713
727
scratch_org , originating_user_id = originating_user_id
714
728
)
715
- member_types = list (desired_changes .keys ())
729
+ member_types = list (desired_changes .keys ())
716
730
for member_type in member_types :
717
- if member_type in scratch_org .metadatatype_changes :
731
+ if member_type in scratch_org .non_source_changes :
718
732
del desired_changes [member_type ]
719
733
for member_type in desired_changes .keys ():
720
734
for member_name in desired_changes [member_type ]:
0 commit comments