~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/bzr.py

[r=Edwin][ui=None] BranchUpgradeJob refactoring for 2.0 changes,
        UI for requesting an upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
__metaclass__ = type
7
7
__all__ = [
8
8
    'BranchFormat',
9
 
    'BRANCH_FORMAT_UPGRADE_PATH',
10
9
    'ControlFormat',
 
10
    'CURRENT_BRANCH_FORMATS',
 
11
    'CURRENT_REPOSITORY_FORMATS',
11
12
    'RepositoryFormat',
12
 
    'REPOSITORY_FORMAT_UPGRADE_PATH',
13
13
    ]
14
14
 
15
15
 
17
17
import lp.codehosting
18
18
from bzrlib.branch import (
19
19
    BranchReferenceFormat, BzrBranchFormat4, BzrBranchFormat5,
20
 
    BzrBranchFormat6, BzrBranchFormat7, BzrBranchFormat8)
 
20
    BzrBranchFormat6, BzrBranchFormat7)
21
21
from bzrlib.bzrdir import (
22
22
    BzrDirFormat4, BzrDirFormat5, BzrDirFormat6, BzrDirMetaFormat1)
23
23
from bzrlib.plugins.loom.branch import (
24
24
    BzrBranchLoomFormat1, BzrBranchLoomFormat6)
25
25
from bzrlib.repofmt.knitrepo import (RepositoryFormatKnit1,
26
26
    RepositoryFormatKnit3, RepositoryFormatKnit4)
27
 
try:
28
 
    from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
29
 
    # Shut up, pyflakes.
30
 
    RepositoryFormat2a
31
 
except ImportError:
32
 
    RepositoryFormat2a = None
33
27
from bzrlib.repofmt.pack_repo import (
34
28
    RepositoryFormatKnitPack1, RepositoryFormatKnitPack3,
35
 
    RepositoryFormatKnitPack4, RepositoryFormatKnitPack5,
36
 
    RepositoryFormatKnitPack6, RepositoryFormatKnitPack6RichRoot
37
 
    )
 
29
    RepositoryFormatKnitPack4, RepositoryFormatKnitPack5)
38
30
from bzrlib.repofmt.weaverepo import (
39
31
    RepositoryFormat4, RepositoryFormat5, RepositoryFormat6,
40
32
    RepositoryFormat7)
222
214
    BZR_METADIR_1 = _format_enum(1, BzrDirMetaFormat1)
223
215
 
224
216
 
225
 
BRANCH_FORMAT_UPGRADE_PATH = {
226
 
    BranchFormat.UNRECOGNIZED: None,
227
 
    BranchFormat.BRANCH_REFERENCE: None,
228
 
    BranchFormat.BZR_BRANCH_4: BzrBranchFormat8,
229
 
    BranchFormat.BZR_BRANCH_5: BzrBranchFormat8,
230
 
    BranchFormat.BZR_BRANCH_6: BzrBranchFormat8,
231
 
    BranchFormat.BZR_BRANCH_7: BzrBranchFormat8,
232
 
    BranchFormat.BZR_BRANCH_8: None,
233
 
    BranchFormat.BZR_LOOM_1: None,
234
 
    BranchFormat.BZR_LOOM_2: None,
235
 
    BranchFormat.BZR_LOOM_3: None,
236
 
    }
237
 
 
238
 
 
239
 
REPOSITORY_FORMAT_UPGRADE_PATH = {
240
 
    RepositoryFormat.UNRECOGNIZED: None,
241
 
    RepositoryFormat.BZR_REPOSITORY_4: RepositoryFormatKnitPack6,
242
 
    RepositoryFormat.BZR_REPOSITORY_5: RepositoryFormatKnitPack6,
243
 
    RepositoryFormat.BZR_REPOSITORY_6: RepositoryFormatKnitPack6,
244
 
    RepositoryFormat.BZR_REPOSITORY_7: RepositoryFormatKnitPack6,
245
 
    RepositoryFormat.BZR_KNIT_1: RepositoryFormatKnitPack6,
246
 
    RepositoryFormat.BZR_KNIT_3: RepositoryFormatKnitPack3,
247
 
    RepositoryFormat.BZR_KNIT_4: RepositoryFormatKnitPack6RichRoot,
248
 
    RepositoryFormat.BZR_KNITPACK_1: RepositoryFormatKnitPack6,
249
 
    RepositoryFormat.BZR_KNITPACK_3: None,
250
 
    RepositoryFormat.BZR_KNITPACK_4: RepositoryFormatKnitPack6RichRoot,
251
 
    RepositoryFormat.BZR_KNITPACK_5: None,
252
 
    RepositoryFormat.BZR_KNITPACK_5_RRB: RepositoryFormatKnitPack6RichRoot,
253
 
    RepositoryFormat.BZR_KNITPACK_5_RR: None,
254
 
    RepositoryFormat.BZR_KNITPACK_6: None,
255
 
    RepositoryFormat.BZR_KNITPACK_6_RR: None,
256
 
    RepositoryFormat.BZR_PACK_DEV_0: None,
257
 
    RepositoryFormat.BZR_PACK_DEV_0_SUBTREE: None,
258
 
    RepositoryFormat.BZR_DEV_1: None,
259
 
    RepositoryFormat.BZR_DEV_1_SUBTREE: None,
260
 
    RepositoryFormat.BZR_DEV_2: None,
261
 
    RepositoryFormat.BZR_DEV_2_SUBTREE: None,
262
 
    RepositoryFormat.BZR_CHK1: None,
263
 
    RepositoryFormat.BZR_CHK2: None,
264
 
    RepositoryFormat.BZR_CHK_2A: None
265
 
    }
266
 
 
267
 
if RepositoryFormat2a is not None:
268
 
    for k in [RepositoryFormat.BZR_CHK1, RepositoryFormat.BZR_CHK2]:
269
 
        REPOSITORY_FORMAT_UPGRADE_PATH[k] = RepositoryFormat2a
 
217
# A tuple of branch formats that should not suggest upgrading.
 
218
CURRENT_BRANCH_FORMATS = (
 
219
    BranchFormat.UNRECOGNIZED,
 
220
    BranchFormat.BRANCH_REFERENCE,
 
221
    BranchFormat.BZR_BRANCH_7,
 
222
    BranchFormat.BZR_BRANCH_8,
 
223
    BranchFormat.BZR_LOOM_1,
 
224
    BranchFormat.BZR_LOOM_2,
 
225
    BranchFormat.BZR_LOOM_3)
 
226
 
 
227
# A tuple of repository formats that should not suggest upgrading.
 
228
CURRENT_REPOSITORY_FORMATS = (
 
229
    RepositoryFormat.UNRECOGNIZED,
 
230
    RepositoryFormat.BZR_PACK_DEV_0,
 
231
    RepositoryFormat.BZR_PACK_DEV_0_SUBTREE,
 
232
    RepositoryFormat.BZR_DEV_1,
 
233
    RepositoryFormat.BZR_DEV_1_SUBTREE,
 
234
    RepositoryFormat.BZR_DEV_2,
 
235
    RepositoryFormat.BZR_DEV_2_SUBTREE,
 
236
    RepositoryFormat.BZR_CHK1,
 
237
    RepositoryFormat.BZR_CHK2,
 
238
    RepositoryFormat.BZR_CHK_2A)