~jelmer/bzr-builddeb/627718-auto-v3

« back to all changes in this revision

Viewing changes to cmds.py

merge use of directories relative to working tree specified rather than path specified.

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
        if location is None:
214
214
            location = "."
215
215
        is_local = urlparse.urlsplit(location)[0] in ('', 'file')
216
 
        tree, branch, relpath = BzrDir.open_containing_tree_or_branch(location)
217
 
        return tree, branch, is_local
 
216
        bzrdir, relpath = BzrDir.open_containing(location)
 
217
        tree, branch = bzrdir._get_tree_branch()
 
218
        return tree, branch, is_local, bzrdir.user_url
218
219
 
219
220
    def _get_build_tree(self, revision, tree, branch):
220
221
        if revision is None and tree is not None:
256
257
            builder += " " + " ".join(build_options)
257
258
        return builder
258
259
 
259
 
    def _get_dirs(self, config, branch, is_local, result_dir, build_dir, orig_dir):
 
260
    def _get_dirs(self, config, location, is_local, result_dir, build_dir, orig_dir):
260
261
        def _get_dir(supplied, if_local, if_not):
261
262
            if supplied is None:
262
263
                if is_local:
266
267
            if supplied is not None:
267
268
                if is_local:
268
269
                    supplied = os.path.join(
269
 
                            urlutils.local_path_from_url(branch.base),
 
270
                            urlutils.local_path_from_url(location),
270
271
                            supplied)
271
272
                    supplied = os.path.realpath(supplied)
272
273
            return supplied
334
335
            source=False, revision=None, result=None, package_merge=None):
335
336
        if result is not None:
336
337
            warning("--result is deprected, use --result-dir instead")
337
 
        branch, build_options, source = self._branch_and_build_options(
 
338
        location, build_options, source = self._branch_and_build_options(
338
339
                branch_or_build_options_list, source)
339
 
        tree, branch, is_local = self._get_tree_and_branch(branch)
 
340
        tree, branch, is_local, location = self._get_tree_and_branch(location)
340
341
        tree, working_tree = self._get_build_tree(revision, tree, branch)
341
342
 
342
343
        if len(tree.conflicts()) > 0:
374
375
                    build_options.append("-sa")
375
376
            build_cmd = self._get_build_command(config, builder, quick,
376
377
                    build_options)
377
 
            result_dir, build_dir, orig_dir = self._get_dirs(config, branch,
378
 
                    is_local, result_dir or result, build_dir, orig_dir)
 
378
            result_dir, build_dir, orig_dir = self._get_dirs(config,
 
379
                location or ".", is_local, result_dir or result, build_dir, orig_dir)
379
380
 
380
381
            upstream_sources = [
381
382
                PristineTarSource(tree, branch),
450
451
                    if is_local:
451
452
                        target_dir = result_dir or default_result_dir
452
453
                        target_dir = os.path.join(
453
 
                                urlutils.local_path_from_url(branch.base),
 
454
                                urlutils.local_path_from_url(location),
454
455
                                target_dir)
455
456
                    else:
456
457
                        target_dir = "."