929
928
return _PreviewTree(self)
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.
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
940
:param strict: If True, abort the commit if there are unversioned
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
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.
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,
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()))
1657
1635
or trans_id in self._new_parent):
1659
1637
mover.rename(full_path, self._limbo_name(trans_id))
1660
except errors.TransformRenameFailed, e:
1661
1639
if e.errno != errno.ENOENT:
1688
1666
if trans_id in self._needs_rename:
1690
1668
mover.rename(self._limbo_name(trans_id), full_path)
1691
except errors.TransformRenameFailed, e:
1692
1670
# We may be renaming a dangling inventory id
1693
1671
if e.errno != errno.ENOENT:
1820
1798
executable = self.is_executable(file_id, path)
1821
1799
return kind, executable, None
1823
def is_locked(self):
1826
1801
def lock_read(self):
1827
1802
# Perhaps in theory, this should lock the TreeTransform?
1830
1805
def unlock(self):
2926
2901
"""Rename a file from one path to another."""
2928
2903
osutils.rename(from_, to)
2929
except (IOError, OSError), e:
2930
2905
if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
2931
2906
raise errors.FileExists(to, str(e))
2932
# normal OSError doesn't include filenames so it's hard to see where
2933
# the problem is, see https://bugs.launchpad.net/bzr/+bug/491763
2934
raise errors.TransformRenameFailed(from_, to, str(e), e.errno)
2935
2908
self.past_renames.append((from_, to))
2937
2910
def pre_delete(self, from_, to):
2947
2920
def rollback(self):
2948
2921
"""Reverse all renames that have been performed"""
2949
2922
for from_, to in reversed(self.past_renames):
2951
osutils.rename(to, from_)
2952
except (OSError, IOError), e:
2953
raise errors.TransformRenameFailed(to, from_, str(e), e.errno)
2923
osutils.rename(to, from_)
2954
2924
# after rollback, don't reuse _FileMover
2955
2925
past_renames = None
2956
2926
pending_deletions = None