Merge lp:~stub/codetree/git-submodules into lp:codetree

Proposed by Stuart Bishop
Status: Merged
Approved by: Stuart Bishop
Approved revision: 115
Merged at revision: 109
Proposed branch: lp:~stub/codetree/git-submodules
Merge into: lp:codetree
Prerequisite: lp:~stub/codetree/embed-six
Diff against target: 66 lines (+14/-8)
4 files modified
codetree/config.py (+4/-4)
codetree/handlers/charm.py (+2/-3)
codetree/handlers/git.py (+7/-0)
tests/test_config.py (+1/-1)
To merge this branch: bzr merge lp:~stub/codetree/git-submodules
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Canonical IS Reviewers Pending
Review via email: mp+381884@code.launchpad.net

Commit message

Expand git submodules on clone and update

Description of the change

For mojo to deploy operator framework charms from git branches, we need to expand embedded git submodules.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

lp:~stub/codetree/git-submodules updated
115. By Stuart Bishop

delint

Revision history for this message
Tom Haddon (mthaddon) wrote :

LGTM, thx

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 109

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'codetree/config.py'
2--- codetree/config.py 2020-04-08 09:59:03 +0000
3+++ codetree/config.py 2020-04-08 09:59:03 +0000
4@@ -159,12 +159,12 @@
5 if parent in self.tree:
6 self.tree[parent].append(child)
7 elif os.path.isdir(parent):
8- logging.warn("Parent directory {} is not specified ".format(parent) +
9- "in the configuration, using existing directory")
10+ logging.warn("Parent directory {} is not specified "
11+ "in the configuration, using existing directory".format(parent))
12 self.tree[''].append(child)
13 else:
14- raise InvalidDirective("Parent directory {} ".format(parent) +
15- "does not exist and is not in the configuration")
16+ raise InvalidDirective("Parent directory {} "
17+ "does not exist and is not in the configuration".format(parent))
18 # Add my list of children
19 self.tree[child] = []
20
21
22=== modified file 'codetree/handlers/charm.py'
23--- codetree/handlers/charm.py 2020-04-08 09:59:03 +0000
24+++ codetree/handlers/charm.py 2020-04-08 09:59:03 +0000
25@@ -169,9 +169,8 @@
26 # Verify SHA
27 expected_sha = req.headers['Content-Sha384']
28 if calculated_sha != expected_sha:
29- raise requests.HTTPError("SHA of downloaded charm {} didn't match " +
30- "expected SHA {}".format(calculated_sha,
31- expected_sha))
32+ raise requests.HTTPError("SHA of downloaded charm {} didn't match "
33+ "expected SHA {}".format(calculated_sha, expected_sha))
34
35 return zip_path
36
37
38=== modified file 'codetree/handlers/git.py'
39--- codetree/handlers/git.py 2020-04-08 09:59:03 +0000
40+++ codetree/handlers/git.py 2020-04-08 09:59:03 +0000
41@@ -105,6 +105,13 @@
42 else:
43 logging.info("Repository {} at revision {}".format(dest, revision))
44
45+ # Update submodules
46+ if not log_failure(
47+ self._git_cmd(dest, 'submodule', 'update', '--init', '--recursive'),
48+ 'Updating submodules in repository {}'.format(dest),
49+ ):
50+ return result
51+
52 result.success = True
53 result.revision = revision
54 return result
55
56=== modified file 'tests/test_config.py'
57--- tests/test_config.py 2020-04-08 09:59:03 +0000
58+++ tests/test_config.py 2020-04-08 09:59:03 +0000
59@@ -115,7 +115,7 @@
60 os.mkdir('dir')
61 with mock.patch('logging.warn') as mock_log:
62 conf = Config(test_filename)
63- mock_log.assert_called_once_with("Parent directory dir is not specified " +
64+ mock_log.assert_called_once_with("Parent directory dir is not specified "
65 "in the configuration, using existing directory")
66 assert 'dir/subdir' in conf.tree['']
67

Subscribers

People subscribed via source and target branches