[MERGE] Root entry has a revision id

Aaron Bentley aaron.bentley at utoronto.ca
Mon Aug 14 20:16:03 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> Aaron Bentley wrote:
> +class BundleInfo08(BundleInfo):
> +    def _update_tree(self, bundle_tree, revision_id):
> +        bundle_tree.note_last_changed('', revision_id)
> +        BundleInfo._update_tree(self, bundle_tree, revision_id)
> 
> Why does BundleInfo08 need to exist, rather than just updating BundleInfo?

A 0.8 Bundle won't include the last_revision for the root entry, so we
must do it in _update_tree.  A 0.9 Bundle will include the last_revision
for the root entry, so we can use the plain BundleInfo for 0.9+.

> === modified file 'bzrlib/commit.py'
> --- bzrlib/commit.py	2006-08-05 22:33:36 +0000
> +++ bzrlib/commit.py	2006-08-08 17:43:56 +0000
> @@ -308,8 +308,11 @@
>                  raise PointlessCommit()
> 
>              self._emit_progress_update()
> -            # TODO: Now the new inventory is known, check for conflicts
> and prompt the
> -            # user for a commit message.
> +            # TODO: Now the new inventory is known, check for conflicts and
> +            # prompt the user for a commit message.
> +            # ADHB 2006-08-08: If this is done, populate_new_inv should
> not add
> +            # weave lines, because nothing should be recorded until it
> is known
> +            # that commit will succeed.
>              self.builder.finish_inventory()
>              self._emit_progress_update()
>              self.rev_id = self.builder.commit(self.message)
> @@ -502,10 +505,13 @@
>          # in bugs like #46635.  Any reason not to use/enhance
> Tree.changes_from?
>          # ADHB 11-07-2006
>          mutter("Selecting files for commit with filter %s",
> self.specific_files)
> -        # at this point we dont copy the root entry:
>          entries = self.work_inv.iter_entries()
> -        entries.next()
> -        self._emit_progress_update()
> +        if not self.builder.record_root_entry:
> +            warnings.warn('CommitBuilders should support recording the
> root'
> +                ' entry as of bzr 0.10.', DeprecationWarning, stacklevel=2)
> +            self.builder.new_inventory.add(self.basis_inv.root.copy())
> +            entries.next()
> +            self._emit_progress_update()
>          for path, new_ie in entries:
>              self._emit_progress_update()
>              file_id = new_ie.file_id
> 
> I'm guessing this should actually be stacklevel=1. Since the direct
> caller is the one that is being warned. stacklevel=2 is generally used
> for wrappers, IIRC.

Looks like you're right.  I knew zilch about the warning system when I
wrote that.  It looks like I copied it from somewhere that was also
doing it wrong, as there are a bunch of functions that use stacklevel 2.

> v- I'm pretty sure we're using 'assertEqual(expected, actual)'

Strange, I thought I'd used that throughout.  I guess old habits die hard.

> So the NewCommitBuilder => _CommitBuilder stuff needs to happen. And a
> couple other small things. Otherwise +1 from me.

Cool.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE4Mvz0F+nu1YWqI0RAjgOAJ9MngXl7qEK7b0OvYs8J/aZGMKjywCdEAC5
b6wimIVjPJ+5GifRfUdOSPw=
=71PE
-----END PGP SIGNATURE-----




More information about the bazaar mailing list