~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-12 12:59:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5862.
  • Revision ID: jelmer@samba.org-20110512125922-687mluena8y88m1y
Move root checking to VersionedFileRepository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        super(VersionedFileCommitBuilder, self).__init__(repository,
105
105
            parents, config, timestamp, timezone, committer, revprops,
106
106
            revision_id, lossy)
 
107
        try:
 
108
            basis_id = self.parents[0]
 
109
        except IndexError:
 
110
            basis_id = _mod_revision.NULL_REVISION
 
111
        self.basis_delta_revision = basis_id
107
112
        self.new_inventory = Inventory(None)
108
113
        self._basis_delta = []
109
114
        self.__heads = graph.HeadsCache(repository.get_graph()).heads
123
128
        builder.record_delete().
124
129
        """
125
130
        self._recording_deletes = True
126
 
        try:
127
 
            basis_id = self.parents[0]
128
 
        except IndexError:
129
 
            basis_id = _mod_revision.NULL_REVISION
130
 
        self.basis_delta_revision = basis_id
131
131
 
132
132
    def any_changes(self):
133
133
        """Return True if any entries were changed.
536
536
        else:
537
537
            raise NotImplementedError('unknown kind')
538
538
        ie.revision = self._new_revision_id
539
 
        self._any_changes = True
 
539
        # The initial commit adds a root directory, but this in itself is not
 
540
        # a worthwhile commit.
 
541
        if (self.basis_delta_revision != _mod_revision.NULL_REVISION or
 
542
            path != ""):
 
543
            self._any_changes = True
540
544
        return self._get_delta(ie, basis_inv, path), True, fingerprint
541
545
 
542
546
    def record_iter_changes(self, tree, basis_revision_id, iter_changes,
798
802
            if new_path == '':
799
803
                seen_root = True
800
804
        self.new_inventory = None
801
 
        if len(inv_delta):
 
805
        # The initial commit adds a root directory, but this in itself is not
 
806
        # a worthwhile commit.
 
807
        if ((len(inv_delta) > 0 and basis_revision_id != _mod_revision.NULL_REVISION) or
 
808
            (len(inv_delta) > 1 and basis_revision_id == _mod_revision.NULL_REVISION)):
802
809
            # This should perhaps be guarded by a check that the basis we
803
810
            # commit against is the basis for the commit and if not do a delta
804
811
            # against the basis.
1204
1211
            # result['size'] = t
1205
1212
        return result
1206
1213
 
1207
 
 
1208
1214
    def get_commit_builder(self, branch, parents, config, timestamp=None,
1209
1215
                           timezone=None, committer=None, revprops=None,
1210
1216
                           revision_id=None, lossy=False):