~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Abbreviate pack_stat struct format to '>6L'

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
from bzrlib import (
53
53
    debug,
54
54
    errors,
55
 
    revision,
56
55
    trace,
57
56
    tree,
58
57
    ui,
73
72
from bzrlib.inventory import Inventory, InventoryEntry, make_entry
74
73
from bzrlib import symbol_versioning
75
74
from bzrlib.urlutils import unescape_for_display
76
 
 
 
75
from bzrlib.i18n import gettext
77
76
 
78
77
class NullCommitReporter(object):
79
78
    """I report on progress of a commit."""
114
113
        note(format, *args)
115
114
 
116
115
    def snapshot_change(self, change, path):
117
 
        if path == '' and change in ('added', 'modified'):
 
116
        if path == '' and change in (gettext('added'), gettext('modified')):
118
117
            return
119
118
        self._note("%s %s", change, path)
120
119
 
128
127
                                   "to started.", DeprecationWarning,
129
128
                                   stacklevel=2)
130
129
            location = ''
131
 
        self._note('Committing%s', location)
 
130
        self._note(gettext('Committing%s'), location)
132
131
 
133
132
    def completed(self, revno, rev_id):
134
 
        self._note('Committed revision %d.', revno)
 
133
        self._note(gettext('Committed revision %d.'), revno)
135
134
        # self._note goes to the console too; so while we want to log the
136
135
        # rev_id, we can't trivially only log it. (See bug 526425). Long
137
136
        # term we should rearrange the reporting structure, but for now
140
139
        mutter('Committed revid %s as revno %d.', rev_id, revno)
141
140
 
142
141
    def deleted(self, path):
143
 
        self._note('deleted %s', path)
 
142
        self._note(gettext('deleted %s'), path)
144
143
 
145
144
    def missing(self, path):
146
 
        self._note('missing %s', path)
 
145
        self._note(gettext('missing %s'), path)
147
146
 
148
147
    def renamed(self, change, old_path, new_path):
149
148
        self._note('%s %s => %s', change, old_path, new_path)
443
442
        except Exception, e:
444
443
            mutter("aborting commit write group because of exception:")
445
444
            trace.log_exception_quietly()
446
 
            note("aborting commit write group: %r" % (e,))
447
445
            self.builder.abort()
448
446
            raise
449
447
 
466
464
        # Merge local tags to remote
467
465
        if self.bound_branch:
468
466
            self._set_progress_stage("Merging tags to master branch")
469
 
            tag_conflicts = self.branch.tags.merge_to(self.master_branch.tags)
 
467
            tag_updates, tag_conflicts = self.branch.tags.merge_to(
 
468
                self.master_branch.tags)
470
469
            if tag_conflicts:
471
470
                warning_lines = ['    ' + name for name, _, _ in tag_conflicts]
472
 
                note("Conflicting tags in bound branch:\n" +
473
 
                    "\n".join(warning_lines))
 
471
                note( gettext("Conflicting tags in bound branch:\n{0}".format(
 
472
                    "\n".join(warning_lines))) )
474
473
 
475
474
        # Make the working tree be up to date with the branch. This
476
475
        # includes automatic changes scheduled to be made to the tree, such
495
494
        # A merge with no effect on files
496
495
        if len(self.parents) > 1:
497
496
            return
498
 
        # TODO: we could simplify this by using self.builder.basis_delta.
499
 
 
500
 
        # The initial commit adds a root directory, but this in itself is not
501
 
        # a worthwhile commit.
502
 
        if (self.basis_revid == revision.NULL_REVISION and
503
 
            ((self.builder.new_inventory is not None and
504
 
             len(self.builder.new_inventory) == 1) or
505
 
            len(self.builder._basis_delta) == 1)):
506
 
            raise PointlessCommit()
507
497
        if self.builder.any_changes():
508
498
            return
509
499
        raise PointlessCommit()
705
695
                # Reset the new path (None) and new versioned flag (False)
706
696
                change = (change[0], (change[1][0], None), change[2],
707
697
                    (change[3][0], False)) + change[4:]
 
698
                new_path = change[1][1]
 
699
                versioned = False
708
700
            elif kind == 'tree-reference':
709
701
                if self.recursive == 'down':
710
702
                    self._commit_nested_tree(change[0], change[1][1])
714
706
                    if new_path is None:
715
707
                        reporter.deleted(old_path)
716
708
                    elif old_path is None:
717
 
                        reporter.snapshot_change('added', new_path)
 
709
                        reporter.snapshot_change(gettext('added'), new_path)
718
710
                    elif old_path != new_path:
719
 
                        reporter.renamed('renamed', old_path, new_path)
 
711
                        reporter.renamed(gettext('renamed'), old_path, new_path)
720
712
                    else:
721
713
                        if (new_path or 
722
714
                            self.work_tree.branch.repository._format.rich_root_data):
723
715
                            # Don't report on changes to '' in non rich root
724
716
                            # repositories.
725
 
                            reporter.snapshot_change('modified', new_path)
 
717
                            reporter.snapshot_change(gettext('modified'), new_path)
726
718
            self._next_progress_entry()
727
719
        # Unversion IDs that were found to be deleted
728
720
        self.deleted_ids = deleted_ids
734
726
        if self.specific_files or self.exclude:
735
727
            specific_files = self.specific_files or []
736
728
            for path, old_ie in self.basis_inv.iter_entries():
737
 
                if old_ie.file_id in self.builder.new_inventory:
 
729
                if self.builder.new_inventory.has_id(old_ie.file_id):
738
730
                    # already added - skip.
739
731
                    continue
740
732
                if (is_inside_any(specific_files, path)
951
943
            self.reporter.renamed(change, old_path, path)
952
944
            self._next_progress_entry()
953
945
        else:
954
 
            if change == 'unchanged':
 
946
            if change == gettext('unchanged'):
955
947
                return
956
948
            self.reporter.snapshot_change(change, path)
957
949
            self._next_progress_entry()
973
965
 
974
966
    def _emit_progress(self):
975
967
        if self.pb_entries_count is not None:
976
 
            text = "%s [%d] - Stage" % (self.pb_stage_name,
 
968
            text = gettext("{0} [{1}] - Stage").format(self.pb_stage_name,
977
969
                self.pb_entries_count)
978
970
        else:
979
 
            text = "%s - Stage" % (self.pb_stage_name, )
 
971
            text = gettext("%s - Stage") % (self.pb_stage_name, )
980
972
        self.pb.update(text, self.pb_stage_count, self.pb_stage_total)
981
973
 
982
974
    def _set_specific_file_ids(self):