=== added file 'lib/lp/code/stories/branches/xx-upgrading-branches.txt'
--- lib/lp/code/stories/branches/xx-upgrading-branches.txt 1970-01-01 00:00:00 +0000
+++ lib/lp/code/stories/branches/xx-upgrading-branches.txt 2010-01-20 00:19:44 +0000
@@ -0,0 +1,49 @@
+==================
+Upgrading Branches
+==================
+
+Launchpad can upgrade branches that were in an older format to a more up to
+date format.
+
+
+Creating the branch
+===================
+
+Branches are not available to be upgraded if they are in a more up to date
+format.
+
+ >>> from lp.code.bzr import BranchFormat, RepositoryFormat
+ >>> login('<email address hidden>')
+ >>> domino = factory.makePerson(
+ ... name='domino', <email address hidden>", password="test")
+ >>> twist = factory.makeAnyBranch(
+ ... branch_format=BranchFormat.BZR_BRANCH_6,
+ ... repository_format=RepositoryFormat.BZR_CHK_2A,
+ ... owner=domino)
+ >>> branch_url = canonical_url(twist)
+ >>> logout()
+
+
+Requesting an upgrade
+=====================
+
+Only those with edit permissions on a branch can request an upgrade.
+
+ >>> nopriv_browser = setupBrowser(
+ ... auth='Basic <email address hidden>:test')
+ >>> nopriv_browser.open(branch_url)
+ >>> link = nopriv_browser.getLink('Upgrade this branch')
+ Traceback (most recent call last):
+ LinkNotFoundError
+
+ >>> domino_browser = setupBrowser(
+ ... auth='Basic <email address hidden>:test')
+ >>> domino_browser.open(branch_url)
+ >>> domino_browser.getLink("Upgrade this branch").click()
+ >>> print domino_browser.url
+ http://code.launchpad.dev/~domino/.../+upgrade
+ >>> domino_browser.getControl('Upgrade').click()
+
+ >>> for msg in get_feedback_messages(domino_browser.contents):
+ ... print msg
+ An upgrade of this branch is in progress.
=== modified file 'lib/lp/code/templates/branch-messages.pt'
--- lib/lp/code/templates/branch-messages.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/code/templates/branch-messages.pt 2010-01-20 00:19:44 +0000
@@ -115,6 +115,12 @@ tal:condition="branch/mirror_status_message" tal:content="branch/mirror_status_message">
</div>
+ <div id="upgrade-pending"
+ class="warning message" style="font-weight: normal"
+ tal:condition="branch/upgrade_pending">
+ An upgrade of this branch is in progress.
+ </div>
+
</tal:hosted-branch>
Hrm, the diff seems to be confused... Here's the real diff:
=== modified file 'lib/lp/ code/browser/ branch. py' code/browser/ branch. py 2010-01-07 05:03:46 +0000 code/browser/ branch. py 2010-01-20 00:19:44 +0000 tMenu', roductView' , rkView' , iew', scriptionsView' ,
'add_ subscriber' , 'browse_revisions', 'link_bug',
'link_ blueprint' , 'register_merge', 'source', 'subscription',
--- lib/lp/
+++ lib/lp/
@@ -20,6 +20,7 @@
'BranchEdi
'BranchInP
'BranchSpa
+ 'BranchUpgradeV
'BranchURL',
'BranchView',
'BranchSub
@@ -230,7 +231,7 @@
links = [
- 'edit_status']
+ 'edit_status', 'upgrade_branch']
@enabled_ with_permission ('launchpad. Edit') codebrowse_ url('files' )
def edit_status(self):
@@ -297,6 +298,14 @@
url = self.context.
return Link(url, text, icon='info', enabled=enabled)
+ @enabled_ with_permission ('launchpad. Edit') branch( self): needs_upgrading :
+ def upgrade_
+ enabled = False
+ if self.context.
+ enabled = True
+ return Link(
+ '+upgrade', 'Upgrade this branch', icon='edit', enabled=enabled)
+
class DecoratedBug: url(self. context)
"""Provide some additional attributes to a normal bug."""
@@ -876,6 +885,27 @@
return canonical_
+class BranchUpgradeVi ew(LaunchpadFor mView): displayname) url(self. context) branch' ) branch_ action( self, action, data): requestUpgrade( ) BranchEditFormV iew, BranchNameValid ationMixin) :
+ """Used to upgrade a branch."""
+
+ schema = IBranch
+ field_names = []
+
+ @property
+ def page_title(self):
+ return smartquote('Upgrade branch "%s"' % self.context.
+
+ @property
+ def next_url(self):
+ return canonical_
+
+ cancel_url = next_url
+
+ @action('Upgrade', name='upgrade_
+ def upgrade_
+ self.context.
+
+
class BranchEditView(
"""The main branch view for editing the branch attributes."""
=== modified file 'lib/lp/ code/browser/ configure. zcml' code/browser/ configure. zcml 2010-01-14 01:48:19 +0000 code/browser/ configure. zcml 2010-01-20 00:19:44 +0000
permission= "launchpad. Edit"
template= "../../ app/templates/ generic- edit.pt" /> code.interfaces .branch. IBranch" lp.code. browser. branch. BranchUpgradeVi ew" "launchpad. Edit" "../../ app/templates/ generic- edit.pt" />
name= "+reviewer"
for=" lp.code. interfaces. branch. IBranch"
class= "lp.code. browser. branch. BranchReviewerE ditView"
--- lib/lp/
+++ lib/lp/
@@ -474,6 +474,13 @@
<browser:page
+ name="+upgrade"
+ for="lp.
+ class="
+ facet="branches"
+ permission=
+ template=
+ <browser:page
=== added file 'lib/lp/ code/stories/ branches/ xx-upgrading- branches. txt' code/stories/ branches/ xx-upgrading- branches. txt 1970-01-01 00:00:00 +0000 code/stories/ branches/ xx-upgrading- branches. txt 2010-01-20 00:19:44 +0000 ======= ====== makeAnyBranch( format= BranchFormat. BZR_BRANCH_ 6, format= RepositoryForma t.BZR_CHK_ 2A, url(twist) ======= ======= = browser. open(branch_ url) browser. getLink( 'Upgrade this branch') browser. open(branch_ url) browser. getLink( "Upgrade this branch").click() code.launchpad. dev/~domino/ .../+upgrade browser. getControl( 'Upgrade' ).click( ) messages( domino_ browser. contents) :
--- lib/lp/
+++ lib/lp/
@@ -0,0 +1,49 @@
+==================
+Upgrading Branches
+==================
+
+Launchpad can upgrade branches that were in an older format to a more up to
+date format.
+
+
+Creating the branch
+======
+
+Branches are not available to be upgraded if they are in a more up to date
+format.
+
+ >>> from lp.code.bzr import BranchFormat, RepositoryFormat
+ >>> login('<email address hidden>')
+ >>> domino = factory.makePerson(
+ ... name='domino', <email address hidden>", password="test")
+ >>> twist = factory.
+ ... branch_
+ ... repository_
+ ... owner=domino)
+ >>> branch_url = canonical_
+ >>> logout()
+
+
+Requesting an upgrade
+======
+
+Only those with edit permissions on a branch can request an upgrade.
+
+ >>> nopriv_browser = setupBrowser(
+ ... auth='Basic <email address hidden>:test')
+ >>> nopriv_
+ >>> link = nopriv_
+ Traceback (most recent call last):
+ LinkNotFoundError
+
+ >>> domino_browser = setupBrowser(
+ ... auth='Basic <email address hidden>:test')
+ >>> domino_
+ >>> domino_
+ >>> print domino_browser.url
+ http://
+ >>> domino_
+
+ >>> for msg in get_feedback_
+ ... print msg
+ An upgrade of this branch is in progress.
=== modified file 'lib/lp/ code/templates/ branch- messages. pt' code/templates/ branch- messages. pt 2009-07-17 17:59:07 +0000 code/templates/ branch- messages. pt 2010-01-20 00:19:44 +0000
tal: condition= "branch/ mirror_ status_ message"
tal: content= "branch/ mirror_ status_ message" > pending" "branch/ upgrade_ pending" > hosted- branch>
--- lib/lp/
+++ lib/lp/
@@ -115,6 +115,12 @@
</div>
+ <div id="upgrade-
+ class="warning message" style="font-weight: normal"
+ tal:condition=
+ An upgrade of this branch is in progress.
+ </div>
+
</tal:
</div>
=== modified file 'lib/lp/ code/templates/ branch- metadata. pt' code/templates/ branch- metadata. pt 2009-09-08 21:26:03 +0000 code/templates/ branch- metadata. pt 2010-01-20 00:19:44 +0000 xml.zope. org/namespaces/ tal" xml.zope. org/namespaces/ metal" xml.zope. org/namespaces/ i18n"> xml.zope. org/namespaces/ i18n" "context_ menu context/ menu:context" >
--- lib/lp/
+++ lib/lp/
@@ -1,7 +1,8 @@
<div
xmlns:tal="http://
xmlns:metal="http://
- xmlns:i18n="http://
+ xmlns:i18n="http://
+ tal:define=
<div class=" two-column- list"> "context/ branch_ format" > "structure context/ stacked_ on/fmt: bzr-link" /> menu/upgrade_ branch" "link/enabled" "structure link/fmt:link" />
<dl id="branch-format" tal:condition=
@@ -18,5 +19,13 @@
<dd tal:content=
</dl>
</div>
+ <div class="actions">
+ <div
+ tal:define="link context_
+ tal:condition=
+ >
+ <a tal:replace=
+ </div>
+ </div>
</div>