~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Aaron Bentley
  • Date: 2006-03-19 18:49:10 UTC
  • mto: This revision was merged to the branch mainline in revision 1644.
  • Revision ID: aaron.bentley@utoronto.ca-20060319184910-44558c38ac2077cf
Progress indicator for tree builts

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
class ReportCommitToLog(NullCommitReporter):
129
129
 
130
130
    def snapshot_change(self, change, path):
131
 
        if change == 'unchanged':
132
 
            return
133
131
        note("%s %s", change, path)
134
132
 
135
133
    def completed(self, revno, rev_id):
136
 
        note('Committed revision %d.', revno)
 
134
        note('committed r%d {%s}', revno, rev_id)
137
135
    
138
136
    def deleted(self, file_id):
139
137
        note('deleted %s', file_id)
181
179
               verbose=False,
182
180
               revprops=None,
183
181
               working_tree=None,
184
 
               local=False,
185
 
               reporter=None,
186
 
               config=None):
 
182
               local=False):
187
183
        """Commit working copy as a new revision.
188
184
 
189
185
        branch -- the deprecated branch to commit to. New callers should pass in 
231
227
        self.bound_branch = None
232
228
        self.local = local
233
229
        self.master_branch = None
234
 
        self.master_locked = False
235
230
        self.rev_id = rev_id
236
231
        self.specific_files = specific_files
237
232
        self.allow_pointless = allow_pointless
239
234
        if revprops is not None:
240
235
            self.revprops.update(revprops)
241
236
 
242
 
        if reporter is None and self.reporter is None:
243
 
            self.reporter = NullCommitReporter()
244
 
        elif reporter is not None:
245
 
            self.reporter = reporter
246
 
 
247
237
        self.work_tree.lock_write()
248
238
        try:
249
239
            # setup the bound branch variables as needed.
309
299
                    or self.new_inv != self.basis_inv):
310
300
                raise PointlessCommit()
311
301
 
312
 
            if len(self.work_tree.conflicts())>0:
 
302
            if len(list(self.work_tree.iter_conflicts()))>0:
313
303
                raise ConflictsInTree
314
304
 
315
305
            self.inv_sha1 = self.branch.repository.add_inventory(
334
324
            self.branch.append_revision(self.rev_id)
335
325
 
336
326
            self.work_tree.set_pending_merges([])
337
 
            self.work_tree.set_last_revision(self.rev_id)
 
327
            if len(self.parents):
 
328
                precursor = self.parents[0]
 
329
            else:
 
330
                precursor = None
 
331
            self.work_tree.set_last_revision(self.rev_id, precursor)
338
332
            # now the work tree is up to date with the branch
339
333
            
340
 
            self.reporter.completed(self.branch.revno(), self.rev_id)
 
334
            self.reporter.completed(self.branch.revno()+1, self.rev_id)
341
335
            if self.config.post_commit() is not None:
342
336
                hooks = self.config.post_commit().split(' ')
343
337
                # this would be nicer with twisted.python.reflect.namedAny
390
384
        # so grab the lock
391
385
        self.bound_branch = self.branch
392
386
        self.master_branch.lock_write()
393
 
        self.master_locked = True
394
387
####        
395
388
####        # Check to see if we have any pending merges. If we do
396
389
####        # those need to be pushed into the master branch
409
402
        """
410
403
        if not self.bound_branch:
411
404
            return
412
 
        if self.master_locked:
413
 
            self.master_branch.unlock()
 
405
        self.master_branch.unlock()
414
406
 
415
407
    def _escape_commit_message(self):
416
408
        """Replace xml-incompatible control characters."""
417
 
        # FIXME: RBC 20060419 this should be done by the revision
418
 
        # serialiser not by commit. Then we can also add an unescaper
419
 
        # in the deserializer and start roundtripping revision messages
420
 
        # precisely. See repository_implementations/test_repository.py
421
 
        
422
409
        # Python strings can include characters that can't be
423
410
        # represented in well-formed XML; escape characters that
424
411
        # aren't listed in the XML specification
505
492
        # mark-merge.  
506
493
        for path, ie in self.new_inv.iter_entries():
507
494
            previous_entries = ie.find_previous_heads(
508
 
                self.parent_invs,
509
 
                self.weave_store,
510
 
                self.branch.repository.get_transaction())
 
495
                self.parent_invs, 
 
496
                self.weave_store.get_weave_or_empty(ie.file_id,
 
497
                    self.branch.get_transaction()))
511
498
            if ie.revision is None:
512
499
                change = ie.snapshot(self.rev_id, path, previous_entries,
513
500
                                     self.work_tree, self.weave_store,
527
514
        revision set to their prior value.
528
515
        """
529
516
        mutter("Selecting files for commit with filter %s", self.specific_files)
530
 
        self.new_inv = Inventory(revision_id=self.rev_id)
 
517
        self.new_inv = Inventory()
531
518
        for path, new_ie in self.work_inv.iter_entries():
532
519
            file_id = new_ie.file_id
533
520
            mutter('check %s {%s}', path, new_ie.file_id)