Merge lp:~jelmer/brz/working-with-github into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7208
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/working-with-github
Merge into: lp:brz
Diff against target: 166 lines (+102/-0)
6 files modified
breezy/git/commit.py (+11/-0)
breezy/git/tests/test_repository.py (+14/-0)
doc/en/conf.py (+3/-0)
doc/en/tutorials/index.txt (+1/-0)
doc/en/tutorials/using_breezy_with_github.txt (+71/-0)
doc/index.txt (+2/-0)
To merge this branch: bzr merge lp:~jelmer/brz/working-with-github
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+359156@code.launchpad.net

Commit message

Add support for --fixes in Git repositories and document using Breezy with GitHub.

Description of the change

Add support for --fixes in Git repositories.

Document using Breezy with github.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Aha, finding gaps in functionality while porting documentation, good stuff. See inline comments for things to fix.

review: Approve
lp:~jelmer/brz/working-with-github updated
7208. By Jelmer Vernooij

Review comments.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/commit.py'
2--- breezy/git/commit.py 2018-11-16 18:33:17 +0000
3+++ breezy/git/commit.py 2018-11-22 03:05:25 +0000
4@@ -25,6 +25,7 @@
5 import stat
6
7 from .. import (
8+ bugtracker,
9 config as _mod_config,
10 gpg,
11 osutils,
12@@ -227,6 +228,16 @@
13 else:
14 author = authors[0]
15 c.author = fix_person_identifier(author.encode(encoding))
16+ bugstext = self._revprops.pop('bugs', None)
17+ if bugstext is not None:
18+ message += "\n"
19+ for url, status in bugtracker.decode_bug_urls(bugstext):
20+ if status == bugtracker.FIXED:
21+ message += "Fixes: %s\n" % url
22+ elif status == bugtracker.RELATED:
23+ message += "Bug: %s\n" % url
24+ else:
25+ raise bugtracker.InvalidBugStatus(status)
26 if self._revprops:
27 raise NotImplementedError(self._revprops)
28 c.commit_time = int(self._timestamp)
29
30=== modified file 'breezy/git/tests/test_repository.py'
31--- breezy/git/tests/test_repository.py 2018-11-16 12:25:18 +0000
32+++ breezy/git/tests/test_repository.py 2018-11-22 03:05:25 +0000
33@@ -250,6 +250,20 @@
34 revprops={'authors': 'Joe Example <joe@example.com>\n'
35 'Jane Doe <jane@example.com\n>'})
36
37+ def test_bugs(self):
38+ wt = self.make_branch_and_tree('.', format='git')
39+ revid = wt.commit(
40+ "base", allow_pointless=True,
41+ revprops={
42+ 'bugs': 'https://github.com/jelmer/dulwich/issues/123 fixed\n'
43+ })
44+ rev = wt.branch.repository.get_revision(revid)
45+ r = dulwich.repo.Repo('.')
46+ self.assertEqual(
47+ b'base\n'
48+ b'Fixes: https://github.com/jelmer/dulwich/issues/123\n',
49+ r[r.head()].message)
50+
51
52 class GitRepositoryFormat(tests.TestCase):
53
54
55=== modified file 'doc/en/conf.py'
56--- doc/en/conf.py 2018-11-18 19:48:57 +0000
57+++ doc/en/conf.py 2018-11-22 03:05:25 +0000
58@@ -66,6 +66,9 @@
59 brz_title(u'Breezy in five minutes'), brz_team, 'howto'),
60 ('tutorials/tutorial', 'brz-%s-tutorial' % (brz_locale,),
61 brz_title(u'Breezy Tutorial'), brz_team, 'howto'),
62+ ('tutorials/using_breezy_with_github',
63+ 'brz-%s-tutorial-with-github' % (brz_locale,),
64+ brz_title(u'Using Breezy With GitHub'), brz_team, 'howto'),
65 ('tutorials/using_breezy_with_launchpad',
66 'brz-%s-tutorial-with-launchpad' % (brz_locale,),
67 brz_title(u'Using Breezy With Launchpad'), brz_team, 'howto'),
68
69=== modified file 'doc/en/tutorials/index.txt'
70--- doc/en/tutorials/index.txt 2017-05-21 13:35:49 +0000
71+++ doc/en/tutorials/index.txt 2018-11-22 03:05:25 +0000
72@@ -6,6 +6,7 @@
73
74 ../mini-tutorial/index
75 tutorial
76+ using_breezy_with_github
77 using_breezy_with_launchpad
78 centralized_workflow
79 licence
80
81=== added file 'doc/en/tutorials/using_breezy_with_github.txt'
82--- doc/en/tutorials/using_breezy_with_github.txt 1970-01-01 00:00:00 +0000
83+++ doc/en/tutorials/using_breezy_with_github.txt 2018-11-22 03:05:25 +0000
84@@ -0,0 +1,71 @@
85+========================
86+Using Breezy with GitHub
87+========================
88+
89+GitHub: the largest code-hosting site
90+-------------------------------------
91+
92+This tutorial looks at how Breezy and GitHub can be used together.
93+
94+Accessing code in GitHub using Breezy
95+========================================
96+
97+Getting the code for a project
98+------------------------------
99+
100+Breezy users can grab code from GitHub using regular GitHub URLs:
101+
102+ brz branch git://github.com/owner/name
103+
104+where `owner` is the name of the owner and `name` is the repository name. Here are some examples::
105+
106+ brz branch https://github.com/inkscape/inkscape
107+ brz branch git://github.com/KDE/amarok
108+ brz branch https://github.com/python/cpython
109+
110+You can then browse the code locally using your favorite editor or IDE and
111+change the code if you wish.
112+
113+To access a non-default branch, specify the 'branch' segment parameter::
114+
115+ brz branch https://github.com/inkscape/inkscape,branch=backports
116+
117+Publishing your changes
118+-----------------------
119+
120+Having fixed that annoying bug or added that cool feature you've always
121+wanted, it's time to impress your friends and make the world a better
122+place by making your code available to others. As explained earlier,
123+GitHub is a code hosting service so you can push your
124+branch to it and others can access your code from there.
125+
126+In the GitHub web UI, you can create a "fork" of an upstream repository. For
127+example, if user "jelmer" forked the inkscape repository at
128+https://github.com/inkscape/inkscape then the fork would be at
129+https://github.com/jelmer/inkscape.
130+
131+You can then push your changes to a branch like this::
132+
133+ brz push git+ssh://github.com/jelmer/inkscape,branch=my-branch
134+
135+Others can then download your code like this::
136+
137+ brz branch git://github.com/jelmer/inkscape,branch=my-branch
138+
139+
140+Associating branches with GitHub issues
141+---------------------------------------
142+
143+The standard Breezy bugtracking functionality can also be used for GitHub
144+issues.
145+
146+When you commit using Breezy, use the --fixes option like this::
147+
148+ brz commit --fixes github:inkscape/inkscape/1234
149+
150+where 1234 is the bug ID. This will add some metadata to the commit message.
151+
152+You can also define a short name for a specific project, by adding an alias for
153+a project. For example, to add an alias for dulwich::
154+
155+ brz config bugtracker_dulwich_url=https://github.com/dulwich/dulwich/issues/{id}
156
157=== modified file 'doc/index.txt'
158--- doc/index.txt 2018-11-19 22:05:30 +0000
159+++ doc/index.txt 2018-11-22 03:05:25 +0000
160@@ -31,6 +31,8 @@
161
162 * `Using Breezy with Launchpad <en/tutorials/using_breezy_with_launchpad.html>`_
163
164+* `Using Breezy with GitHub <en/tutorials/using_breezy_with_github.html>`_
165+
166 * `Centralized workflow <en/tutorials/centralized_workflow.html>`_
167
168

Subscribers

People subscribed via source and target branches