関数が長い時は、svn diffしても、変更箇所周辺の表示が、関数名がわかる関数の始まりまで届きません。
takk@deb8:~/a/work$ svn diff -rPREV
Index: func_01.c
===================================================================
--- func_01.c (リビジョン 12)
+++ func_01.c (作業コピー)
@@ -18,7 +18,7 @@
comment
comment
*/
- func_014();
+ func_015();
break;
default:
}
@@ -56,13 +56,13 @@
comment
comment
*/
- func_017();
+ func_018();
break;
case 1:
break;
- case 1:
+ case 2:
break;
- case 1:
+ case 3:
break;
}
}
そんな時は、-x -pオプションを使います。 これで差分のある関数名がわかります。
takk@deb8:~/a/work$ svn diff -x -p -rPREV
Index: func_01.c
===================================================================
--- func_01.c (リビジョン 12)
+++ func_01.c (作業コピー)
@@ -18,7 +18,7 @@ void func_011(void)
comment
comment
*/
- func_014();
+ func_015();
break;
default:
}
@@ -56,13 +56,13 @@ void func_016(void)
comment
comment
*/
- func_017();
+ func_018();
break;
case 1:
break;
- case 1:
+ case 2:
break;
- case 1:
+ case 3:
break;
}
}
では、switch〜case文のどのcaseが変更になったかも、知りたいときはどうしましょう。
関数名と、caseの両方を行うには、やはり外部diffでしょうか。
takk@deb8:~/a/work$ svn diff -rPREV --diff-cmd /usr/bin/diff -x "-y -W80" | tac | perl -ne 'if(/ [\|><]/){print;$f=1} if($f==1){ print if/case/;if(/^\w/){print;$f=0}}' | tac
void func_011(void) void func_011(void)
case 0: case 0:
case 1: case 1:
case 2: case 2:
func_014(); | func_015();
void func_016(void) void func_016(void)
case 0: case 0:
func_017(); | func_018();
case 1: case 1:
case 1: | case 2:
case 1: | case 2:
case 1: | case 3:
case 1: | case 3:
takk@deb8:~/a/work$


コメント