1. 程式人生 > >diffcount統計兩個版本之間程式碼變更行數

diffcount統計兩個版本之間程式碼變更行數

     使用工具diffcount可以統計一個專案之間兩個版本的程式碼變動量。新版本較老版本有多少新增、修改、刪除、有效程式碼量等。

方法和步驟:

1.解壓diffcount壓縮包,將其放在C盤。

2.在C:\diffcount\diffcount\test下建立兩個資料夾,old,new.

3.將需要比較的未改動之前版本的程式碼分別複製到兩個資料夾。

4.使用改動完成的程式碼將new資料夾中的程式碼覆蓋,得到兩個差異版本。


5.開啟cmd視窗,輸入"cd c:\diffcount\diffcount"進入diffcount.exe資料夾。


6.輸入 "diffcount test\old test\new --print-files-info > result.txt"將比較結果輸出到“C:\diffcount\diffcount\result.txt”

(注:如果檔案較多執行時間較長)


7.執行完畢後得到比較結果檔案,可使用excel預設分隔設定開啟。也可以使用其它文字編輯器開啟。

LANG:語言或配置檔案型別

ADD:新增程式碼行數

MOD:修改程式碼行數

DEL:刪除程式碼行數

A&M:新增與修改程式碼行數之和

BLK:空行數

CMT:註釋行數

NBNC:非空非註釋行數

RATE:標準C折算率


8.

幫助

C:\diffcount\diffcount>diffcount.exe --help

Usage: diffcount.exe [OPTION]... (Baseline) Target

Compare and diff two packages or only couting one code package

OPTIONS:

   -c --count-only

       Only counting one code package

   --ignore-case

       Ignore the difference of file name case

   --print-lines-info

       Print detailed information of every diffed lines

       Slow, Debug use only

   --print-files-info

       Print every diffed file result information.

   --force-parse-all

       Parsing all diffed files(default: skip same file)

   --for-program-reading

      Change result output style for Third-party program reading

      Will disable --print-lines-info automaticly

   -v  --version

       Output current version.

   --help

       Show this page

    --cn-help

      Show Chinese help page