[RFC][PATCH 4/4] Speed improvement in fetch/clone: the clone code

Robert Collins robertc at robertcollins.net
Thu Dec 15 05:21:25 GMT 2005


On Sat, 2005-12-10 at 19:15 +0100, Goffredo Baroncelli wrote:
> The patch changes the way in which the code gets the list of the file_id of the
> inventory. Before the code used the listable property of the transport ( not
> available in the http transport ) in order to get every file_id contained under
> .bzr/weave.
> Now the code gets the file_id involved via the file_involved( ) function.
> The big gain is that isn't anymore necessary to expand every inventory due 
> to the existence of the file_involved( ) function to know which file_id had to
> be download.

Once we get the pre-requisites in , +1.

> === modified file 'bzrlib/clone.py'
> --- bzrlib/clone.py	
> +++ bzrlib/clone.py	
> @@ -111,52 +107,23 @@
>          raise InvalidRevisionId(revision_id=revision, branch=branch_from)
>      return history[:idx+1]
>  
> -def _copy_text_weaves(branch_from, branch_to):
> -    copy_all(branch_from.weave_store, branch_to.weave_store)
> +def _copy_text_weaves(branch_from, branch_to, history):
> +
> +    from_set = set(branch_from.get_ancestry(history[-1])[1:])
> +    file_ids = branch_from.file_involved( from_set )
> +    branch_to.weave_store.copy_multi(branch_from.weave_store, file_ids )

This should look like:
def _copy_text_weaves(branch_from, branch_to, history):
    from_set = set(branch_from.get_ancestry(history[-1])[1:])
    file_ids = branch_from.file_involved(from_set)
    branch_to.weave_store.copy_multi(branch_from.weave_store, file_ids)

Note the removed VWS and the spaces between parameters and brackets.

> -def _copy_revision_store(branch_from, branch_to):
> -    copy_all(branch_from.revision_store, branch_to.revision_store)
> +def _copy_revision_store(branch_from, branch_to, history):
> +
> +    # copy all revision
> +    from_set = set(branch_from.get_ancestry(history[-1])[1:])
> +    branch_to.revision_store.copy_multi(branch_from.revision_store, from_set )

Please remove the VWS and bracket-spaces here. Also the # comment should
either be a docstring, or deleted - its pretty non-functional as it
stands. 


> -def _copy_control_weaves(branch_from, branch_to):
> +def _copy_control_weaves(branch_from, branch_to, history):
>      to_control = branch_to.control_weaves
>      from_control = branch_from.control_weaves
> +    # TODO, we need only the minimal revision !!!!!
>      to_control.copy_multi(from_control, ['inventory'])

When adding TODOs, please put your name or initials and the date.
i.e.
# TODO kreijack 20051215 we only need the minimal revision here.
 

Looking quite good though.

Cheers,
Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051215/c7fcf27a/attachment.pgp 


More information about the bazaar mailing list