1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
import os import shlex import subprocess
def run_command(absolute_path, command_name): print( "Running", command_name, absolute_path )
command = shlex.split( command_name ) command_line_interface = subprocess.Popen( command, stdout=subprocess.PIPE, cwd=absolute_path )
output = command_line_interface.communicate()[0] print( output )
if command_line_interface.returncode != 0: raise RuntimeError( "A process exited with the error '%s'..." % ( command_line_interface.returncode ) )
def main(): FILENAMES_MAPPING = \ [ (r"F:\\SublimeText\\Data", r"README.MD", r"README.md"), (r"F:\\SublimeText\\Data\\Packages\\Alignment", r"readme.md", r"README.md"), (r"F:\\SublimeText\\Data\\Packages\\AmxxEditor", r"README.MD", r"README.md"), ]
for absolute_path, oldname, newname in FILENAMES_MAPPING: run_command( absolute_path, "git mv '%s' '%s1'" % ( oldname, newname ) ) run_command( absolute_path, "git add '%s1'" % ( newname ) ) run_command( absolute_path, "git commit -m 'Normalized the \'%s\' with case-sensitive name'" % ( newname ) )
run_command( absolute_path, "git mv '%s1' '%s'" % ( newname, newname ) ) run_command( absolute_path, "git add '%s'" % ( newname ) ) run_command( absolute_path, "git commit --amend --no-edit" )
if __name__ == "__main__": main()
|