[MERGE][#149113] Alternate fix

John Arbash Meinel john at arbash-meinel.com
Wed Oct 17 18:33:12 BST 2007


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

This patch changes tactics. Now 'path_content_summary' always returns an
executable value for entries that have a kind == 'file'.

In talking with Robert on IRC, his original idea was to avoid any sort of
inventory lookup if possible. (It isn't strictly possible because he is using
_sha_from_stat to lookup the cached sha value.)

At least at one point he was thinking that 'commit.py' would be the one who
fixes up the content_summary if executable was None. But it would just have to
ask the WT to do a is_executable() lookup, and then it has to re-pack a tuple,
which is always a bit ugly.

Instead, this code avoids a runtime supports_executable() check favoring a
load-time check and switching which function is called.

It has a dirstate optimized function, so we don't have to build the inventory
for this call. (I'm guessing we already build it, otherwise Alexander's test
fix would not have worked for him, but we are trying to avoid that.)

Overall, this just saves a runtime if/then check by using a pre-selected
function call. It would be nice to avoid the function call entirely when
supports_executable is true, but that requires having multiple versions of
path_content_summary, which I was hoping to avoid.

Another possibility would be to have 2 versions of path_content_summary, and
have the non_executable one use self.is_executable() since this is already
customized. (Though it wants a file_id, and all we have and really need is a path.)

We could also remove the assertion in record_entry_contents. It is a trivial
check, but AIUI it is called for every entry in the tree, so little bits add up.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFkdYJdeBCYSNAAMRAp7lAKCFNMDpY9UfhEJrjBbqlKD4Zca5OwCfXrxR
k51jo7c0q5Y5K9vBsJY1knM=
=FFQ7
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dirstate_error_149113.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20071017/80bcbc3b/attachment.diff 


More information about the bazaar mailing list