Merge lp:~abentley/charms/precise/juju-reports/local-pull into lp:~juju-qa/charms/precise/juju-reports/trunk

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

Commit message

Avoid overwriting source by pulling with --local.

Description of the change

I introduced branch binding to make committing easier when developing in a local deploy. Unfortunately, this also affects pull. It means that the pull performed by the charm can overwrite the contents of the current bound branch with the contents of the target branch.

This change ensures that pulls are local, so they do not overwrite the bound-to branch. In order to use --local, the branch must be bound, so "bzr bind" is issued before "bzr pull". Even though the branch is bound to the pulled-from branch, --local is used so that setting the revno does not remove revisions from the pulled-from branch.

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-07-08 20:55:54 +0000
3+++ hooks/common.py 2014-07-11 14:02:58 +0000
4@@ -110,15 +110,16 @@
5
6
7 def update_source(source_url, revno):
8+ # Make it easier to develop on a deploy
9+ call_bzr(['bind', '-d', PROJECT_DIR, source_url])
10+
11 # Grab the code
12 revno = 'revno:%s' % revno
13+
14 bzr_cmd = ['pull', '--overwrite', source_url, '-r', revno, '-d',
15- PROJECT_DIR, '--remember']
16+ PROJECT_DIR, '--remember', '--local']
17 call_bzr(bzr_cmd)
18
19- # Make it easier to develop on a deploy
20- call_bzr(['bind', '-d', PROJECT_DIR, source_url])
21-
22 # Restore the templates if they are missing/altered.
23 call_bzr(['revert', os.path.join(PROJECT_DIR, 'resources')])
24

Subscribers

People subscribed via source and target branches

to all changes: