Changeset 3796 for trunk/LMDZ.COMMON
- Timestamp:
- Jun 5, 2025, 4:14:08 PM (3 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/makelmdz_fcm
r3665 r3796 599 599 ######################################################################## 600 600 601 # Path to the root directory where we want to check version control system 602 root_dir="$LMDGCM/.." 603 601 604 # Path and name of the generated file 602 605 info_file="$LIBFGCM/misc/version_info.F90" … … 609 612 610 613 # Function to process problematic characters 611 # 612 # 613 # 614 # - Convert input to UTF-8 and ignore invalid characters 615 # - Remove carriage return characters to prevent formatting issues 616 # - Escape backslashes and single quotes 614 617 clean_output() { 615 618 iconv -f "$(locale charmap)" -t UTF-8//IGNORE \ … … 618 621 } 619 622 620 # Iterate through subdirectories in $LMDGCM/../ to determine version control system621 623 vcs_info="" 622 624 vcs_diff="" 623 625 vcs_stat="" 624 for dir in "$LMDGCM/.."/*; do 625 # Skip if it is not a directory or the name contains "git" or "svn" 626 [ -d "$dir" ] || continue 627 [[ "$dir" == *git* || "$dir" == *svn* ]] && continue 628 629 # Determine the version control system for each subdirectory 630 if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN 631 vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir" | clean_output)\n" 632 vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir" | clean_output)\n" 633 vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir" | clean_output)\n" 634 elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git 635 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" 636 vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff | clean_output)\n" 637 vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short | clean_output)\n" 638 else # None 639 vcs_info+="\n-> No version control system for \"$(basename "$dir")\"\n" 640 fi 641 done 626 # Check if there is a Git repository at the root 627 if command -v git > /dev/null 2>&1 && git -C "$root_dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then 628 dir_name="$(basename "$root_dir")" 629 vcs_info+="-> Git Information for \"$dir_name\"\n$(git -C "$root_dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | clean_output)\n" 630 vcs_stat+="-> Git Status for \"$dir_name\"\n$(git -C "$root_dir" status --short | clean_output)\n" 631 vcs_diff+="-> Git Diff for \"$dir_name\"\n$(git -C "$root_dir" diff | clean_output)\n" 632 else # No so we iterate through each subdirectory to determine version control system 633 for dir in "$root_dir"/*; do 634 # Skip if it is not a directory or the name contains "git" or "svn" 635 [ -d "$dir" ] || continue 636 [[ "$dir" == *git* || "$dir" == *svn* ]] && continue 637 638 # Determine the version control system for each subdirectory 639 dir_name="$(basename "$dir")" 640 if command -v svn > /dev/null 2>&1 && svn info "$dir" > /dev/null 2>&1; then # SVN 641 vcs_info+="\n-> SVN Information for \"$dir_name\"\n$(svn info "$dir" | clean_output)\n" 642 vcs_diff+="\n-> SVN Diff for \"$dir_name\"\n$(svn diff "$dir" | clean_output)\n" 643 vcs_stat+="\n-> SVN Status for \"$dir_name\"\n$(svn status "$dir" | clean_output)\n" 644 elif command -v git > /dev/null 2>&1 && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git 645 vcs_info+="-> Git Information for \"$dir_name\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | clean_output)\n" 646 vcs_diff+="\n-> Git Diff for \"$dir_name\"\n$(git -C "$dir" diff | clean_output)\n" 647 vcs_stat+="\n-> Git Status for \"$dir_name\"\n$(git -C "$dir" status --short | clean_output)\n" 648 else # None 649 vcs_info+="\n-> No version control system for \"$dir_name\"\n" 650 fi 651 done 652 fi 642 653 643 654 # Generate the Fortran subroutine
Note: See TracChangeset
for help on using the changeset viewer.