/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/tree_creator/kernel_like.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-15 03:19:49 UTC
  • mto: This revision was merged to the branch mainline in revision 1923.
  • Revision ID: john@arbash-meinel.com-20060815031949-3a28a6d6a9388586
I think it is actually better as simple helper functions on Benchmark

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
        if in_cache:
145
145
            self._protect_files(root+'/.bzr')
146
146
        return tree
147
 
 
148
 
 
149
 
# Helper functions to change the above classes into a single function call
150
 
 
151
 
def make_kernel_like_tree(test, root, link_working=True):
152
 
    """Setup a temporary tree roughly like a kernel tree.
153
 
    
154
 
    :param url: Creat the kernel like tree as a lightweight checkout
155
 
    of a new branch created at url.
156
 
    :param link_working: instead of creating a new copy of all files
157
 
        just hardlink the working tree. Tests must request this, because
158
 
        they must break links if they want to change the files
159
 
    """
160
 
    creator = KernelLikeTreeCreator(test, link_working=link_working)
161
 
    return creator.create(root=root)
162
 
 
163
 
 
164
 
def make_kernel_like_added_tree(test, root,
165
 
                                link_working=True,
166
 
                                hot_cache=True):
167
 
    """Make a kernel like tree, with all files added
168
 
 
169
 
    :param root: Where to create the files
170
 
    :param link_working: Instead of copying all of the working tree
171
 
        files, just hardlink them to the cached files. Tests can unlink
172
 
        files that they will change.
173
 
    :param hot_cache: Run through the newly created tree and make sure
174
 
        the stat-cache is correct. The old way of creating a freshly
175
 
        added tree always had a hot cache.
176
 
    """
177
 
    creator = KernelLikeAddedTreeCreator(test, link_working=link_working,
178
 
                                         hot_cache=hot_cache)
179
 
    return creator.create(root=root)
180
 
 
181
 
 
182
 
def make_kernel_like_committed_tree(test, root='.',
183
 
                                    link_working=True,
184
 
                                    link_bzr=False,
185
 
                                    hot_cache=True):
186
 
    """Make a kernel like tree, with all files added and committed
187
 
 
188
 
    :param root: Where to create the files
189
 
    :param link_working: Instead of copying all of the working tree
190
 
        files, just hardlink them to the cached files. Tests can unlink
191
 
        files that they will change.
192
 
    :param link_bzr: Hardlink the .bzr directory. For readonly 
193
 
        operations this is safe, and shaves off a lot of setup time
194
 
    """
195
 
    creator = KernelLikeCommittedTreeCreator(test,
196
 
                                             link_working=link_working,
197
 
                                             link_bzr=link_bzr,
198
 
                                             hot_cache=hot_cache)
199
 
    return creator.create(root=root)
200