git子委员会将与phabricator集成
git-phab的Python项目详细描述
安装
安装依赖项并将可执行文件复制或符号链接到$path中
$ pip3 install -r requirements.txt $ ln -s $PWD/git-phab ~/.local/bin/
可选择生成manpage并将其复制或符号链接到$manpath中
$ a2x --doctype manpage --format manpage git-phab.txt $ ln -s $PWD/git-phab.1 ~/.local/share/man/man1/
可选启用bash完成:
$ sudo activate-global-python-argcomplete3
并将其添加到您的~/.bash_完成:
function _git_phab() { COMP_WORDS=(git-phab ${COMP_WORDS[@]:2}) COMP_CWORD=$((COMP_CWORD - 1)) COMP_LINE=${COMP_LINE/git phab/git-phab} _python_argcomplete_global git-phab }
要求
参见requirements.txt
说明
git子命令与phabricator集成。
工作流示例
首先,指定一个个人远程存储库,在其中推送WIP分支:
$ git config phab.remote xclaesse
确保存储库的获取url可以由 评论员。例如,如果您的遥控器名为github:
$ git remote show github | grep URL Fetch URL: git@github.com:NICK/PROJECT.git Push URL: git@github.com:NICK/PROJECT.git $ git remote set-url github https://github.com/NICK/PROJECT.git $ git remote set-url --push github git@github.com:NICK/PROJECT.git $ git remote show github | grep URL Fetch URL: https://github.com/NICK/PROJECT.git Push URL: git@github.com:NICK/PROJECT.git
开始工作前,请创建一个分支:
$ git checkout -b fix-bugs origin/master Branch fix-bugs set up to track remote branch master from origin. Switched to a new branch 'fix-bugs'
注意,设置跟踪远程分支git phab很重要 将使用它设置要附加的默认提交范围。
现在修复您的错误…
当分支准备好审查时,附加它(请求创建 新任务的数量):
$ git phab attach --task Using revision range 'origin/master..' a3beba9 — Not attached — Truncate all_commits when filtering already proposed commits Attach above commits and create a new task? [yn] y (...) Push HEAD to xclaesse/wip/phab/T3436-fix-bugs? [yn] y Create and checkout a new branch called: T3436-fix-bugs? [yn] y Summary: New: task T3436 New: 66b48b9 — D483 — Truncate all_commits when filtering already proposed commits Branch pushed to xclaesse/wip/phab/T3436-fix-bugs Branch T3436-fix-bugs created and checked out
请注意,当前分支名称不是以任务ID开头的,因此 提议创建一个新的。如果你已经有任务了,就 传递--task选项。但它创建了一个以 任务ID,以便将来的git phab命令知道此分支的任务 指:
$ git branch * T3436-fix-bugs fix-bugs master
当您的提交被接受时,将它们合并:
$ git checkout master $ git merge T3436-fix-bugs $ git phab land 66b48b9 — D483 Accepted — Truncate all_commits when filtering already proposed commits Do you want to push above commits? [yn] y Do you want to close 'T3436'? [yn] y
现在您可以清理分支:
$ git phab clean Task 'T3436' has been closed, do you want to delete branch 'T3436-fix-bugs'? [yn] y -> Branch T3436-fix-bugs was deleted Task 'T3436' has been closed, do you want to delete branch 'xclaesse/wip/phab/T3436-fix-a-bug'? [yn] y -> Branch xclaesse/wip/phab/T3436-fix-a-bug was deleted
如何设置项目
首先,需要向项目中添加.arcconfig。 储存库。此文件与 arcanist 你应该跟着他们的Configuring a New Project 设置写入配置文件的文档。