/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

  • Committer: Martin Pool
  • Date: 2007-02-21 05:34:56 UTC
  • mfrom: (2296 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2309.
  • Revision ID: mbp@sourcefrog.net-20070221053456-vyr6o0ehqnbetrvb
merge trunk, in particular new Branch6 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
        else:
504
504
            parents = [last_rev]
505
505
        try:
506
 
            merges_file = self._control_files.get_utf8('pending-merges')
 
506
            merges_file = self._control_files.get('pending-merges')
507
507
        except errors.NoSuchFile:
508
508
            pass
509
509
        else:
510
510
            for l in merges_file.readlines():
511
 
                parents.append(l.rstrip('\n'))
 
511
                revision_id = osutils.safe_revision_id(l.rstrip('\n'))
 
512
                parents.append(revision_id)
512
513
        return parents
513
514
 
514
515
    @needs_read_lock
719
720
        :param revision_ids: The revision_ids to set as the parent ids of this
720
721
            working tree. Any of these may be ghosts.
721
722
        """
 
723
        revision_ids = [osutils.safe_revision_id(r) for r in revision_ids]
722
724
        self._check_parents_for_ghosts(revision_ids,
723
725
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
724
726
 
732
734
    @needs_tree_write_lock
733
735
    def set_parent_trees(self, parents_list, allow_leftmost_as_ghost=False):
734
736
        """See MutableTree.set_parent_trees."""
735
 
        parent_ids = [rev for (rev, tree) in parents_list]
 
737
        parent_ids = [osutils.safe_revision_id(rev) for (rev, tree) in parents_list]
736
738
 
737
739
        self._check_parents_for_ghosts(parent_ids,
738
740
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
795
797
            merger.check_basis(check_clean=True, require_commits=False)
796
798
            if to_revision is None:
797
799
                to_revision = branch.last_revision()
 
800
            else:
 
801
                to_revision = osutils.safe_revision_id(to_revision)
798
802
            merger.other_rev_id = to_revision
799
803
            if merger.other_rev_id is None:
800
804
                raise error.NoCommits(branch)
1315
1319
                yield stem
1316
1320
 
1317
1321
    @needs_write_lock
1318
 
    def pull(self, source, overwrite=False, stop_revision=None):
 
1322
    def pull(self, source, overwrite=False, stop_revision=None,
 
1323
             change_reporter=None):
1319
1324
        top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
1320
1325
        source.lock_read()
1321
1326
        try:
1336
1341
                                new_basis_tree,
1337
1342
                                basis_tree,
1338
1343
                                this_tree=self,
1339
 
                                pb=pb)
 
1344
                                pb=pb,
 
1345
                                change_reporter=change_reporter)
1340
1346
                    if (basis_tree.inventory.root is None and
1341
1347
                        new_basis_tree.inventory.root is not None):
1342
1348
                        self.set_root_id(new_basis_tree.inventory.root.file_id)
1530
1536
    @needs_tree_write_lock
1531
1537
    def set_last_revision(self, new_revision):
1532
1538
        """Change the last revision in the working tree."""
 
1539
        new_revision = osutils.safe_revision_id(new_revision)
1533
1540
        if self._change_last_revision(new_revision):
1534
1541
            self._cache_basis_inventory(new_revision)
1535
1542
 
1558
1565
 
1559
1566
    def _create_basis_xml_from_inventory(self, revision_id, inventory):
1560
1567
        """Create the text that will be saved in basis-inventory"""
1561
 
        inventory.revision_id = revision_id
 
1568
        # TODO: jam 20070209 This should be redundant, as the revision_id
 
1569
        #       as all callers should have already converted the revision_id to
 
1570
        #       utf8
 
1571
        inventory.revision_id = osutils.safe_revision_id(revision_id)
1562
1572
        return xml6.serializer_v6.write_inventory_to_string(inventory)
1563
1573
 
1564
1574
    def _cache_basis_inventory(self, new_revision):
1951
1961
    def _last_revision(self):
1952
1962
        """See Mutable.last_revision."""
1953
1963
        try:
1954
 
            return self._control_files.get_utf8('last-revision').read()
 
1964
            return osutils.safe_revision_id(
 
1965
                        self._control_files.get('last-revision').read())
1955
1966
        except errors.NoSuchFile:
1956
1967
            return None
1957
1968
 
2131
2142
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
2132
2143
        branch = a_bzrdir.open_branch()
2133
2144
        if revision_id is not None:
 
2145
            revision_id = osutils.safe_revision_id(revision_id)
2134
2146
            branch.lock_write()
2135
2147
            try:
2136
2148
                revision_history = branch.revision_history()
2222
2234
        branch = a_bzrdir.open_branch()
2223
2235
        if revision_id is None:
2224
2236
            revision_id = branch.last_revision()
 
2237
        else:
 
2238
            revision_id = osutils.safe_revision_id(revision_id)
2225
2239
        # WorkingTree3 can handle an inventory which has a unique root id.
2226
2240
        # as of bzr 0.12. However, bzr 0.11 and earlier fail to handle
2227
2241
        # those trees. And because there isn't a format bump inbetween, we