~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-06-27 01:36:22 UTC
  • Revision ID: mbp@sourcefrog.net-20050627013622-0d56be3e3105043e
Merge from aaron:

------------------------------------------------------------
revno: 763
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 17:30:28 -0400
message:
  Copy files in immutable stores directly.
------------------------------------------------------------
revno: 762
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 16:12:33 -0400
message:
  Fixed direct call of get_url in RemoteBranch.get_revision
------------------------------------------------------------
revno: 761
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 12:00:31 -0400
message:
  Added prefetch support to update_revisions
------------------------------------------------------------
revno: 760
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 11:57:54 -0400
message:
  Added cache support to branch and pull
------------------------------------------------------------
revno: 759
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 11:21:37 -0400
message:
  Added find_cached_branch to branch
------------------------------------------------------------
revno: 758
committer: Aaron Bentley <abentley@panoramicfeedback.com>
timestamp: Thu 2005-06-23 11:17:10 -0400
message:
  Added CachedStore type to reduce remote downloads

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        return Branch(f, **args)
46
46
 
47
47
 
 
48
def find_cached_branch(f, cache_root, **args):
 
49
    from remotebranch import RemoteBranch
 
50
    br = find_branch(f, **args)
 
51
    def cacheify(br, store_name):
 
52
        from meta_store import CachedStore
 
53
        cache_path = os.path.join(cache_root, store_name)
 
54
        os.mkdir(cache_path)
 
55
        new_store = CachedStore(getattr(br, store_name), cache_path)
 
56
        setattr(br, store_name, new_store)
 
57
 
 
58
    if isinstance(br, RemoteBranch):
 
59
        cacheify(br, 'inventory_store')
 
60
        cacheify(br, 'text_store')
 
61
        cacheify(br, 'revision_store')
 
62
    return br
 
63
 
48
64
 
49
65
def _relpath(base, path):
50
66
    """Return path relative to base, or raise exception.
752
768
 
753
769
        pb.update('comparing histories')
754
770
        revision_ids = self.missing_revisions(other, stop_revision)
 
771
 
 
772
        if hasattr(other.revision_store, "prefetch"):
 
773
            other.revision_store.prefetch(revision_ids)
 
774
        if hasattr(other.inventory_store, "prefetch"):
 
775
            inventory_ids = [other.get_revision(r).inventory_id
 
776
                             for r in revision_ids]
 
777
            other.inventory_store.prefetch(inventory_ids)
 
778
                
755
779
        revisions = []
756
780
        needed_texts = sets.Set()
757
781
        i = 0