~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Vincent Ladeuil
  • Date: 2009-05-05 15:31:34 UTC
  • mto: (4343.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4344.
  • Revision ID: v.ladeuil+lp@free.fr-20090505153134-q4bp4is9gywsmzrv
Clean up test for log formats.

* bzrlib/tests/blackbox/test_logformats.py:
Update tests to actual style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
    def deleted(self, path):
109
109
        pass
110
110
 
 
111
    def escaped(self, escape_count, message):
 
112
        pass
 
113
 
111
114
    def missing(self, path):
112
115
        pass
113
116
 
150
153
    def deleted(self, path):
151
154
        self._note('deleted %s', path)
152
155
 
 
156
    def escaped(self, escape_count, message):
 
157
        self._note("replaced %d control characters in message", escape_count)
 
158
 
153
159
    def missing(self, path):
154
160
        self._note('missing %s', path)
155
161
 
204
210
        """Commit working copy as a new revision.
205
211
 
206
212
        :param message: the commit message (it or message_callback is required)
207
 
        :param message_callback: A callback: message = message_callback(cmt_obj)
208
213
 
209
214
        :param timestamp: if not None, seconds-since-epoch for a
210
215
            postdated/predated commit.
368
373
                # Prompt the user for a commit message if none provided
369
374
                message = message_callback(self)
370
375
                self.message = message
 
376
                self._escape_commit_message()
371
377
 
372
378
                # Add revision data to the local branch
373
379
                self.rev_id = self.builder.commit(self.message)
393
399
            # and now do the commit locally.
394
400
            self.branch.set_last_revision_info(new_revno, self.rev_id)
395
401
 
396
 
            # Make the working tree be up to date with the branch. This
397
 
            # includes automatic changes scheduled to be made to the tree, such
398
 
            # as updating its basis and unversioning paths that were missing.
399
 
            self.work_tree.unversion(self.deleted_ids)
 
402
            # Make the working tree up to date with the branch
400
403
            self._set_progress_stage("Updating the working tree")
401
404
            self.work_tree.update_basis_by_delta(self.rev_id,
402
405
                 self.builder.get_basis_delta())
599
602
        if self.master_locked:
600
603
            self.master_branch.unlock()
601
604
 
 
605
    def _escape_commit_message(self):
 
606
        """Replace xml-incompatible control characters."""
 
607
        # FIXME: RBC 20060419 this should be done by the revision
 
608
        # serialiser not by commit. Then we can also add an unescaper
 
609
        # in the deserializer and start roundtripping revision messages
 
610
        # precisely. See repository_implementations/test_repository.py
 
611
        self.message, escape_count = xml_serializer.escape_invalid_chars(
 
612
            self.message)
 
613
        if escape_count:
 
614
            self.reporter.escaped(escape_count, self.message)
 
615
 
602
616
    def _gather_parents(self):
603
617
        """Record the parents of a merge for merge detection."""
604
618
        # TODO: Make sure that this list doesn't contain duplicate
683
697
                            reporter.snapshot_change('modified', new_path)
684
698
            self._next_progress_entry()
685
699
        # Unversion IDs that were found to be deleted
686
 
        self.deleted_ids = deleted_ids
 
700
        self.work_tree.unversion(deleted_ids)
687
701
 
688
702
    def _record_unselected(self):
689
703
        # If specific files are selected, then all un-selected files must be
846
860
                content_summary)
847
861
 
848
862
        # Unversion IDs that were found to be deleted
849
 
        self.deleted_ids = deleted_ids
 
863
        self.work_tree.unversion(deleted_ids)
850
864
 
851
865
    def _commit_nested_tree(self, file_id, path):
852
866
        "Commit a nested tree."