~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Robert Collins
  • Date: 2006-02-23 04:08:56 UTC
  • mto: (1587.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1588.
  • Revision ID: robertc@robertcollins.net-20060223040856-8b476741783b6244
Import bzrtools' 'fix' command as 'bzr reconcile.'

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
from bzrlib.osutils import (local_time_offset,
77
77
                            rand_bytes, compact_date,
78
78
                            kind_marker, is_inside_any, quotefn,
79
 
                            sha_string, sha_strings, sha_file, isdir, isfile,
 
79
                            sha_file, isdir, isfile,
80
80
                            split_lines)
81
81
import bzrlib.config
82
82
import bzrlib.errors as errors
85
85
                           ConflictsInTree,
86
86
                           StrictCommitFailed
87
87
                           )
88
 
import bzrlib.gpg as gpg
89
88
from bzrlib.revision import Revision
90
89
from bzrlib.testament import Testament
91
90
from bzrlib.trace import mutter, note, warning
295
294
            if len(list(self.work_tree.iter_conflicts()))>0:
296
295
                raise ConflictsInTree
297
296
 
298
 
            self._record_inventory()
 
297
            self.inv_sha1 = self.branch.repository.add_inventory(
 
298
                self.rev_id,
 
299
                self.new_inv,
 
300
                self.present_parents
 
301
                )
299
302
            self._make_revision()
300
303
            self.work_tree.set_pending_merges([])
301
304
            self.branch.append_revision(self.rev_id)
316
319
        finally:
317
320
            self.branch.unlock()
318
321
 
319
 
    def _record_inventory(self):
320
 
        """Store the inventory for the new revision."""
321
 
        inv_text = serializer_v5.write_inventory_to_string(self.new_inv)
322
 
        self.inv_sha1 = sha_string(inv_text)
323
 
        s = self.branch.repository.control_weaves
324
 
        s.add_text('inventory', self.rev_id,
325
 
                   split_lines(inv_text), self.present_parents,
326
 
                   self.branch.get_transaction())
327
 
 
328
322
    def _escape_commit_message(self):
329
323
        """Replace xml-incompatible control characters."""
330
324
        # Python strings can include characters that can't be
366
360
            
367
361
    def _make_revision(self):
368
362
        """Record a new revision object for this commit."""
369
 
        self.rev = Revision(timestamp=self.timestamp,
370
 
                            timezone=self.timezone,
371
 
                            committer=self.committer,
372
 
                            message=self.message,
373
 
                            inventory_sha1=self.inv_sha1,
374
 
                            revision_id=self.rev_id,
375
 
                            properties=self.revprops)
376
 
        self.rev.parent_ids = self.parents
377
 
        rev_tmp = StringIO()
378
 
        serializer_v5.write_revision(self.rev, rev_tmp)
379
 
        rev_tmp.seek(0)
380
 
        if self.config.signature_needed():
381
 
            plaintext = Testament(self.rev, self.new_inv).as_short_text()
382
 
            self.branch.repository.store_revision_signature(
383
 
                gpg.GPGStrategy(self.config), plaintext, self.rev_id)
384
 
        self.branch.repository.revision_store.add(rev_tmp, self.rev_id)
385
 
        mutter('new revision_id is {%s}', self.rev_id)
 
363
        rev = Revision(timestamp=self.timestamp,
 
364
                       timezone=self.timezone,
 
365
                       committer=self.committer,
 
366
                       message=self.message,
 
367
                       inventory_sha1=self.inv_sha1,
 
368
                       revision_id=self.rev_id,
 
369
                       properties=self.revprops)
 
370
        rev.parent_ids = self.parents
 
371
        self.branch.repository.add_revision(self.rev_id, rev, self.new_inv, self.config)
386
372
 
387
373
    def _remove_deleted(self):
388
374
        """Remove deleted files from the working inventories.