@@ -34,16 +34,21 @@ class RepoFileMover:
3434 GIT_EXE = 'git'
3535 FRAMEWORK_DEFAULT_BASE_BRANCH = 'main'
3636
37- FRAMEWORK_SIDE_TEMPLATE = '''Move files from into the framework
37+ # Note that commit message templates must be comments only
38+ # as git requires that the user edit the template before committing.
39+ FRAMEWORK_SIDE_TEMPLATE = '''# Move files into the framework
40+
41+ # This will be the commit message for the commit that takes Mbed TLS
42+ # and removes everything except the moved files. This will then be
43+ # merged into a branch in the framework repository.
3844
39- # This will be the commit message for the commit in the framework
40- # repository that adds the files that were moved.
4145'''
4246
43- MBEDTLS_SIDE_TEMPLATE = '''Move files out of Mbed TLS
47+ MBEDTLS_SIDE_TEMPLATE = '''# Move files out of Mbed TLS
4448
4549# This will be the commit message for the commit in the Mbed TLS
4650# repository that removes the files that were moved.
51+
4752'''
4853
4954 def __init__ (self , source_repo : str , dest_repo : str ,
@@ -148,6 +153,25 @@ class RepoFileMover:
148153
149154 os .remove (template_name )
150155
156+ def commit_template_file_list_src (self ) -> str :
157+ template_file_msg = ('# The following files will be deleted'
158+ ' (moved to the framework):\n \n ' )
159+ for src_repo_file in self ._file_map .keys ():
160+ template_file_msg += '# {f}\n ' .format (f = src_repo_file )
161+
162+ template_file_msg += '\n '
163+
164+ return template_file_msg
165+
166+ def commit_template_file_list_dst (self ) -> str :
167+ template_file_msg = ('# The following files will be added'
168+ ' (moved from Mbed TLS):\n \n ' )
169+ for dst_repo_file in self ._file_map .values ():
170+ template_file_msg += '# {f}\n ' .format (f = dst_repo_file )
171+
172+ template_file_msg += '\n '
173+
174+ return template_file_msg
151175
152176 def create_dest_repo_branch (self ):
153177 """Create the branch containing the moved files only"""
@@ -181,7 +205,9 @@ class RepoFileMover:
181205 self .run_git (['mv' , f , self ._file_map [f ]])
182206
183207 # Commit the result
184- self .commit_interactively_with_template (self .FRAMEWORK_SIDE_TEMPLATE , '-as' )
208+ self .commit_interactively_with_template (self .FRAMEWORK_SIDE_TEMPLATE
209+ + self .commit_template_file_list_dst (),
210+ '-as' )
185211
186212 def create_src_repo_branch (self ):
187213 """Create the branch deleting the moved files"""
@@ -198,7 +224,9 @@ class RepoFileMover:
198224 self .run_git (['rm' , f ])
199225
200226 # Commit the result
201- self .commit_interactively_with_template (self .MBEDTLS_SIDE_TEMPLATE , '-as' )
227+ self .commit_interactively_with_template (self .MBEDTLS_SIDE_TEMPLATE
228+ + self .commit_template_file_list_src (),
229+ '-as' )
202230
203231 def resolve_deletion_conflicts (self ):
204232 file_statuses = self .run_git (['status' , '--porcelain' ])
0 commit comments