- Timestamp:
- Jan 22, 2025, 3:46:20 PM (40 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/makelmdz_fcm
r3595 r3596 608 608 current_date=$(date) 609 609 610 # Function to process problematic characters 611 # Delete invalid character due to encoding format 612 # Escape backslashes and single quotes 613 clean_output() { 614 echo "$1" \ 615 | iconv -f "$(locale charmap)" -t UTF-8//IGNORE \ 616 | sed 's/\\/\\\\/g; s/'\''/'\'\''/g' 617 } 618 610 619 # Iterate through subdirectories in $LMDGCM/../ to determine version control system 611 620 vcs_info="" … … 619 628 # Determine the version control system for each subdirectory 620 629 if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN 621 vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"622 vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"623 vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"630 vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir" | clean_output)\n" 631 vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir" | clean_output)\n" 632 vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir" | clean_output)\n" 624 633 elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git 625 vcs_info+="-> Git Information for \"$(basename "$dir")\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"626 vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"627 vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"634 vcs_info+="-> Git Information for \"$(basename "$dir")\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | clean_output)\n" 635 vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff | clean_output)\n" 636 vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short | clean_output)\n" 628 637 else # None 629 638 vcs_info+="\n-> No version control system for \"$(basename "$dir")\"\n" … … 667 676 echo "write(*,'(a)') '=== Version Control Information ==='" >> "$info_file" 668 677 while IFS= read -r line; do 669 echo "write(*,'(a)') '${line //\'/\'\'}'" >> "$info_file"678 echo "write(*,'(a)') '${line}'" >> "$info_file" 670 679 done <<< "$(echo -e "$vcs_info")" 671 680 else … … 679 688 echo "open(unit = 1, file = \"${res_file}\",status = 'replace',action = 'write')" >> "$info_file" 680 689 while IFS= read -r line; do 681 echo "write(1,'(a)') '${line //\'/\'\'}'" >> "$info_file"690 echo "write(1,'(a)') '${line}'" >> "$info_file" 682 691 done <<< "$(echo -e "$vcs_stat")" 683 692 echo "close(1)" >> "$info_file" … … 690 699 echo "open(unit = 1, file = \"${res_file}\",status = 'unknown',position = 'append',action = 'write')" >> "$info_file" 691 700 while IFS= read -r line; do 692 echo "write(1,'(a)') '${line //\'/\'\'}'" >> "$info_file"701 echo "write(1,'(a)') '${line}'" >> "$info_file" 693 702 done <<< "$(echo -e "$vcs_diff")" 694 703 echo "close(1)" >> "$info_file"
Note: See TracChangeset
for help on using the changeset viewer.