/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.py

[merge] bzr.dev 1775

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
 
150
150
 
151
151
class TreeEntry(object):
152
 
    """An entry that implements the minium interface used by commands.
 
152
    """An entry that implements the minimum interface used by commands.
153
153
 
154
154
    This needs further inspection, it may be better to have 
155
155
    InventoryEntries without ids - though that seems wrong. For now,
509
509
        # but with branch a kwarg now, passing in args as is results in the
510
510
        #message being used for the branch
511
511
        args = (DEPRECATED_PARAMETER, message, ) + args
512
 
        Commit().commit(working_tree=self, revprops=revprops, *args, **kwargs)
 
512
        committed_id = Commit().commit( working_tree=self, revprops=revprops,
 
513
            *args, **kwargs)
513
514
        self._set_inventory(self.read_working_inventory())
 
515
        return committed_id
514
516
 
515
517
    def id2abspath(self, file_id):
516
518
        return self.abspath(self.id2path(file_id))
552
554
            if not path:
553
555
                path = self._inventory.id2path(file_id)
554
556
            mode = os.lstat(self.abspath(path)).st_mode
555
 
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC&mode)
 
557
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
556
558
 
557
559
    @needs_write_lock
558
560
    def add(self, files, ids=None):
1218
1220
                    new_revision, xml)
1219
1221
                inv.revision_id = new_revision
1220
1222
                xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
1221
 
 
 
1223
            assert isinstance(xml, str), 'serialised xml must be bytestring.'
1222
1224
            path = self._basis_inventory_name()
1223
 
            self._control_files.put_utf8(path, xml)
 
1225
            sio = StringIO(xml)
 
1226
            self._control_files.put(path, sio)
1224
1227
        except WeaveRevisionNotPresent:
1225
1228
            pass
1226
1229
 
1227
1230
    def read_basis_inventory(self):
1228
1231
        """Read the cached basis inventory."""
1229
1232
        path = self._basis_inventory_name()
1230
 
        return self._control_files.get_utf8(path).read()
 
1233
        return self._control_files.get(path).read()
1231
1234
        
1232
1235
    @needs_read_lock
1233
1236
    def read_working_inventory(self):
1348
1351
        # of a nasty hack; probably it's better to have a transaction object,
1349
1352
        # which can do some finalization when it's either successfully or
1350
1353
        # unsuccessfully completed.  (Denys's original patch did that.)
1351
 
        # RBC 20060206 hookinhg into transaction will couple lock and transaction
1352
 
        # wrongly. Hookinh into unllock on the control files object is fine though.
 
1354
        # RBC 20060206 hooking into transaction will couple lock and transaction
 
1355
        # wrongly. Hooking into unlock on the control files object is fine though.
1353
1356
        
1354
1357
        # TODO: split this per format so there is no ugly if block
1355
1358
        if self._hashcache.needs_write and (
1401
1404
                                      this_tree=self)
1402
1405
                self.set_last_revision(self.branch.last_revision())
1403
1406
            if old_tip and old_tip != self.last_revision():
1404
 
                # our last revision was not the prior branch last reivison
 
1407
                # our last revision was not the prior branch last revision
1405
1408
                # and we have converted that last revision to a pending merge.
1406
1409
                # base is somewhere between the branch tip now
1407
1410
                # and the now pending merge
1443
1446
            try:
1444
1447
                if file_kind(self.abspath(conflicted)) != "file":
1445
1448
                    text = False
1446
 
            except OSError, e:
1447
 
                if e.errno == errno.ENOENT:
1448
 
                    text = False
1449
 
                else:
1450
 
                    raise
 
1449
            except errors.NoSuchFile:
 
1450
                text = False
1451
1451
            if text is True:
1452
1452
                for suffix in ('.THIS', '.OTHER'):
1453
1453
                    try:
1454
1454
                        kind = file_kind(self.abspath(conflicted+suffix))
1455
 
                    except OSError, e:
1456
 
                        if e.errno == errno.ENOENT:
 
1455
                        if kind != "file":
1457
1456
                            text = False
1458
 
                            break
1459
 
                        else:
1460
 
                            raise
1461
 
                    if kind != "file":
 
1457
                    except errors.NoSuchFile:
1462
1458
                        text = False
 
1459
                    if text == False:
1463
1460
                        break
1464
1461
            ctype = {True: 'text conflict', False: 'contents conflict'}[text]
1465
1462
            conflicts.append(Conflict.factory(ctype, path=conflicted,
1723
1720
    def initialize(self, a_bzrdir, revision_id=None):
1724
1721
        """See WorkingTreeFormat.initialize().
1725
1722
        
1726
 
        revision_id allows creating a working tree at a differnet
 
1723
        revision_id allows creating a working tree at a different
1727
1724
        revision than the branch is at.
1728
1725
        """
1729
1726
        if not isinstance(a_bzrdir.transport, LocalTransport):