安裝
Upsource 是什麼
Upsource 作為一個程式碼審查工具, 有很多有益的特性.
- 執行高效的程式碼審查
- 從 IDE 審閱
- 通過瀏覽器跟蹤重要的變化
- 發現設計缺陷, 找出專案中需要開發人員注意的部分
- 檢測專案範圍的風險, 分散責任
- 快速皮膚, 便於新成員瞭解專案並瞭解其他人的職責範圍
- @迴應, 討論變化, 幫助隊友
- 可與持續交付/問題跟蹤/github同步
- 不用擔心團隊成員人數, 團隊專案, 不限量~
下載
安裝
下載並解壓到指定的資料夾
目錄樹
├── api
├── apps
├── backups # 備份目錄
├── bin # 應用目錄
├── conf # 配置檔案
├── data
├── internal
├── launcher
├── lib
├── logs # 日誌
├── sonarqube
└── temp # 臨時檔案
複製程式碼
可用命令
命令的位置
$ ./bin/upsource.sh
# 呼叫 help <command> 來檢視詳細
複製程式碼
configure : 配置 Upsource
start : 後臺啟動
run : 在當前命令列執行
status : 檢視執行狀態
stop : 停止
restart : 重啟
rerun : 當前命令列重新執行
dump : 輸出 debug info
kill : 殺死 upsource 程式
java : 管理java的路徑
help <command> : 顯示幫助資訊
help <command name>
prints usage text for the specified command
複製程式碼
詳細文件檢視
這裡我們執行
$ ./bin/upsource.sh start
Starting Upsource...
* Configuring JetBrains Upsource 2018.1
* Made default base-url 'http://macbook-pro-2.local:8080/' from hostname 'macbook-pro-2.local' and listen port '8080'
* JetBrains Upsource 2018.1 runtime environment is successfully configured
* Loading logging configuration from /Users/duoli/Downloads/upsource-2018.1.357/lib/ext/log4j.xml
* Redirecting JetBrains Upsource 2018.1 logging to /Users/duoli/Downloads/upsource-2018.1.357/logs/internal/services/bundleProcess
* Configuring Service-Container[bundleProcess]
* Configuring Bundle Backend Service
* Configuring Configuration Wizard
* Starting Service-Container[bundleProcess]
* Starting Bundle Backend Service
* Starting Configuration Wizard
* JetBrains Upsource 2018.1 Configuration Wizard will be available on [http://macbook-pro.local:8080?wizard_token=UwxfxNH1OxGS75l3DO9p] after start
Upsource is running
複製程式碼
配置專案
根據在命令列顯示的資訊, 我們開啟這個地址 http://macbook-pro.local:8080?wizard_token=UwxfxNH1OxGS75l3DO9p
, 如果在伺服器上

這裡我們點選 Set Up 來進行安裝

這裡來配置訪問的地址, 如果是外網, 這裡的地址應該是域名, 區域網替換成 IP, 如果是本地則可以替換成 localhost, 這裡我替換為 localhost
建立賬號密碼

生成授權檔案

進行安裝

開始啟動, 啟動完成就可以登入了

在 phpstorm/jetbrains 系列中整合
這裡我只是在phpstorm 中進行測試的, 但是是支援全系的, 只不過對程式碼部分的支援可能不太完善
配置程式碼審查專案
這裡以 git 作為版本控制
配置基礎資訊

配置程式碼整合

其他兩項的配置根據自己的喜好來進行, 這裡不進行詳細描述. 這樣我們儲存之後他就可以進行對專案初始化.
初始化完成後可以在專案中進行整合了.
安裝 upsource plugin
Settings
-> 搜尋 Plugin
-> Browse repositories
-> 搜尋 upsource
安裝並重啟
關聯專案
重啟之後在設定中搜尋 UpSource
, 在 Connection
選單中填寫 Server Url
為安裝完成訪問的根目錄. 點選 Test Connection
來進行填寫賬號密碼授權, 授權成功後我們便可以在專案中使用了
設定完成後在右下角有個標識代表已經啟動了 Upsource 服務

在這裡我們可以關聯專案, 切換專案, 對映路徑, 配置通知, 更改使用者等資訊

這樣我們就可以在IDE中進行程式碼的review 和標識了. 這裡的標識和 upsource 系統中的顯示的資料是實時同步的. 並且支援 @
某個人.
使用和檢視
這裡的這裡的快捷鍵是 ctrl + alt + /
, 我們選中指定的行, 填寫 review 程式碼

填寫之後就會在 IDE 行號旁邊和編輯區 右上角 顯示評論圖示, 點選即可顯示需要修改的內容, 並高亮指定的區域

同樣在平臺上也會存在這一專案

這裡有幾個技巧
支援 @
來指定人

支援標籤標註

好了, 團隊中開始試用..
其他
錯誤 : 無法將資料儲存到資料庫
Updating project : An error occurred during flushing data to database upsource
這裡記憶體必須在 8G 以上, 否則會報上面的錯誤.
錯誤 : 使用者沒有看到這個專案
一般來講就是沒有把這個使用者新增到所屬專案中.
參考文章
特性 : 支援自定義標籤
這些標籤可以同步到 IDE 中.

特性 : 多使用者賬戶可以歸到一個使用者下進行管理
比如一個使用者有多個git global標識, 可能是不同時期的使用者的暱稱, 這裡可以識別為一個賬戶, 更方便進行管理
