Merge lp:~jelmer/brz/merge-3.1 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/merge-3.1
Merge into: lp:brz
Diff against target: 275 lines (+130/-23)
8 files modified
README.rst (+2/-2)
breezy/git/config.py (+46/-3)
breezy/git/tests/test_blackbox.py (+31/-0)
breezy/library_state.py (+5/-3)
breezy/plugins/propose/gitlabs.py (+9/-2)
breezy/tests/test_library_state.py (+12/-0)
doc/en/release-notes/brz-3.1.txt (+6/-0)
doc/en/tutorials/using_breezy_with_github.txt (+19/-13)
To merge this branch: bzr merge lp:~jelmer/brz/merge-3.1
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+381004@code.launchpad.net

Commit message

Merge lp:brz/3.1.

Description of the change

Merge lp:brz/3.1.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.rst'
--- README.rst 2019-02-11 20:37:27 +0000
+++ README.rst 2020-03-22 01:38:36 +0000
@@ -18,8 +18,8 @@
18Breezy is a friendly fork of the Bazaar (``bzr``) project, hosted on18Breezy is a friendly fork of the Bazaar (``bzr``) project, hosted on
19http://bazaar.canonical.com/. It is backwards compatibility with19http://bazaar.canonical.com/. It is backwards compatibility with
20Bazaar's disk format and protocols. One of the key differences with20Bazaar's disk format and protocols. One of the key differences with
21Bazaar is that Breezy also runs on Python 3.3 and later, in addition to21Bazaar is that Breezy runs on Python 3.3 and later, rather than on
22Python 2.7.22Python 2.
2323
24Breezy highlights24Breezy highlights
25=================25=================
2626
=== modified file 'breezy/git/config.py'
--- breezy/git/config.py 2020-02-18 01:57:45 +0000
+++ breezy/git/config.py 2020-03-22 01:38:36 +0000
@@ -44,19 +44,62 @@
44 return self._get_best_value('_get_user_id')44 return self._get_best_value('_get_user_id')
4545
4646
47class GitConfigSectionDefault(config.Section):
48 """The "default" config section in git config file"""
49
50 def __init__(self, config):
51 self._config = config
52
53 def get(self, name, default=None, expand=True):
54 if name == 'email':
55 try:
56 email = self._config.get((b'user', ), b'email')
57 except KeyError:
58 return None
59 try:
60 name = self._config.get((b'user', ), b'name')
61 except KeyError:
62 return email.decode()
63 return '%s <%s>' % (name.decode(), email.decode())
64 if name == 'gpg_signing_key':
65 try:
66 key = self._config.get((b'user', ), b'signingkey')
67 except KeyError:
68 return None
69 return key.decode()
70 return None
71
72
73class GitConfigStore(config.Store):
74 """Store that uses gitconfig."""
75
76 def __init__(self, config):
77 self._config = config
78
79 def get_sections(self):
80 return [
81 (self, GitConfigSectionDefault(self._config)),
82 ]
83
84
47class GitBranchStack(config._CompatibleStack):85class GitBranchStack(config._CompatibleStack):
48 """GitBranch stack."""86 """GitBranch stack."""
4987
50 def __init__(self, branch):88 def __init__(self, branch):
89 section_getters = [self._get_overrides]
51 lstore = config.LocationStore()90 lstore = config.LocationStore()
52 loc_matcher = config.LocationMatcher(lstore, branch.base)91 loc_matcher = config.LocationMatcher(lstore, branch.base)
92 section_getters.append(loc_matcher.get_sections)
53 # FIXME: This should also be looking in .git/config for93 # FIXME: This should also be looking in .git/config for
54 # local git branches.94 # local git branches.
95 git = getattr(branch.repository, '_git', None)
96 if git:
97 cstore = GitConfigStore(git.get_config())
98 section_getters.append(cstore.get_sections)
55 gstore = config.GlobalStore()99 gstore = config.GlobalStore()
100 section_getters.append(gstore.get_sections)
56 super(GitBranchStack, self).__init__(101 super(GitBranchStack, self).__init__(
57 [self._get_overrides,102 section_getters,
58 loc_matcher.get_sections,
59 gstore.get_sections],
60 # All modifications go to the corresponding section in103 # All modifications go to the corresponding section in
61 # locations.conf104 # locations.conf
62 lstore, branch.base)105 lstore, branch.base)
63106
=== modified file 'breezy/git/tests/test_blackbox.py'
--- breezy/git/tests/test_blackbox.py 2020-02-18 01:57:45 +0000
+++ breezy/git/tests/test_blackbox.py 2020-03-22 01:38:36 +0000
@@ -424,6 +424,37 @@
424 self.assertEqual(out, '')424 self.assertEqual(out, '')
425 self.assertTrue(err.endswith, '3 objects\n')425 self.assertTrue(err.endswith, '3 objects\n')
426426
427 def test_local_whoami(self):
428 r = GitRepo.init("gitr", mkdir=True)
429 self.build_tree_contents([('gitr/.git/config', """\
430[user]
431 email = some@example.com
432 name = Test User
433""")])
434 out, err = self.run_bzr(["whoami", "-d", "gitr"])
435 self.assertEqual(out, "Test User <some@example.com>\n")
436 self.assertEqual(err, "")
437
438 self.build_tree_contents([('gitr/.git/config', """\
439[user]
440 email = some@example.com
441""")])
442 out, err = self.run_bzr(["whoami", "-d", "gitr"])
443 self.assertEqual(out, "some@example.com\n")
444 self.assertEqual(err, "")
445
446 def test_local_signing_key(self):
447 r = GitRepo.init("gitr", mkdir=True)
448 self.build_tree_contents([('gitr/.git/config', """\
449[user]
450 email = some@example.com
451 name = Test User
452 signingkey = D729A457
453""")])
454 out, err = self.run_bzr(["config", "-d", "gitr", "gpg_signing_key"])
455 self.assertEqual(out, "D729A457\n")
456 self.assertEqual(err, "")
457
427458
428class ShallowTests(ExternalBase):459class ShallowTests(ExternalBase):
429460
430461
=== modified file 'breezy/library_state.py'
--- breezy/library_state.py 2020-02-18 01:57:45 +0000
+++ breezy/library_state.py 2020-03-22 01:38:36 +0000
@@ -98,8 +98,9 @@
98 self._trace.__enter__()98 self._trace.__enter__()
9999
100 self._orig_ui = breezy.ui.ui_factory100 self._orig_ui = breezy.ui.ui_factory
101 breezy.ui.ui_factory = self._ui101 if self._ui is not None:
102 self._ui.__enter__()102 breezy.ui.ui_factory = self._ui
103 self._ui.__enter__()
103104
104 if breezy._global_state is not None:105 if breezy._global_state is not None:
105 raise RuntimeError("Breezy already initialized")106 raise RuntimeError("Breezy already initialized")
@@ -115,7 +116,8 @@
115 trace._flush_stdout_stderr()116 trace._flush_stdout_stderr()
116 trace._flush_trace()117 trace._flush_trace()
117 osutils.report_extension_load_failures()118 osutils.report_extension_load_failures()
118 self._ui.__exit__(None, None, None)119 if self._ui is not None:
120 self._ui.__exit__(None, None, None)
119 self._trace.__exit__(None, None, None)121 self._trace.__exit__(None, None, None)
120 ui.ui_factory = self._orig_ui122 ui.ui_factory = self._orig_ui
121 breezy._global_state = None123 breezy._global_state = None
122124
=== modified file 'breezy/plugins/propose/gitlabs.py'
--- breezy/plugins/propose/gitlabs.py 2020-03-07 15:47:50 +0000
+++ breezy/plugins/propose/gitlabs.py 2020-03-22 01:38:36 +0000
@@ -97,6 +97,10 @@
97 self.error = error97 self.error = error
9898
9999
100class MergeRequestExists(Exception):
101 """Raised when a merge requests already exists."""
102
103
100def default_config_path():104def default_config_path():
101 return os.path.join(bedding.config_dir(), 'gitlab.conf')105 return os.path.join(bedding.config_dir(), 'gitlab.conf')
102106
@@ -401,7 +405,7 @@
401 if response.status == 403:405 if response.status == 403:
402 raise errors.PermissionDenied(response.text)406 raise errors.PermissionDenied(response.text)
403 if response.status == 409:407 if response.status == 409:
404 raise MergeProposalExists(self.source_branch.user_url)408 raise MergeRequestExists()
405 if response.status != 201:409 if response.status != 201:
406 raise errors.InvalidHttpResponse(path, response.text)410 raise errors.InvalidHttpResponse(path, response.text)
407 return json.loads(response.data)411 return json.loads(response.data)
@@ -616,7 +620,10 @@
616 else:620 else:
617 user = self.gl._get_user(reviewer)621 user = self.gl._get_user(reviewer)
618 kwargs['assignee_ids'].append(user['id'])622 kwargs['assignee_ids'].append(user['id'])
619 merge_request = self.gl._create_mergerequest(**kwargs)623 try:
624 merge_request = self.gl._create_mergerequest(**kwargs)
625 except MergeRequestExists:
626 raise ProposalExists(self.source_branch.user_url)
620 return GitLabMergeProposal(self.gl, merge_request)627 return GitLabMergeProposal(self.gl, merge_request)
621628
622629
623630
=== modified file 'breezy/tests/test_library_state.py'
--- breezy/tests/test_library_state.py 2017-08-27 13:57:26 +0000
+++ breezy/tests/test_library_state.py 2020-03-22 01:38:36 +0000
@@ -52,3 +52,15 @@
52 finally:52 finally:
53 state.__exit__(None, None, None)53 state.__exit__(None, None, None)
54 self.assertEqual(['__enter__', '__exit__'], tracer._calls)54 self.assertEqual(['__enter__', '__exit__'], tracer._calls)
55
56 def test_ui_not_specified(self):
57 self.overrideAttr(breezy, '_global_state', None)
58 state = library_state.BzrLibraryState(
59 ui=None, trace=fixtures.RecordingContextManager())
60 orig_ui = _mod_ui.ui_factory
61 state.__enter__()
62 try:
63 self.assertEqual(orig_ui, _mod_ui.ui_factory)
64 finally:
65 state.__exit__(None, None, None)
66 self.assertEqual(orig_ui, _mod_ui.ui_factory)
5567
=== modified file 'doc/en/release-notes/brz-3.1.txt'
--- doc/en/release-notes/brz-3.1.txt 2020-02-08 17:00:10 +0000
+++ doc/en/release-notes/brz-3.1.txt 2020-03-22 01:38:36 +0000
@@ -114,6 +114,9 @@
114 * Python 3 is now used by default to run scripts, etc. from the makefile.114 * Python 3 is now used by default to run scripts, etc. from the makefile.
115 (Jelmer Vernooij)115 (Jelmer Vernooij)
116116
117 * ``.git/config`` is now consulted to determine the users' identity
118 for commits, and the gpg_signing_key. (Jelmer Vernooij)
119
117Bug Fixes120Bug Fixes
118*********121*********
119122
@@ -148,6 +151,9 @@
148* Ignore ghost tags when interacting with remote Git repositories.151* Ignore ghost tags when interacting with remote Git repositories.
149 (Jelmer Vernooij)152 (Jelmer Vernooij)
150153
154* Fix ``setup_ui=False`` when initializing Breezy.
155 (Jelmer Vernooij, #1852647)
156
151Documentation157Documentation
152*************158*************
153159
154160
=== modified file 'doc/en/tutorials/using_breezy_with_github.txt'
--- doc/en/tutorials/using_breezy_with_github.txt 2018-11-22 03:04:59 +0000
+++ doc/en/tutorials/using_breezy_with_github.txt 2020-03-22 01:38:36 +0000
@@ -39,19 +39,25 @@
39GitHub is a code hosting service so you can push your39GitHub is a code hosting service so you can push your
40branch to it and others can access your code from there.40branch to it and others can access your code from there.
4141
42In the GitHub web UI, you can create a "fork" of an upstream repository. For42The first time you use GitHub, you will need to log into to your GitHub account
43example, if user "jelmer" forked the inkscape repository at43with Breezy. This can be done by running ``brz github-login``. This will prompt
44https://github.com/inkscape/inkscape then the fork would be at44you for your password, and store the authentication token in ~/.config/breezy.
45https://github.com/jelmer/inkscape.45
4646You can now use either ``brz publish`` to upload the changes back to
47You can then push your changes to a branch like this::47GitHub, or ``brz propose`` to upload to the changes to GitHub and
4848create merge proposal.
49 brz push git+ssh://github.com/jelmer/inkscape,branch=my-branch49
5050Both ``brz publish`` and ``brz propose`` will create a fork of the upstream
51Others can then download your code like this::51repository and then push your local changes to the active branch
5252(or another branch specify with the --name argument).
53 brz branch git://github.com/jelmer/inkscape,branch=my-branch53
5454For example, running ``brz publish --name=my-branch`` in your local inkscape
55clone will create https://github.com/jelmer/inkscape if your GitHub username is
56"jelmer", and it will open your editor to allow you to enter the merge proposal
57description.
58
59Subsequent use of ``brz publish`` in the local branch (e.g. to push more
60commits) will update the previously created branch.
5561
56Associating branches with GitHub issues62Associating branches with GitHub issues
57---------------------------------------63---------------------------------------

Subscribers

People subscribed via source and target branches