~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Aaron Bentley
  • Date: 2006-11-27 16:14:24 UTC
  • mto: This revision was merged to the branch mainline in revision 2155.
  • Revision ID: abentley@panoramicfeedback.com-20061127161424-kc3b780vnb6tm6yk
Updates from review comments

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
# XXX: Can we do any better about making interrupted commits change
19
 
# nothing?  
20
 
 
21
18
# The newly committed revision is going to have a shape corresponding
22
19
# to that of the working inventory.  Files that are not in the
23
20
# working tree and that were in the predecessor are reported as
49
46
# merges from, then it should still be reported as newly added
50
47
# relative to the basis revision.
51
48
 
52
 
# TODO: Do checks that the tree can be committed *before* running the 
53
 
# editor; this should include checks for a pointless commit and for 
54
 
# unknown or missing files.
55
 
 
56
49
# TODO: Change the parameter 'rev_id' to 'revision_id' to be consistent with
57
50
# the rest of the code; add a deprecation of the old name.
58
51
 
163
156
            self.config = None
164
157
        
165
158
    def commit(self,
166
 
               branch=DEPRECATED_PARAMETER, message=DEPRECATED_PARAMETER,
 
159
               branch=DEPRECATED_PARAMETER, message=None,
167
160
               timestamp=None,
168
161
               timezone=None,
169
162
               committer=None,
219
212
            self.work_tree = working_tree
220
213
            self.branch = self.work_tree.branch
221
214
        if message_callback is None:
222
 
            if deprecated_passed(message) and message is not None:
223
 
                symbol_versioning.warn("Commit.commit (message): The message"
224
 
                " parameter is deprecated as of bzr 0.14. Please use "
225
 
                "message_callback instead.", DeprecationWarning, stacklevel=2)
226
 
                message_callback = lambda: message
 
215
            if message is not None:
 
216
                if isinstance(message, str):
 
217
                    message = message.decode(bzrlib.user_encoding)
 
218
                message_callback = lambda x: message
227
219
            else:
228
 
                raise BzrError("The message_callback keyword parameter is "
229
 
                               "required for commit().")
 
220
                raise BzrError("The message or message_callback keyword"
 
221
                               " parameter is required for commit().")
230
222
 
231
223
        self.bound_branch = None
232
224
        self.local = local
311
303
            # that commit will succeed.
312
304
            self.builder.finish_inventory()
313
305
            self._emit_progress_update()
314
 
            message = message_callback()
315
 
            if isinstance(message, str):
316
 
                message = message.decode(bzrlib.user_encoding)
 
306
            message = message_callback(self)
317
307
            assert isinstance(message, unicode), type(message)
318
308
            self.message = message
319
309
            self._escape_commit_message()