~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to patches/cache-remote-revisions.diff

  • Committer: Martin Pool
  • Date: 2005-06-28 03:02:31 UTC
  • Revision ID: mbp@sourcefrog.net-20050628030231-d311e4ebcd467ef4
Merge John's import-speedup branch:

                                                                                         
  777 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:32 -0500
      revision-id: john@arbash-meinel.com-20050627032031-e82a50db3863b18e
      bzr selftest was not using the correct bzr

  776 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:22 -0500
      revision-id: john@arbash-meinel.com-20050627032021-c9f21fde989ddaee
      Add was using an old mutter

  775 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:02:33 -0500
      revision-id: john@arbash-meinel.com-20050627030233-9165cfe98fc63298
      Cleaned up to be less different

  774 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:54:53 -0500
      revision-id: john@arbash-meinel.com-20050627025452-4260d0e744edef43
      Allow BZR_PLUGIN_PATH='' to negate plugin loading.

  773 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:49:34 -0500
      revision-id: john@arbash-meinel.com-20050627024933-b7158f67b7b9eae5
      Finished the previous cleanup (allowing load_plugins to be called twice)

  772 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:45:08 -0500
      revision-id: john@arbash-meinel.com-20050627024508-723b1df510d196fc
      Work on making the tests pass. versioning.py is calling run_cmd directly, but plugins have been loaded.

  771 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:32:29 -0500
      revision-id: john@arbash-meinel.com-20050627023228-79972744d7c53e15
      Got it down a little bit more by removing import of tree and inventory.

  770 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:26:05 -0500
      revision-id: john@arbash-meinel.com-20050627022604-350b9773ef622f95
      Reducing the number of import from bzrlib/__init__.py and bzrlib/branch.py

  769 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:32:25 -0500
      revision-id: john@arbash-meinel.com-20050627013225-32dd044f10d23948
      Updated revision.py and xml.py to include SubElement.

  768 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:56 -0500
      revision-id: john@arbash-meinel.com-20050627010356-ee66919e1c377faf
      Minor typo

  767 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:13 -0500
      revision-id: john@arbash-meinel.com-20050627010312-40d024007eb85051
      Caching the import

  766 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:51:47 -0500
      revision-id: john@arbash-meinel.com-20050627005147-5281c99e48ed1834
      Created wrapper functions for lazy import of ElementTree

  765 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:46:37 -0500
      revision-id: john@arbash-meinel.com-20050627004636-bf432902004a94c5
      Removed all of the test imports of cElementTree

  764 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:43:59 -0500
      revision-id: john@arbash-meinel.com-20050627004358-d137fbe9570dd71b
      Trying to make bzr startup faster.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
***************
 
2
*** 738,777 ****
 
3
          revisions = []
 
4
          pb = ProgressBar(show_spinner=True)
 
5
          total = len(revision_ids)
 
6
-         for i,f in enumerate(revision_ids):
 
7
-             revisions.append(other.get_revision(f))
 
8
-             pb.update('retrieving revisions', i+1, total)
 
9
-         pb.clear()
 
10
-         
 
11
-         needed_texts = sets.Set()
 
12
 
13
-         for index, rev in enumerate(revisions):
 
14
-             pb.update('Scanning revisions for file contents', index, total)
 
15
-             inv = other.get_inventory(str(rev.inventory_id))
 
16
-             for key, entry in inv.iter_entries():
 
17
-                 if entry.text_id is None:
 
18
-                     continue
 
19
-                 if entry.text_id not in self.text_store:
 
20
-                     needed_texts.add(entry.text_id)
 
21
-         pb.clear()
 
22
-         count = self.text_store.copy_multi(other.text_store, needed_texts, pb,
 
23
-                                            "Copying file contents")
 
24
-         pb.clear()
 
25
-         print "Added %d file contents." % count 
 
26
-         inventory_ids = [ f.inventory_id for f in revisions ]
 
27
-         count = self.inventory_store.copy_multi(other.inventory_store, 
 
28
-                                                 inventory_ids, pb,
 
29
-                                                 "Copying inventories")
 
30
-         pb.clear()
 
31
-         print "Added %d inventories." % count 
 
32
-         revision_ids = [ f.revision_id for f in revisions]
 
33
-         count = self.revision_store.copy_multi(other.revision_store, 
 
34
-                                                revision_ids, pb, 
 
35
-                                                "Copying revisions")
 
36
-         pb.clear()
 
37
-         for revision_id in revision_ids:
 
38
-             self.append_revision(revision_id)
 
39
-         print "Added %d revisions." % count
 
40
                      
 
41
          
 
42
      def commit(self, *args, **kw):
 
43
--- 738,799 ----
 
44
          revisions = []
 
45
          pb = ProgressBar(show_spinner=True)
 
46
          total = len(revision_ids)
 
47
+         tmp_dir = tempfile.mkdtemp(prefix = "temp-stores-")
 
48
+         try:
 
49
+             tmp_rev_dir = os.path.join(tmp_dir, "revisions")
 
50
+             os.mkdir(tmp_rev_dir)
 
51
+             tmp_revs = ImmutableStore(tmp_rev_dir)
 
52
+             count = tmp_revs.copy_multi(other.revision_store, revision_ids, pb, 
 
53
+                                         "Caching revisions")
 
54
+             #EVIL! Substituting a local partial store for a complete one
 
55
+             #This is a significant performance boost when complete one is
 
56
+             #a remote store. 
 
57
+             other.revision_store = tmp_revs
 
58
+             pb.clear()
 
59
 
60
+             for i,f in enumerate(revision_ids):
 
61
+                 revisions.append(other.get_revision(f))
 
62
+                 pb.update("Parsing revisions", i, len(revision_ids))
 
63
+             
 
64
+             needed_texts = sets.Set()
 
65
 
66
+             #Again with the EVIL.
 
67
+             tmp_rev_dir = os.path.join(tmp_dir, "inventories")
 
68
+             os.mkdir(tmp_rev_dir)
 
69
+             inv_ids = [r.inventory_id for r in revisions]
 
70
+             tmp_revs = ImmutableStore(tmp_rev_dir)
 
71
+             count = tmp_revs.copy_multi(other.inventory_store, inv_ids, pb, 
 
72
+                                         "Caching inventories")
 
73
+             other.inventory_store = tmp_revs
 
74
+             pb.clear()
 
75
+             for index, rev in enumerate(revisions):
 
76
+                 pb.update('Scanning revisions for file contents', index, total)
 
77
+                 inv = other.get_inventory(str(rev.inventory_id))
 
78
+                 for key, entry in inv.iter_entries():
 
79
+                     if entry.text_id is None:
 
80
+                         continue
 
81
+                     if entry.text_id not in self.text_store:
 
82
+                         needed_texts.add(entry.text_id)
 
83
+             pb.clear()
 
84
+             count = self.text_store.copy_multi(other.text_store, needed_texts, pb,
 
85
+                                                "Copying file contents")
 
86
+             pb.clear()
 
87
+             print "Added %d file contents." % count 
 
88
+             inventory_ids = [ f.inventory_id for f in revisions ]
 
89
+             count = self.inventory_store.copy_multi(other.inventory_store, 
 
90
+                                                     inventory_ids, pb,
 
91
+                                                     "Copying inventories")
 
92
+             pb.clear()
 
93
+             print "Added %d inventories." % count 
 
94
+             revision_ids = [ f.revision_id for f in revisions]
 
95
+             count = self.revision_store.copy_multi(other.revision_store, 
 
96
+                                                    revision_ids)
 
97
+             pb.clear()
 
98
+             for revision_id in revision_ids:
 
99
+                 self.append_revision(revision_id)
 
100
+             print "Added %d revisions." % count
 
101
+         finally:
 
102
+             shutil.rmtree(tmp_dir)
 
103
                      
 
104
          
 
105
      def commit(self, *args, **kw):