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

merge bzr.dev r4154

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
75
75
            format=format, force_new_tree=False)
76
76
        self._tree = None
77
77
 
78
 
    def build_commit(self):
79
 
        """Build a commit on the branch."""
 
78
    def build_commit(self, **commit_kwargs):
 
79
        """Build a commit on the branch.
 
80
 
 
81
        This makes a commit with no real file content for when you only want
 
82
        to look at the revision graph structure.
 
83
 
 
84
        :param commit_kwargs: Arguments to pass through to commit, such as
 
85
             timestamp.
 
86
        """
80
87
        tree = memorytree.MemoryTree.create_on_branch(self._branch)
81
88
        tree.lock_write()
82
89
        try:
83
90
            tree.add('')
84
 
            return self._do_commit(tree)
 
91
            return self._do_commit(tree, **commit_kwargs)
85
92
        finally:
86
93
            tree.unlock()
87
94
 
137
144
        self._tree = None
138
145
 
139
146
    def build_snapshot(self, revision_id, parent_ids, actions,
140
 
                       message=None):
 
147
                       message=None, timestamp=None):
141
148
        """Build a commit, shaped in a specific way.
142
149
 
143
150
        :param revision_id: The handle for the new commit, can be None
150
157
            ('rename', ('orig-path', 'new-path'))
151
158
        :param message: An optional commit message, if not supplied, a default
152
159
            commit message will be written.
 
160
        :param timestamp: If non-None, set the timestamp of the commit to this
 
161
            value.
153
162
        :return: The revision_id of the new commit
154
163
        """
155
164
        if parent_ids is not None:
210
219
            tree.add(to_add_files, to_add_file_ids, to_add_kinds)
211
220
            for file_id, content in new_contents.iteritems():
212
221
                tree.put_file_bytes_non_atomic(file_id, content)
213
 
            return self._do_commit(tree, message=message, rev_id=revision_id)
 
222
            return self._do_commit(tree, message=message, rev_id=revision_id,
 
223
                timestamp=timestamp)
214
224
        finally:
215
225
            tree.unlock()
216
226