Merge lp:~abentley/charms/precise/juju-reports/bind-branch into lp:~juju-qa/charms/precise/juju-reports/trunk

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 33
Proposed branch: lp:~abentley/charms/precise/juju-reports/bind-branch
Merge into: lp:~juju-qa/charms/precise/juju-reports/trunk
Diff against target: 35 lines (+13/-5)
1 file modified
hooks/common.py (+13/-5)
To merge this branch: bzr merge lp:~abentley/charms/precise/juju-reports/bind-branch
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+223574@code.launchpad.net

Commit message

Bind the branch when updating source code.

Description of the change

This updates the charm to bind the local branch to the remote branch, so that commits go to the remote branch. This is helpful for development. I already bind the branch on my deploy, but this ensures it's properly updated every time.

It also centralizes bzr calls, and ensures that --no-aliases is used, which is a best practice.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/common.py'
2--- hooks/common.py 2014-06-06 14:16:14 +0000
3+++ hooks/common.py 2014-06-18 14:29:13 +0000
4@@ -100,18 +100,26 @@
5 with open_secret(ubuntu_path, pwd.pw_uid, pwd.pw_gid) as key_file:
6 key_file.write(ssh_key)
7 # Login to LP
8- subprocess.check_call(['bzr', 'lp-login', 'juju-qa-bot'])
9+ call_bzr(['lp-login', 'juju-qa-bot'])
10+
11+
12+def call_bzr(args):
13+ args = ['bzr', '--no-aliases'] + args
14+ return subprocess.check_call(args)
15
16
17 def update_source(source_url, revno):
18 # Grab the code
19 revno = 'revno:%s' % revno
20- bzr_cmd = ['bzr', 'pull', '--overwrite', source_url, '-r', revno, '-d',
21+ bzr_cmd = ['pull', '--overwrite', source_url, '-r', revno, '-d',
22 PROJECT_DIR, '--remember']
23- subprocess.check_call(bzr_cmd)
24+ call_bzr(bzr_cmd)
25+
26+ # Make it easier to develop on a deploy
27+ call_bzr(['bind', '-d', PROJECT_DIR, source_url])
28+
29 # Restore the templates if they are missing/altered.
30- subprocess.check_call(['bzr', 'revert',
31- os.path.join(PROJECT_DIR, 'resources')])
32+ call_bzr(['revert', os.path.join(PROJECT_DIR, 'resources')])
33
34
35 def install_production(dist_clean):

Subscribers

People subscribed via source and target branches

to all changes: