phabricator 工作流程:
- 本地基于分支管理代码 git branch xxx / git add - -all / git commit -am “xxx”
- 提交 arc diff,这个 diff 是从该分支的 HEAD 到某一个commit(甚至是其他分支)之间的 diff range(见下文),然后会在网页端做 code review
- 当 code review 通过之后,你可以将被通过的分支的 HEAD 提交。你可以提交到远端对应分支,也可以提交到其他分支,这取决于你 git push 的配置, see link .
- 好像提交哪个 diff range 跟你是否可以 push 没有直接关系,只要你提交的diff range 在 code review 中被通过了,你就允许 push 该分支到服务器。push 到哪个分支是 git push 设置规定的,跟code review 没关系。
phabricator 的 arc diff
是提交你的所有修改。默认的 diff range 是:
从git merge-base origin/master HEAD
到 HEAD
之间 (HEAD
永远指向你分支的tip)
也就是将你所有还没有push的commit作为个diff range提交。
关于 merge-base:
Given two commits A and B, git merge-base A B will output a commit which is reachable from both A and B through the parent relationship.
For example, with this topology:
o---o---o---B
/
---o---1---o---o---o---A
the merge base between A and B is 1.
如果当前工作空间相是对于某个分支(gravity)做了修改,用户想提交当前 working space 相对于 gravity 分支的 diff, 而不是当前 working space 相对于 master 的 diff,该怎么做?
命令:
arc diff gravity // or HEAD^ 如果已经切换到了gravity 分支
// or arc diff --base 参数
arc diff --base 'arc:upstream, git:HEAD^' // Diff against the upstream if it exists, or just use the last commit if it doesn't.
// 或者在匹配远端分支失败的情况下提示用户输入
arc diff --base 'arc:upstream, arc:prompt'
// or 配置一下,默认如下为(origin/master),你可以配置merge-base到你想要的分支
arc set-config base 'git:merge-base(origin/master)'
运行 arc which 可以看到详情,例如:
If you run 'arc diff', changes between the commit:
xxxxxxxxxx bug fix and use new lib
...and the current working copy state will be sent to Differential, because
it is the merge-base of 'origin/master' (the Git upstream of the current
branch) HEAD.
正常 arc 的 workflow:
see link: https://secure.phabricator.com/w/guides/arcanist_workflows/
reference see link:
关于diff:https://secure.phabricator.com/book/phabricator/article/arcanist_diff/
关于 diff ranges: https://secure.phabricator.com/book/phabricator/article/arcanist_commit_ranges/
http://stackoverflow.com/questions/19819252/can-you-arc-diff-against-a-particular-git-branch
http://stackoverflow.com/questions/32128072/what-are-the-differences-between-arc-feature-branch-name-and-git-branch-branc
家里小厂,占个坑: www.herofireworks.com