1
使用svn diff
與--summarize
標誌返回類似於下面的內容。我們如何將它傳遞給sed的或grep來做到以下幾點:如何解析svn diff結果?
- 刪除所有以「d」(刪除文件)開始的任何行
- 刪除的「M」前綴,「A」或「 MM「(或任何其他情況)以及隨後的標籤。
- 刪除URL路徑只留下文件名/文件夾。
- 存儲在文件
例子:
D https://localhost/example/test1.php
D https://localhost/example/test2.php
M https://localhost/example/test3.php
M https://localhost/example/test4.php
A https://localhost/example/test5.php
M https://localhost/example/test6.php
A https://localhost/example/test7.php
M https://localhost/example/test8.php
M https://localhost/example/test9.php
M https://localhost/example/test10.php
A https://localhost/example/test11.php
M https://localhost/example/test12.php
M https://localhost/example/test13.php
MM https://localhost/example/test.php
M https://localhost/test0.php
然後會變成:
/example/test3.php
/example/test4.php
/example/test5.php
/example/test6.php
/example/test7.php
/example/test8.php
/example/test9.php
/example/test10.php
/example/test11.php
/example/test12.php
/example/test13.php
/example/test.php
/test0.php
您的輸出結果與您的規格不符,它們不應包含'test1.php'或'test2.php',因爲它們以'D'開頭。 –
謝謝,更新了我的示例輸出以糾正錯誤。 – atdev