summaryrefslogtreecommitdiff
path: root/README.md
blob: 60c51779746f85bf0cb912e72ea4eb6edad984aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
INSTALL
=======

```
    $ pip3 install git-phab
    $ pip3 install --upgrade git-phab
    $ pip3 uninstall git-phab
```

Optionaly generate and copy or symlink manpage into your $MANPATH

```
  $ a2x --doctype manpage --format manpage git-phab.txt
  $ ln -s $PWD/git-phab.1 ~/.local/share/man/man1/
```

Optionaly enable bash completion:

```
  $ sudo activate-global-python-argcomplete3
```

And add this in your ~/.bash_completion:

```
  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
============

 - pip3 install GitPython
 - pip3 install appdirs
 - pip3 install argcomplete
 - arcanist

DESCRIPTION
===========

Git subcommand to integrate with phabricator.

WORKFLOW EXAMPLE
================

First, configure where to push WIP branches:

```
  $ git config phab.remote xclaesse
```

Before starting your work, create a branch:

```
  $ 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'
```

Note that is it important to set the tracking remote branch, git-phab will use
it to set the default commit range to attach.

Now fix your bugs...

When the branch is ready for review, attach it (requesting the creation of a
new task):

```
  $ 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
```

Note that the current branch name wasn't starting with a task ID, so it proposed
to create a new one. If you already had a task for it, just pass `--task`
option. But it created a new branch prefixed with the task ID so future git-phab
commands will know which task this branch refers to:

```
  $ git branch
  * T3436-fix-bugs
    fix-bugs
    master
```

When your commits have been accepted, merge them:


```
  $ 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
```

You can now cleanup your branches:

```
  $ 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
```