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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    annotate,
26
26
    bencode,
27
27
    bzrdir,
28
 
    commit,
29
28
    delta,
30
29
    errors,
31
30
    inventory,
36
35
    )
37
36
""")
38
37
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
39
 
                           ReusingTransform, CantMoveRoot,
 
38
                           ReusingTransform, NotVersionedError, CantMoveRoot,
40
39
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
41
40
                           UnableCreateSymlink)
42
41
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
928
927
        """
929
928
        return _PreviewTree(self)
930
929
 
931
 
    def commit(self, branch, message, merge_parents=None, strict=False,
932
 
               timestamp=None, timezone=None, committer=None, authors=None,
933
 
               revprops=None, revision_id=None):
 
930
    def commit(self, branch, message, merge_parents=None, strict=False):
934
931
        """Commit the result of this TreeTransform to a branch.
935
932
 
936
933
        :param branch: The branch to commit to.
937
934
        :param message: The message to attach to the commit.
938
 
        :param merge_parents: Additional parent revision-ids specified by
939
 
            pending merges.
940
 
        :param strict: If True, abort the commit if there are unversioned
941
 
            files.
942
 
        :param timestamp: if not None, seconds-since-epoch for the time and
943
 
            date.  (May be a float.)
944
 
        :param timezone: Optional timezone for timestamp, as an offset in
945
 
            seconds.
946
 
        :param committer: Optional committer in email-id format.
947
 
            (e.g. "J Random Hacker <jrandom@example.com>")
948
 
        :param authors: Optional list of authors in email-id format.
949
 
        :param revprops: Optional dictionary of revision properties.
950
 
        :param revision_id: Optional revision id.  (Specifying a revision-id
951
 
            may reduce performance for some non-native formats.)
 
935
        :param merge_parents: Additional parents specified by pending merges.
952
936
        :return: The revision_id of the revision committed.
953
937
        """
954
938
        self._check_malformed()
971
955
        if self._tree.get_revision_id() != last_rev_id:
972
956
            raise ValueError('TreeTransform not based on branch basis: %s' %
973
957
                             self._tree.get_revision_id())
974
 
        revprops = commit.Commit.update_revprops(revprops, branch, authors)
975
 
        builder = branch.get_commit_builder(parent_ids,
976
 
                                            timestamp=timestamp,
977
 
                                            timezone=timezone,
978
 
                                            committer=committer,
979
 
                                            revprops=revprops,
980
 
                                            revision_id=revision_id)
 
958
        builder = branch.get_commit_builder(parent_ids)
981
959
        preview = self.get_preview_tree()
982
960
        list(builder.record_iter_changes(preview, last_rev_id,
983
961
                                         self.iter_changes()))
1182
1160
            if trans_id not in self._new_contents:
1183
1161
                continue
1184
1162
            new_path = self._limbo_name(trans_id)
1185
 
            osutils.rename(old_path, new_path)
 
1163
            os.rename(old_path, new_path)
1186
1164
            for descendant in self._limbo_descendants(trans_id):
1187
1165
                desc_path = self._limbo_files[descendant]
1188
1166
                desc_path = new_path + desc_path[len(old_path):]
1820
1798
            executable = self.is_executable(file_id, path)
1821
1799
        return kind, executable, None
1822
1800
 
1823
 
    def is_locked(self):
1824
 
        return False
1825
 
 
1826
1801
    def lock_read(self):
1827
1802
        # Perhaps in theory, this should lock the TreeTransform?
1828
 
        return self
 
1803
        pass
1829
1804
 
1830
1805
    def unlock(self):
1831
1806
        pass
2849
2824
                        # special-case the other tree root (move its
2850
2825
                        # children to current root)
2851
2826
                        if entry.parent_id is None:
2852
 
                            create = False
 
2827
                            create=False
2853
2828
                            moved = _reparent_transform_children(
2854
2829
                                tt, trans_id, tt.root)
2855
2830
                            for child in moved:
2923
2898
        self.pending_deletions = []
2924
2899
 
2925
2900
    def rename(self, from_, to):
2926
 
        """Rename a file from one path to another."""
 
2901
        """Rename a file from one path to another.  Functions like os.rename"""
2927
2902
        try:
2928
 
            osutils.rename(from_, to)
 
2903
            os.rename(from_, to)
2929
2904
        except OSError, e:
2930
2905
            if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
2931
2906
                raise errors.FileExists(to, str(e))
2945
2920
    def rollback(self):
2946
2921
        """Reverse all renames that have been performed"""
2947
2922
        for from_, to in reversed(self.past_renames):
2948
 
            osutils.rename(to, from_)
 
2923
            os.rename(to, from_)
2949
2924
        # after rollback, don't reuse _FileMover
2950
2925
        past_renames = None
2951
2926
        pending_deletions = None