/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: Martin Pool
  • Date: 2007-09-25 08:14:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2895.
  • Revision ID: mbp@sourcefrog.net-20070925081412-ta60zj5qxfuokev3
Remove most calls to safe_file_id and safe_revision_id.

The deprecation period for passing unicode objects as revision ids is now over.

Show diffs side-by-side

added added

removed removed

Lines of Context:
469
469
 
470
470
    def has_id(self, file_id):
471
471
        state = self.current_dirstate()
472
 
        file_id = osutils.safe_file_id(file_id)
473
472
        row, parents = self._get_entry(file_id=file_id)
474
473
        if row is None:
475
474
            return False
479
478
    @needs_read_lock
480
479
    def id2path(self, file_id):
481
480
        "Convert a file-id to a path."
482
 
        file_id = osutils.safe_file_id(file_id)
483
481
        state = self.current_dirstate()
484
482
        entry = self._get_entry(file_id=file_id)
485
483
        if entry == (None, None):
493
491
 
494
492
            Note: The caller is expected to take a read-lock before calling this.
495
493
            """
496
 
            file_id = osutils.safe_file_id(file_id)
497
494
            entry = self._get_entry(file_id=file_id, path=path)
498
495
            if entry == (None, None):
499
496
                return False
505
502
            Note: The caller is expected to take a read-lock before calling this.
506
503
            """
507
504
            if not path:
508
 
                file_id = osutils.safe_file_id(file_id)
509
505
                path = self.id2path(file_id)
510
506
            mode = os.lstat(self.abspath(path)).st_mode
511
507
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
1020
1016
 
1021
1017
        WorkingTree4 supplies revision_trees for any basis tree.
1022
1018
        """
1023
 
        revision_id = osutils.safe_revision_id(revision_id)
1024
1019
        dirstate = self.current_dirstate()
1025
1020
        parent_ids = dirstate.get_parent_ids()
1026
1021
        if revision_id not in parent_ids:
1033
1028
    @needs_tree_write_lock
1034
1029
    def set_last_revision(self, new_revision):
1035
1030
        """Change the last revision in the working tree."""
1036
 
        new_revision = osutils.safe_revision_id(new_revision)
1037
1031
        parents = self.get_parent_ids()
1038
1032
        if new_revision in (NULL_REVISION, None):
1039
1033
            assert len(parents) < 2, (
1057
1051
        :param revision_ids: The revision_ids to set as the parent ids of this
1058
1052
            working tree. Any of these may be ghosts.
1059
1053
        """
1060
 
        revision_ids = [osutils.safe_revision_id(r) for r in revision_ids]
1061
1054
        trees = []
1062
1055
        for revision_id in revision_ids:
1063
1056
            try:
1089
1082
        # convert absent trees to the null tree, which we convert back to
1090
1083
        # missing on access.
1091
1084
        for rev_id, tree in parents_list:
1092
 
            rev_id = osutils.safe_revision_id(rev_id)
1093
1085
            _mod_revision.check_not_reserved_id(rev_id)
1094
1086
            if tree is not None:
1095
1087
                real_trees.append((rev_id, tree))
1152
1144
            return
1153
1145
        state = self.current_dirstate()
1154
1146
        state._read_dirblocks_if_needed()
1155
 
        ids_to_unversion = set()
1156
 
        for file_id in file_ids:
1157
 
            ids_to_unversion.add(osutils.safe_file_id(file_id))
 
1147
        ids_to_unversion = set(file_ids)
1158
1148
        paths_to_unversion = set()
1159
1149
        # sketch:
1160
1150
        # check if the root is to be unversioned, if so, assert for now.
1267
1257
        These trees get an initial random root id, if their repository supports
1268
1258
        rich root data, TREE_ROOT otherwise.
1269
1259
        """
1270
 
        revision_id = osutils.safe_revision_id(revision_id)
1271
1260
        if not isinstance(a_bzrdir.transport, LocalTransport):
1272
1261
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
1273
1262
        transport = a_bzrdir.get_workingtree_transport(self)
1339
1328
 
1340
1329
    def __init__(self, dirstate, revision_id, repository):
1341
1330
        self._dirstate = dirstate
1342
 
        self._revision_id = osutils.safe_revision_id(revision_id)
 
1331
        self._revision_id = revision_id
1343
1332
        self._repository = repository
1344
1333
        self._inventory = None
1345
1334
        self._locked = 0
1397
1386
        """
1398
1387
        if file_id is None and path is None:
1399
1388
            raise errors.BzrError('must supply file_id or path')
1400
 
        file_id = osutils.safe_file_id(file_id)
1401
1389
        if path is not None:
1402
1390
            path = path.encode('utf8')
1403
1391
        parent_index = self._get_parent_index()