[MERGE] Refactor commit to prepare for population by tree walking
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Jul 13 20:58:14 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ian Clatworthy wrote:
> @@ -594,24 +590,64 @@
>
> specific_files = self.specific_files
> mutter("Selecting files for commit with filter %s", specific_files)
> - work_inv = self.work_tree.inventory
> - assert work_inv.root is not None
> - self.pb_entries_total = len(work_inv)
>
> # Check and warn about old CommitBuilders
> - entries = work_inv.iter_entries()
> + root_added_already = False
> if not self.builder.record_root_entry:
> symbol_versioning.warn('CommitBuilders should support recording'
> ' the root entry as of bzr 0.10.', DeprecationWarning,
> stacklevel=1)
> self.builder.new_inventory.add(self.basis_inv.root.copy())
> - entries.next()
> -
> + root_added_already = True
> +
> + # Build the new inventory
> + self._populate_from_inventory(specific_files, root_added_already)
This refactoring looks odd. For one thing, the root hasn't really been
added. For another, root_added_already is redundant with
self.builder.record_root_entry.
> + # If specific files/directories were nominated, it is possible
> + # that some data from outside those needs to be preserved from
> + # the basis tree. For example, if a file x is moved from out of
> + # directory foo into directory bar and the user requests
> + # ``commit foo``, then information about bar/x must also be
> + # recorded.
^^^ This implies that bar knows what its children are, which isn't
really accurate. Strictly speaking, bar only needs to be committed if
it wasn't a directory in the basis tree-- the current implementation is
overkill.
> + # Record an entry for this item
> + # Note: I don't particularly want to have the existing_ie
It's confusing that you're referring to new_ie as existing_ie here.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGl9lV0F+nu1YWqI0RAvxVAJ9ayrN0u/B9PIDAvLMW+LYilDQeYQCfUBEb
pHmXAIZHgZr1A7xkJJK7wZs=
=w8zG
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list