Changeset 3578 for trunk/LMDZ.COMMON/makelmdz_fcm
- Timestamp:
- Jan 15, 2025, 1:42:03 PM (8 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/makelmdz_fcm
r3576 r3578 603 603 604 604 # Path and name of the file containing the difference result 605 diff_file="version_diff.txt"605 res_file="version_stat-diff.txt" 606 606 607 607 # Get the current date … … 611 611 vcs_info="" 612 612 vcs_diff="" 613 vcs_status="" 613 614 for dir in "$LMDGCM/.."/*; do 614 615 # Skip if it is not a directory or the name contains "git" or "svn" … … 618 619 # Determine the version control system for each subdirectory 619 620 if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN 620 vcs_info+="\n=== SVN Information for $dir ===\n$(svn info "$dir")\n" 621 vcs_diff+="\n=== SVN Diff for $dir ===\n$(svn diff "$dir")\n" 621 vcs_info+="\n=== SVN Information for $(basename "$dir") ===\n$(svn info "$dir")\n" 622 vcs_diff+="\n=== SVN Diff for $(basename "$dir") ===\n$(svn diff "$dir")\n" 623 vcs_status+="\n=== SVN Status for $(basename "$dir") ===\n$(svn status "$dir")\n" 622 624 elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git 623 vcs_info+="\n=== Git Information for $dir ===\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s")\n" 624 vcs_diff+="\n=== Git Diff for $dir ===\n$(git -C "$dir" diff)\n" 625 vcs_info+="=== Git Information for $(basename "$dir") ===\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s")\n" 626 vcs_diff+="\n=== Git Diff for $(basename "$dir") ===\n$(git -C "$dir" diff)\n" 627 vcs_status+="\n=== Git Status for $(basename "$dir") ===\n$(git -C "$dir" status --short)\n" 625 628 else # None 626 vcs_info+="\n=== No version control system for $ dir===\n"629 vcs_info+="\n=== No version control system for $(basename "$dir") ===\n" 627 630 fi 628 631 done … … 635 638 ! DESCRIPTION: 636 639 ! The subroutine 'print_version_info' prints compilation details, the 637 ! version control information (SVN or Git) and the diff result if638 ! applicable.640 ! version control information (SVN or Git), the status and the diff 641 ! result if applicable. 639 642 ! 640 643 ! PARAMETERS: … … 655 658 SUBROUTINE print_version_info() 656 659 657 write(*,'(A)') '======= Compilation details ======='658 write(*,'(A)') 'Date: ${current_date}'659 write(*,'(A)') 'Command: ${compilation_command}'660 660 write(*,'(a)') '======= Compilation details =======' 661 write(*,'(a)') '> Date: ${current_date}' 662 write(*,'(a)') '> Command: ${compilation_command}' 663 write(*,*) 661 664 EOF 662 665 663 666 if [ -n "$vcs_info" ]; then 664 echo " write(*,'(A)') '=== Version Control Information ==='" >> "$info_file"667 echo "write(*,'(a)') '=== Version Control Information ==='" >> "$info_file" 665 668 while IFS= read -r line; do 666 echo " write(*,'(A)') '${line//\'/\'\'}'" >> "$info_file"669 echo "write(*,'(a)') '${line//\'/\'\'}'" >> "$info_file" 667 670 done <<< "$(echo -e "$vcs_info")" 671 else 672 echo "write(*,'(a)') '=== No version control system ==='" >> "$info_file" 673 fi 674 675 if [ -n "$vcs_status" ]; then 676 echo "write(*,*)" >> "$info_file" 677 echo "write(*,'(a)') '=== Version Control Status ==='" >> "$info_file" 678 echo "write(*,'(a)') '> Writing status result to the file \"${res_file}\".'" >> "$info_file" 679 echo "open(unit = 1, file = \"${res_file}\",status = 'replace',action = 'write')" >> "$info_file" 680 while IFS= read -r line; do 681 echo "write(1,'(a)') '${line//\'/\'\'}'" >> "$info_file" 682 done <<< "$(echo -e "$vcs_status")" 683 echo "close(1)" >> "$info_file" 668 684 fi 669 685 670 686 if [ -n "$vcs_diff" ]; then 671 echo " 672 echo " write(*,'(A)') '====== Version Control Diff ======='" >> "$info_file"673 echo " write(*,'(A)') 'Writing diff to file: ${diff_file}'" >> "$info_file"674 echo " open(unit = 1, file = \"${diff_file}\", status = 'replace',action = 'write')" >> "$info_file"687 echo "write(*,*)" >> "$info_file" 688 echo "write(*,'(a)') '====== Version Control Diff ======='" >> "$info_file" 689 echo "write(*,'(a)') '> Writing diff result to the file \"${res_file}\".'" >> "$info_file" 690 echo "open(unit = 1, file = \"${res_file}\",status = 'unknown',position = 'append',action = 'write')" >> "$info_file" 675 691 while IFS= read -r line; do 676 echo " write(1,'(A)') '${line//\'/\'\'}'" >> "$info_file"692 echo "write(1,'(a)') '${line//\'/\'\'}'" >> "$info_file" 677 693 done <<< "$(echo -e "$vcs_diff")" 678 echo " 694 echo "close(1)" >> "$info_file" 679 695 fi 680 696 681 697 cat << EOF >> "$info_file" 682 write(*,'(A)') '==================================='698 write(*,'(a)') '===================================' 683 699 684 700 END SUBROUTINE print_version_info … … 688 704 689 705 # Termination message 690 echo "'$info_file' has been successfully generated."706 echo "'$info_file' has been generated successfully." 691 707 692 708
Note: See TracChangeset
for help on using the changeset viewer.