~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Ian Clatworthy
  • Date: 2008-08-07 14:19:34 UTC
  • mto: (4029.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4030.
  • Revision ID: ian.clatworthy@canonical.com-20080807141934-oimoxsqgwgjxeo9g
centralise formatting of view file lists

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    tree as _mod_tree,
47
47
    ui,
48
48
    urlutils,
 
49
    views,
49
50
    )
50
51
from bzrlib.branch import Branch
51
52
from bzrlib.conflicts import ConflictList
93
94
            view_files = tree.views.lookup_view()
94
95
            if view_files:
95
96
                file_list = view_files
96
 
                view_str = ", ".join(view_files)
 
97
                view_str = views.view_display_str(view_files)
97
98
                note("ignoring files outside view: %s" % view_str)
98
99
        return tree, file_list
99
100
    tree = WorkingTree.open_containing(osutils.realpath(file_list[0]))[0]
121
122
    for filename in file_list:
122
123
        try:
123
124
            relpath = tree.relpath(osutils.dereference_path(filename))
124
 
            if  view_files and not is_inside_any(view_files, relpath):
 
125
            if  view_files and not osutils.is_inside_any(view_files, relpath):
125
126
                raise errors.FileOutsideView(filename, view_files)
126
127
            new_list.append(relpath)
127
128
        except errors.PathNotChild:
4649
4650
                self.outf.write("Disabled '%s' view.\n" % (current_view))
4650
4651
            else:
4651
4652
                tree.views.set_view_info(switch, view_dict)
4652
 
                view_str = ", ".join(tree.views.lookup_view())
4653
 
                self.outf.write("Using '%s' view: %s\n" % (switch,view_str))
 
4653
                view_str = views.view_display_str(tree.views.lookup_view())
 
4654
                self.outf.write("Using '%s' view: %s\n" % (switch, view_str))
4654
4655
        elif all:
4655
4656
            if view_dict:
4656
4657
                self.outf.write('Views defined:\n')
4659
4660
                        active = "=>"
4660
4661
                    else:
4661
4662
                        active = "  "
4662
 
                    view_str = ", ".join(view_dict[view])
4663
 
                    self.outf.write('%s %-20s %s\n' % (active,view,view_str))
 
4663
                    view_str = views.view_display_str(view_dict[view])
 
4664
                    self.outf.write('%s %-20s %s\n' % (active, view, view_str))
4664
4665
            else:
4665
4666
                self.outf.write('No views defined.\n')
4666
4667
        elif file_list:
4671
4672
                raise errors.BzrCommandError(
4672
4673
                    "Cannot change the 'off' pseudo view")
4673
4674
            tree.views.set_view(name, sorted(file_list))
4674
 
            view_str = ", ".join(tree.views.lookup_view())
 
4675
            view_str = views.view_display_str(tree.views.lookup_view())
4675
4676
            self.outf.write("Using '%s' view: %s\n" % (name, view_str))
4676
4677
        else:
4677
4678
            # list the files
4679
4680
                # No name given and no current view set
4680
4681
                self.outf.write('No current view.\n')
4681
4682
            else:
4682
 
                view_str = ", ".join(tree.views.lookup_view(name))
 
4683
                view_str = views.view_display_str(tree.views.lookup_view(name))
4683
4684
                self.outf.write("'%s' view is: %s\n" % (name, view_str))
4684
4685
 
4685
4686