OSDN Git Service

マスクを翻訳
[lcs-jp/lcs-jp.git] / conflict-find.sh
1 #!/bin/sh
2 ##
3 ################################################################################
4 ## A simple script that finds Subversion(1) conflicts using grep(1), and      ##
5 ##        displays them using sed(1).                                         ##
6 ##               This script does *NOT* fix them. *That* would be your job.   ##
7 ################################################################################
8 ##               FIXME: Poorly implemented, grep(1)s the directories 3 times. ##
9 ################################################################################
10 args='--color=auto --exclude-dir=".svn"'
11
12                                                        #####################
13 fcount=`grep -rlI $args \>\>\>\>\>\>\> * | sed -n $=`  ## grep(1), sed(1) ##
14 ccount=`grep -rI $args \>\>\>\>\>\>\> * | sed -n $=`   ## grep(1), sed(1) ##
15                                                        #####################
16
17 if [ "$fcount" = "" ]; then
18         fcount='any';
19         fnum='file';
20         elif [ "$fcount" = "1" ]; then
21                 fnum='file';
22         else fnum='files';
23 fi
24
25 if [ "$ccount" = "" ]; then
26         ccount='No';
27         cnum='matches';
28         elif [ "$ccount" = "1" ]; then
29                 cnum='match';
30         else cnum='matches';
31 fi
32
33                                                                    #############
34 grep -rnI $args \>\>\>\>\>\>\> *                                   ## grep(1) ##
35 echo "$ccount $cnum in $fcount $fnum." #########################################
36                                        ## Recursive, grep(1) every file       ##
37                                        ##  (except for the `.svn' directory)  ##
38                                        ##  in every directory for a conflict  ##
39                                        ##  indicator                          ##
40                                        #########################################