Merge lp:~quickly-committers/quickly/702153 into lp:quickly

Proposed by Michael Terry
Status: Needs review
Proposed branch: lp:~quickly-committers/quickly/702153
Merge into: lp:quickly
Diff against target: 89 lines (+48/-3)
3 files modified
quickly/builtincommands.py (+10/-1)
quickly/templatetools.py (+23/-2)
quickly/test/quickly.sh (+15/-0)
To merge this branch: bzr merge lp:~quickly-committers/quickly/702153
Reviewer Review Type Date Requested Status
Tony Byrne Needs Fixing
Review via email: mp+67048@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tony Byrne (tony-badwolf) wrote :

Hi Michael
 I looked at this quite a while ago and couldn't make up my mind if is was a bug or not. We will agree it is a bug because it generates a false error message.

 If the derived template was produced by an earlier version of quickly we would like to call upgrade on the project. Quickly marks *all* projects for upgrade that are created from derived templates, probably because it is difficult to discover which version of quickly produced the template.

templatetools contains the comment
# initialize with an empty project version to force first upgrade

Calling upgrade fails for templates produced by version 11.04 because it expects old code to be present in the project. I added a patch to https://bugs.launchpad.net/quickly/+bug/702153 which seems to directly address the problem.

I've marked this branch as needs fixing because I suspect that it will skip upgrade for old templates in ~/quickly-templates. I don't have a codebase to be sure.

review: Needs Fixing
Revision history for this message
Michael Terry (mterry) wrote :

OK, I applied your patch from the bug. I guess that means this branch is no longer quite needed? I can close it out if so.

Unmerged revisions

622. By Michael Terry

when creating a project, record version of parent templates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'quickly/builtincommands.py'
--- quickly/builtincommands.py 2010-11-29 15:18:46 +0000
+++ quickly/builtincommands.py 2011-07-06 14:29:39 +0000
@@ -63,9 +63,18 @@
63 os.mkdir(project_name)63 os.mkdir(project_name)
6464
65 # creating quickly file65 # creating quickly file
66 configurationhandler.project_config['version'] = quicklyconfig.__version__
67 configurationhandler.project_config['project'] = project_name66 configurationhandler.project_config['project'] = project_name
68 configurationhandler.project_config['template'] = project_template67 configurationhandler.project_config['template'] = project_template
68
69 # Set version for this template and all parent templates too
70 version = templatetools.get_template_version(project_template)
71 configurationhandler.project_config['version'] = version
72 parent = templatetools.get_parent_template(project_template)
73 while parent:
74 version = templatetools.get_template_version(parent)
75 configurationhandler.project_config['version_%s' % parent] = version
76 parent = templatetools.get_parent_template(parent)
77
69 configurationhandler.saveConfig(config_file_path=project_name)78 configurationhandler.saveConfig(config_file_path=project_name)
70 79
71 os.chdir(project_name)80 os.chdir(project_name)
7281
=== modified file 'quickly/templatetools.py'
--- quickly/templatetools.py 2011-06-06 10:14:40 +0000
+++ quickly/templatetools.py 2011-07-06 14:29:39 +0000
@@ -150,8 +150,22 @@
150 return True150 return True
151 return False151 return False
152152
153def get_project_and_template_versions(template_name):153def get_parent_template(template_name):
154 """Return project and template version"""154 """Return name of parent template or None"""
155
156 try:
157 template_path = tools.get_template_directory(template_name)
158 config = file(os.path.join(template_path, 'commandsconfig'), 'rb').read()
159 re_result = re.search('^\[(.*)\]$', config, re.MULTILINE)
160 if re_result:
161 return re_result.group(1)
162 else:
163 return None
164 except Exception:
165 return None
166
167def get_template_version(template_name):
168 """Return template version"""
155169
156 # take template version. Default is current Quickly version170 # take template version. Default is current Quickly version
157 template_version = quicklyconfig.__version__171 template_version = quicklyconfig.__version__
@@ -167,6 +181,13 @@
167 if targeted_property == 'TEMPLATE_VERSION':181 if targeted_property == 'TEMPLATE_VERSION':
168 template_version = value182 template_version = value
169 break183 break
184
185 return template_version
186
187def get_project_and_template_versions(template_name):
188 """Return project and template version"""
189
190 template_version = get_template_version(template_name)
170 191
171 # get current project version for this template. Default is no migration (ie take current version)192 # get current project version for this template. Default is no migration (ie take current version)
172 configurationhandler.loadConfig()193 configurationhandler.loadConfig()
173194
=== modified file 'quickly/test/quickly.sh'
--- quickly/test/quickly.sh 2011-03-02 22:59:32 +0000
+++ quickly/test/quickly.sh 2011-07-06 14:29:39 +0000
@@ -50,3 +50,18 @@
50diff -qr data/templates/ubuntu-application/store /tmp/quickly-test/quickly-templates/test-template/store50diff -qr data/templates/ubuntu-application/store /tmp/quickly-test/quickly-templates/test-template/store
5151
52diff -qr data/templates/ubuntu-application/test /tmp/quickly-test/quickly-templates/test-template/test52diff -qr data/templates/ubuntu-application/test /tmp/quickly-test/quickly-templates/test-template/test
53
54cd /tmp/quickly-test
55
56export HOME=/tmp/quickly-test; quickly create test-template test-project
57# Creating bzr repository and committing
58# Congrats, your new project is setup! cd /tmp/quickly-test/test-project/ to start hacking.
59# Creating project directory test-project
60
61cd test-project
62
63cat .quickly | VER=$(quickly --version | head -n1 | cut -d' ' -f2-) sh -c 'sed "s/$VER/X.X.X/"'
64# project = test-project
65# version_ubuntu-application = X.X.X
66# version = X.X.X
67# template = test-template

Subscribers

People subscribed via source and target branches