[bug] Repository.copy() copies inventory first

Robert Collins robertc at robertcollins.net
Thu Feb 16 07:16:42 GMT 2006


On Thu, 2006-02-16 at 01:09 -0600, John A Meinel wrote:
> Robert Collins wrote:

> The code is a little bit different after merging your bzrdir work. I
> eventually tracked the location where we actually create stuff. The path
> seems a little bit convoluted, and we go through 3+ indirections, but it
> is possible to follow. (It isn't helped by calling
> BzrBranch.copy_content_into which doesn't copy any content, it just sets
> the revision history, and parent, and it sets the parent to
> source.get_parent() rather than setting it to source. That seems like a
> bug to me.
> But then again on closer inspection 'sprout()' calls copy_content_into,
> and then afterwards overrides the fact that copy_content sets the
> parent, by setting the parent itself. So I must ask 'why does
> copy_content_into' set parent?
> I suppose BzrBranch.clone() uses it. But if nobody else does, it seems
> like setting the parent should be done inside clone() and sprout().

its used by clone and sprout. I'm not sure whether to move that out of
copy_content_into to clone, as its useful for copying the content of a
branch into another, and I expect that the generic 'updater' logic will
want to do that. But we can move it and later put it back.

> 
> Anyway, I can easily add the progress bars. I'm just a little concerned
> because I'm not 100% positive when the inventory.weave is being copied
> across....
> 
> Found it!!! And the bug is still present. So I'll fix it. (revision.py
> line 270, we still are copying the inventory weave before we copy the
> rest of the weaves).
> 
> So attached is the revised version, which I would like to commit to
> jam-integration. Can someone look it over?
> 
> John
> =:->
> 
> plain text document attachment (branch-progress.diff)
> === modified file 'bzrlib/repository.py'

fine

> === modified file 'bzrlib/store/__init__.py'
> --- bzrlib/store/__init__.py	
> +++ bzrlib/store/__init__.py	
> @@ -316,7 +316,11 @@
>      # TODO: Optional progress indicator
>      if not store_from.listable():
>          raise UnlistableStore(store_from)
> -    ids = [f for f in store_from]
> +    pb = bzrlib.ui.ui_factory.progress_bar()
> +    ids = []
> +    for count, file_id in enumerate(store_from):
> +        pb.update('listing files', count, count)
> +        ids.append(file_id)
>      mutter('copy_all ids: %r', ids)
>      store_to.copy_multi(store_from, ids)

I missed this before : This should accept a passed in pb and either do
'if pb is not None:
    pb.update...'

or
'if pb is None:
    pb = bzrlib.ui.ui_factory.progress_bar()'




 
> 
> === modified file 'bzrlib/store/weave.py'
> --- bzrlib/store/weave.py	
> +++ bzrlib/store/weave.py	
> @@ -31,6 +31,7 @@
>  from bzrlib.atomicfile import AtomicFile
>  from bzrlib.errors import NoSuchFile, FileExists
>  from bzrlib.trace import mutter
> +import bzrlib.ui
>  
> 
>  class WeaveStore(TransportStore):
> @@ -166,6 +167,9 @@
>       
>      def copy_multi(self, from_store, file_ids):
>          assert isinstance(from_store, WeaveStore)
> -        for f in file_ids:
> +        pb = bzrlib.ui.ui_factory.progress_bar()
> +        for count, f in enumerate(file_ids):
>              mutter("copy weave {%s} into %s", f, self)
> +            pb.update('copy', count, len(file_ids))
>              self._put(f, from_store._get(f))
> +        pb.clear()
> 

Likewise here.


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/20060216/de9725b1/attachment.pgp 


More information about the bazaar mailing list