/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Ian Clatworthy
  • Date: 2009-04-01 10:22:33 UTC
  • mfrom: (4210.4.3 bzr.114)
  • mto: This revision was merged to the branch mainline in revision 4230.
  • Revision ID: ian.clatworthy@canonical.com-20090401102233-nb0x50guwk2cmlk4
1.14 formats (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1337
1337
 
1338
1338
    This differs from WorkingTree4 by:
1339
1339
     - Supporting content filtering.
 
1340
 
 
1341
    This is new in bzr 1.11.
 
1342
    """
 
1343
 
 
1344
 
 
1345
class WorkingTree6(DirStateWorkingTree):
 
1346
    """This is the Format 6 working tree.
 
1347
 
 
1348
    This differs from WorkingTree5 by:
1340
1349
     - Supporting a current view that may mask the set of files in a tree
1341
1350
       impacted by most user operations.
1342
1351
 
1343
 
    This is new in bzr 1.11.
 
1352
    This is new in bzr 1.14.
1344
1353
    """
1345
1354
 
1346
1355
    def _make_views(self):
1490
1499
 
1491
1500
 
1492
1501
class WorkingTreeFormat5(DirStateWorkingTreeFormat):
1493
 
    """WorkingTree format supporting views.
 
1502
    """WorkingTree format supporting content filtering.
1494
1503
    """
1495
1504
 
1496
1505
    upgrade_recommended = False
1505
1514
        """See WorkingTreeFormat.get_format_description()."""
1506
1515
        return "Working tree format 5"
1507
1516
 
 
1517
    def supports_content_filtering(self):
 
1518
        return True
 
1519
 
 
1520
 
 
1521
class WorkingTreeFormat6(DirStateWorkingTreeFormat):
 
1522
    """WorkingTree format supporting views.
 
1523
    """
 
1524
 
 
1525
    upgrade_recommended = False
 
1526
 
 
1527
    _tree_class = WorkingTree6
 
1528
 
 
1529
    def get_format_string(self):
 
1530
        """See WorkingTreeFormat.get_format_string()."""
 
1531
        return "Bazaar Working Tree Format 6 (bzr 1.14)\n"
 
1532
 
 
1533
    def get_format_description(self):
 
1534
        """See WorkingTreeFormat.get_format_description()."""
 
1535
        return "Working tree format 6"
 
1536
 
1508
1537
    def _init_custom_control_files(self, wt):
1509
1538
        """Subclasses with custom control files should override this method."""
1510
1539
        wt._transport.put_bytes('views', '', mode=wt.bzrdir._get_file_mode())
2105
2134
        # tree during upgrade.
2106
2135
        tree._control_files.lock_write()
2107
2136
        try:
 
2137
            self.update_format(tree)
 
2138
        finally:
 
2139
            tree._control_files.unlock()
 
2140
 
 
2141
    def update_format(self, tree):
 
2142
        """Change the format marker."""
 
2143
        tree._transport.put_bytes('format',
 
2144
            self.target_format.get_format_string(),
 
2145
            mode=tree.bzrdir._get_file_mode())
 
2146
 
 
2147
 
 
2148
class Converter4or5to6(object):
 
2149
    """Perform an in-place upgrade of format 4 or 5 to format 6 trees."""
 
2150
 
 
2151
    def __init__(self):
 
2152
        self.target_format = WorkingTreeFormat6()
 
2153
 
 
2154
    def convert(self, tree):
 
2155
        # lock the control files not the tree, so that we don't get tree
 
2156
        # on-unlock behaviours, and so that no-one else diddles with the
 
2157
        # tree during upgrade.
 
2158
        tree._control_files.lock_write()
 
2159
        try:
2108
2160
            self.init_custom_control_files(tree)
2109
2161
            self.update_format(tree)
2110
2162
        finally: