/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 breezy/commit.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-22 19:21:36 UTC
  • mfrom: (7339.1.10 stores-revno)
  • Revision ID: breezy.the.bot@gmail.com-20190622192136-vde8aq61fhj4jza7
Add a ``calculate_revnos`` setting that determines when revision numbers are calculated.

Merged from https://code.launchpad.net/~jelmer/brz/stores-revno/+merge/368873

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
            unescape_for_display(location, 'utf-8'))
159
159
 
160
160
    def completed(self, revno, rev_id):
161
 
        self._note(gettext('Committed revision %d.'), revno)
162
 
        # self._note goes to the console too; so while we want to log the
163
 
        # rev_id, we can't trivially only log it. (See bug 526425). Long
164
 
        # term we should rearrange the reporting structure, but for now
165
 
        # we just mutter seperately. We mutter the revid and revno together
166
 
        # so that concurrent bzr invocations won't lead to confusion.
167
 
        mutter('Committed revid %s as revno %d.', rev_id, revno)
 
161
        if revno is not None:
 
162
            self._note(gettext('Committed revision %d.'), revno)
 
163
            # self._note goes to the console too; so while we want to log the
 
164
            # rev_id, we can't trivially only log it. (See bug 526425). Long
 
165
            # term we should rearrange the reporting structure, but for now
 
166
            # we just mutter seperately. We mutter the revid and revno together
 
167
            # so that concurrent bzr invocations won't lead to confusion.
 
168
            mutter('Committed revid %s as revno %d.', rev_id, revno)
 
169
        else:
 
170
            self._note(gettext('Committed revid %s.'), rev_id)
168
171
 
169
172
    def deleted(self, path):
170
173
        self._note(gettext('deleted %s'), path)
373
376
        # Setup the bound branch variables as needed.
374
377
        self._check_bound_branch(operation, possible_master_transports)
375
378
 
 
379
        if self.config_stack is None:
 
380
            self.config_stack = self.work_tree.get_config_stack()
 
381
 
376
382
        # Check that the working tree is up to date
377
383
        old_revno, old_revid, new_revno = self._check_out_of_date_tree()
378
384
 
381
387
            self.reporter = reporter
382
388
        elif self.reporter is None:
383
389
            self.reporter = self._select_reporter()
384
 
        if self.config_stack is None:
385
 
            self.config_stack = self.work_tree.get_config_stack()
386
390
 
387
391
        # Setup the progress bar. As the number of files that need to be
388
392
        # committed in unknown, progress is reported as stages.
494
498
                    self.branch.fetch(self.master_branch, self.rev_id)
495
499
 
496
500
            # and now do the commit locally.
 
501
            if new_revno is None:
 
502
                # Keep existing behaviour around ghosts
 
503
                new_revno = 1
497
504
            self.branch.set_last_revision_info(new_revno, self.rev_id)
498
505
        else:
499
506
            try:
587
594
            # - in a checkout scenario the tree may have no
588
595
            # parents but the branch may do.
589
596
            first_tree_parent = breezy.revision.NULL_REVISION
590
 
        try:
591
 
            old_revno, master_last = self.master_branch.last_revision_info()
592
 
        except errors.UnsupportedOperation:
 
597
        if (self.master_branch._format.stores_revno() or
 
598
                self.config_stack.get('calculate_revnos')):
 
599
            try:
 
600
                old_revno, master_last = self.master_branch.last_revision_info()
 
601
            except errors.UnsupportedOperation:
 
602
                master_last = self.master_branch.last_revision()
 
603
                old_revno = self.branch.revision_id_to_revno(master_last)
 
604
        else:
593
605
            master_last = self.master_branch.last_revision()
594
 
            old_revno = self.branch.revision_id_to_revno(master_last)
 
606
            old_revno = None
595
607
        if master_last != first_tree_parent:
596
608
            if master_last != breezy.revision.NULL_REVISION:
597
609
                raise errors.OutOfDateTree(self.work_tree)
598
 
        if self.branch.repository.has_revision(first_tree_parent):
 
610
        if (old_revno is not None and
 
611
                self.branch.repository.has_revision(first_tree_parent)):
599
612
            new_revno = old_revno + 1
600
613
        else:
601
614
            # ghost parents never appear in revision history.
602
 
            new_revno = 1
 
615
            new_revno = None
603
616
        return old_revno, master_last, new_revno
604
617
 
605
618
    def _process_pre_hooks(self, old_revno, new_revno):