Rev 5862: (jelmer) CommitBuilder.any_changes() no longer returns True for changes that in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat May 14 21:02:10 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5862 [merge]
revision-id: pqm at pqm.ubuntu.com-20110514210206-ez4ltcg5k90tidxe
parent: pqm at pqm.ubuntu.com-20110513195932-upsvlswzyvwodep0
parent: jelmer at samba.org-20110512125922-687mluena8y88m1y
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2011-05-14 21:02:06 +0000
message:
  (jelmer) CommitBuilder.any_changes() no longer returns True for changes that
   only set the tree root. (Jelmer Vernooij)
modified:
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
  bzrlib/vf_repository.py        vf_repository.py-20110502151858-yh9nnoxpokg86unk-1
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2011-05-13 08:43:44 +0000
+++ b/bzrlib/commit.py	2011-05-14 21:02:06 +0000
@@ -495,15 +495,6 @@
         # A merge with no effect on files
         if len(self.parents) > 1:
             return
-        # TODO: we could simplify this by using self.builder.basis_delta.
-
-        # The initial commit adds a root directory, but this in itself is not
-        # a worthwhile commit.
-        if (self.basis_revid == revision.NULL_REVISION and
-            ((self.builder.new_inventory is not None and
-             len(self.builder.new_inventory) == 1) or
-            len(self.builder._basis_delta) == 1)):
-            raise PointlessCommit()
         if self.builder.any_changes():
             return
         raise PointlessCommit()

=== modified file 'bzrlib/vf_repository.py'
--- a/bzrlib/vf_repository.py	2011-05-12 12:03:01 +0000
+++ b/bzrlib/vf_repository.py	2011-05-14 21:02:06 +0000
@@ -105,6 +105,11 @@
         super(VersionedFileCommitBuilder, self).__init__(repository,
             parents, config, timestamp, timezone, committer, revprops,
             revision_id, lossy)
+        try:
+            basis_id = self.parents[0]
+        except IndexError:
+            basis_id = _mod_revision.NULL_REVISION
+        self.basis_delta_revision = basis_id
         self.new_inventory = Inventory(None)
         self._basis_delta = []
         self.__heads = graph.HeadsCache(repository.get_graph()).heads
@@ -124,11 +129,6 @@
         builder.record_delete().
         """
         self._recording_deletes = True
-        try:
-            basis_id = self.parents[0]
-        except IndexError:
-            basis_id = _mod_revision.NULL_REVISION
-        self.basis_delta_revision = basis_id
 
     def any_changes(self):
         """Return True if any entries were changed.
@@ -537,7 +537,11 @@
         else:
             raise NotImplementedError('unknown kind')
         ie.revision = self._new_revision_id
-        self._any_changes = True
+        # The initial commit adds a root directory, but this in itself is not
+        # a worthwhile commit.
+        if (self.basis_delta_revision != _mod_revision.NULL_REVISION or
+            path != ""):
+            self._any_changes = True
         return self._get_delta(ie, basis_inv, path), True, fingerprint
 
     def record_iter_changes(self, tree, basis_revision_id, iter_changes,
@@ -799,7 +803,10 @@
             if new_path == '':
                 seen_root = True
         self.new_inventory = None
-        if len(inv_delta):
+        # The initial commit adds a root directory, but this in itself is not
+        # a worthwhile commit.
+        if ((len(inv_delta) > 0 and basis_revision_id != _mod_revision.NULL_REVISION) or
+            (len(inv_delta) > 1 and basis_revision_id == _mod_revision.NULL_REVISION)):
             # This should perhaps be guarded by a check that the basis we
             # commit against is the basis for the commit and if not do a delta
             # against the basis.
@@ -1205,7 +1212,6 @@
             # result['size'] = t
         return result
 
-
     def get_commit_builder(self, branch, parents, config, timestamp=None,
                            timezone=None, committer=None, revprops=None,
                            revision_id=None, lossy=False):




More information about the bazaar-commits mailing list