@@ -34,16 +34,20 @@ 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
3840
3941# This will be the commit message for the commit in the framework
4042# repository that adds the files that were moved.
43+
4144'''
4245
43- MBEDTLS_SIDE_TEMPLATE = '''Move files out of Mbed TLS
46+ MBEDTLS_SIDE_TEMPLATE = '''# Move files out of Mbed TLS
4447
4548# This will be the commit message for the commit in the Mbed TLS
4649# repository that removes the files that were moved.
50+
4751'''
4852
4953 def __init__ (self , source_repo : str , dest_repo : str ,
@@ -148,6 +152,25 @@ class RepoFileMover:
148152
149153 os .remove (template_name )
150154
155+ def commit_template_file_list_src (self ) -> str :
156+ template_file_msg = ('# The following files will be deleted'
157+ ' (moved to the framework):\n \n ' )
158+ for src_repo_file in self ._file_map .keys ():
159+ template_file_msg += '# {f}\n ' .format (f = src_repo_file )
160+
161+ template_file_msg += '\n '
162+
163+ return template_file_msg
164+
165+ def commit_template_file_list_dst (self ) -> str :
166+ template_file_msg = ('# The following files will be added'
167+ ' (moved from Mbed TLS):\n \n ' )
168+ for dst_repo_file in self ._file_map .values ():
169+ template_file_msg += '# {f}\n ' .format (f = dst_repo_file )
170+
171+ template_file_msg += '\n '
172+
173+ return template_file_msg
151174
152175 def create_dest_repo_branch (self ):
153176 """Create the branch containing the moved files only"""
@@ -181,7 +204,9 @@ class RepoFileMover:
181204 self .run_git (['mv' , f , self ._file_map [f ]])
182205
183206 # Commit the result
184- self .commit_interactively_with_template (self .FRAMEWORK_SIDE_TEMPLATE , '-as' )
207+ self .commit_interactively_with_template (self .FRAMEWORK_SIDE_TEMPLATE
208+ + self .commit_template_file_list_dst (),
209+ '-as' )
185210
186211 def create_src_repo_branch (self ):
187212 """Create the branch deleting the moved files"""
@@ -198,7 +223,9 @@ class RepoFileMover:
198223 self .run_git (['rm' , f ])
199224
200225 # Commit the result
201- self .commit_interactively_with_template (self .MBEDTLS_SIDE_TEMPLATE , '-as' )
226+ self .commit_interactively_with_template (self .MBEDTLS_SIDE_TEMPLATE
227+ + self .commit_template_file_list_src (),
228+ '-as' )
202229
203230 def resolve_deletion_conflicts (self ):
204231 file_statuses = self .run_git (['status' , '--porcelain' ])
0 commit comments