~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-05 08:35:39 UTC
  • mfrom: (5521.1.2 670851-directory-and-files)
  • Revision ID: pqm@pqm.ubuntu.com-20101105083539-urkk2to9qakthagn
(vila) Respect --directory when path parameters are also used for shelve and
 restore (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
        return control.open_workingtree(), relpath
354
354
 
355
355
    @staticmethod
356
 
    def open_containing_paths(file_list, default_directory='.',
357
 
        canonicalize=True, apply_view=True):
 
356
    def open_containing_paths(file_list, default_directory=None,
 
357
                              canonicalize=True, apply_view=True):
358
358
        """Open the WorkingTree that contains a set of paths.
359
359
 
360
360
        Fail if the paths given are not all in a single tree.
362
362
        This is used for the many command-line interfaces that take a list of
363
363
        any number of files and that require they all be in the same tree.
364
364
        """
 
365
        if default_directory is None:
 
366
            default_directory = u'.'
365
367
        # recommended replacement for builtins.internal_tree_files
366
368
        if file_list is None or len(file_list) == 0:
367
369
            tree = WorkingTree.open_containing(default_directory)[0]
375
377
                    view_str = views.view_display_str(view_files)
376
378
                    note("Ignoring files outside view. View is %s" % view_str)
377
379
            return tree, file_list
378
 
        tree = WorkingTree.open_containing(file_list[0])[0]
 
380
        if default_directory == u'.':
 
381
            seed = file_list[0]
 
382
        else:
 
383
            seed = default_directory
 
384
            file_list = [osutils.pathjoin(default_directory, f)
 
385
                         for f in file_list]
 
386
        tree = WorkingTree.open_containing(seed)[0]
379
387
        return tree, tree.safe_relpath_files(file_list, canonicalize,
380
 
            apply_view=apply_view)
 
388
                                             apply_view=apply_view)
381
389
 
382
390
    def safe_relpath_files(self, file_list, canonicalize=True, apply_view=True):
383
391
        """Convert file_list into a list of relpaths in tree.