我有一个非常大的项目,我们对很多文件进行了更改。现在我们需要确切知道我们更改/添加了哪些行号,以便我们只能在该特定行上运行其他工具。
在寻找答案时,我发现这是对其他一些问题的回答。
echo ${f}:
for n in $(git --no-pager blame --line-porcelain $1 |
awk '/author Not Committed Yet/{if (a && a !~ /author Not Committed Yet/) print a} {a=$0}' |
awk '{print $3}') ; do
if (( prev_line > -1 )) ; then
if (( "$n" > (prev_line + 1) )) ; then
if (( (prev_line - range_start) > 1 )) ; then
echo -n "$range_start-$prev_line,"
else
echo -n "$range_start,$prev_line,"
fi
range_start=$n
fi
else
range_start=$n
fi
prev_line=$n
done
if (( "$range_start" != "$prev_line" )) ; then
echo "$range_start-$prev_line"
else
echo "$range_start"
fi
最终看起来像这样:
views.py:
403,404,533-538,546-548,550-552,554-559,565-567,580-582
它确实很棒..我需要使用cvs完全相同的输出..有没有办法得到类似的输出..