Changeset 2021428 in mainline for tools/srepl
- Timestamp:
 - 2018-05-12T16:40:25Z (7 years ago)
 - Branches:
 - lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
 - Children:
 - df96271
 - Parents:
 - 8a1be76
 - git-author:
 - Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-12 15:56:07)
 - git-committer:
 - Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-12 16:40:25)
 - File:
 - 
      
- 1 edited
 
- 
          
  tools/srepl (modified) (2 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
tools/srepl
r8a1be76 r2021428 14 14 } 15 15 16 17 if [ "$1" = "--" ]; then 18 usage 19 elif [ "$#" -eq 1 ] || [ "$2" = "--" ]; then 20 pattern="$1" 21 shift 22 git grep -I -n "$pattern" "$@" 23 elif [ "$#" -eq 2 ] || [ "$3" = "--" ]; then 24 16 check_unstaged() 17 { 25 18 if ( git status --porcelain | grep '^.[^ ]' ); then 26 19 echo "You have unstaged changes in your tree." … … 29 22 exit 1 30 23 fi 24 } 31 25 32 pattern="$1" 33 replacement="$2" 26 _slashify() 27 { 28 # Some shells have shoddy handling of backslashes in echo. 29 printf '%s\n' "$1" | sed 's/\([^\\]\)\//\1\\\//g' 30 } 31 32 if [ "$1" = "--" ]; then 33 usage 34 elif [ "$1" = "-d" ]; then 35 check_unstaged 36 37 pattern=`_slashify "$2"` 38 shift 39 shift 40 git grep -I -l "$pattern" "$@" | xargs sed -i "/$pattern/d" 41 42 elif [ "$#" -eq 1 ] || [ "$2" = "--" ]; then 43 pattern=`_slashify "$1"` 44 shift 45 git grep -I -n "$pattern" "$@" 46 elif [ "$#" -eq 2 ] || [ "$3" = "--" ]; then 47 check_unstaged 48 49 pattern=`_slashify "$1"` 50 replacement=`_slashify "$2"` 34 51 shift 35 52 shift  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  