Rev 6009: (jameinel) Make kind markers optional for bzr status. (Martin von Gagern) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jul 6 13:30:27 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6009 [merge]
revision-id: pqm at pqm.ubuntu.com-20110706133021-vflfbps9u5e9k09b
parent: pqm at pqm.ubuntu.com-20110704083457-ci2x6tjx21xri751
parent: martin.vgagern at gmx.net-20110601125356-lwozv2vecea6hxfz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-07-06 13:30:21 +0000
message:
  (jameinel) Make kind markers optional for bzr status. (Martin von Gagern)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-06-30 11:14:06 +0000
+++ b/bzrlib/builtins.py	2011-07-06 13:30:21 +0000
@@ -232,9 +232,10 @@
     unknown
         Not versioned and not matching an ignore pattern.
 
-    Additionally for directories, symlinks and files with an executable
-    bit, Bazaar indicates their type using a trailing character: '/', '@'
-    or '*' respectively.
+    Additionally for directories, symlinks and files with a changed
+    executable bit, Bazaar indicates their type using a trailing
+    character: '/', '@' or '*' respectively. These decorations can be
+    disabled using the '--no-classify' option.
 
     To see ignored files use 'bzr ignored'.  For details on the
     changes to file texts, use 'bzr diff'.
@@ -271,6 +272,9 @@
                             short_name='V'),
                      Option('no-pending', help='Don\'t show pending merges.',
                            ),
+                     Option('no-classify',
+                            help='Do not mark object type using indicator.',
+                           ),
                      ]
     aliases = ['st', 'stat']
 
@@ -279,7 +283,8 @@
 
     @display_command
     def run(self, show_ids=False, file_list=None, revision=None, short=False,
-            versioned=False, no_pending=False, verbose=False):
+            versioned=False, no_pending=False, verbose=False,
+            no_classify=False):
         from bzrlib.status import show_tree_status
 
         if revision and len(revision) > 2:
@@ -299,7 +304,8 @@
         show_tree_status(tree, show_ids=show_ids,
                          specific_files=relfile_list, revision=revision,
                          to_file=self.outf, short=short, versioned=versioned,
-                         show_pending=(not no_pending), verbose=verbose)
+                         show_pending=(not no_pending), verbose=verbose,
+                         classify=not no_classify)
 
 
 class cmd_cat_revision(Command):

=== modified file 'bzrlib/delta.py'
--- a/bzrlib/delta.py	2010-10-20 14:38:53 +0000
+++ b/bzrlib/delta.py	2011-06-01 12:53:56 +0000
@@ -174,7 +174,8 @@
     """Report changes between two trees"""
 
     def __init__(self, output=None, suppress_root_add=True,
-                 output_file=None, unversioned_filter=None, view_info=None):
+                 output_file=None, unversioned_filter=None, view_info=None,
+                 classify=True):
         """Constructor
 
         :param output: a function with the signature of trace.note, i.e.
@@ -189,6 +190,7 @@
         :param view_info: A tuple of view_name,view_files if only
             items inside a view are to be reported on, or None for
             no view filtering.
+        :param classify: Add special symbols to indicate file kind.
         """
         if output_file is not None:
             if output is not None:
@@ -213,6 +215,10 @@
                               'unversioned': '?', # versioned in neither
                               }
         self.unversioned_filter = unversioned_filter
+        if classify:
+            self.kind_marker = osutils.kind_marker
+        else:
+            self.kind_marker = lambda kind: ''
         if view_info is None:
             self.view_name = None
             self.view_files = []
@@ -267,7 +273,7 @@
             # if the file is not missing in the source, we show its kind
             # when we show two paths.
             if kind[0] is not None:
-                old_path += osutils.kind_marker(kind[0])
+                old_path += self.kind_marker(kind[0])
             old_path += " => "
         elif versioned == 'removed':
             # not present in target
@@ -282,10 +288,10 @@
             rename = self.versioned_map[versioned]
         # we show the old kind on the new path when the content is deleted.
         if modified == 'deleted':
-            path += osutils.kind_marker(kind[0])
+            path += self.kind_marker(kind[0])
         # otherwise we always show the current kind when there is one
         elif kind[1] is not None:
-            path += osutils.kind_marker(kind[1])
+            path += self.kind_marker(kind[1])
         if exe_change:
             exe = '*'
         else:
@@ -340,7 +346,7 @@
                         exe_change, kind)
 
 def report_delta(to_file, delta, short_status=False, show_ids=False, 
-         show_unchanged=False, indent='', filter=None):
+         show_unchanged=False, indent='', filter=None, classify=True):
     """Output this delta in status-like form to to_file.
 
     :param to_file: A file-like object where the output is displayed.
@@ -358,9 +364,13 @@
 
     :param filter: A callable receiving a path and a file id and
         returning True if the path should be displayed.
+
+    :param classify: Add special symbols to indicate file kind.
     """
 
     def decorate_path(path, kind, meta_modified=None):
+        if not classify:
+            return path
         if kind == 'directory':
             path += '/'
         elif kind == 'symlink':

=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2011-05-21 16:43:19 +0000
+++ b/bzrlib/status.py	2011-06-01 12:53:56 +0000
@@ -34,7 +34,7 @@
 def report_changes(to_file, old, new, specific_files, 
                    show_short_reporter, show_long_callback, 
                    short=False, want_unchanged=False, 
-                   want_unversioned=False, show_ids=False):
+                   want_unversioned=False, show_ids=False, classify=True):
     """Display summary of changes.
 
     This compares two trees with regards to a list of files, and delegates 
@@ -59,6 +59,7 @@
         files.
     :param show_ids: If set, includes each file's id.
     :param want_unversioned: If False, only shows versioned files.
+    :param classify: Add special symbols to indicate file kind.
     """
 
     if short:
@@ -76,7 +77,8 @@
             delta.unversioned if not new.is_ignored(unversioned[0])]
         show_long_callback(to_file, delta, 
                            show_ids=show_ids,
-                           show_unchanged=want_unchanged)
+                           show_unchanged=want_unchanged,
+                           classify=classify)
 
 
 def show_tree_status(wt, show_unchanged=None,
@@ -88,6 +90,7 @@
                      short=False,
                      verbose=False,
                      versioned=False,
+                     classify=True,
                      show_long_callback=_mod_delta.report_delta):
     """Display summary of changes.
 
@@ -117,6 +120,7 @@
     :param verbose: If True, show all merged revisions, not just
         the merge tips
     :param versioned: If True, only shows versioned files.
+    :param classify: Add special symbols to indicate file kind.
     :param show_long_callback: A callback: message = show_long_callback(to_file, delta, 
         show_ids, show_unchanged, indent, filter), only used with the long output
     """
@@ -161,11 +165,12 @@
 
             # Reporter used for short outputs
             reporter = _mod_delta._ChangeReporter(output_file=to_file,
-                unversioned_filter=new.is_ignored)
+                unversioned_filter=new.is_ignored, classify=classify)
             report_changes(to_file, old, new, specific_files, 
                            reporter, show_long_callback, 
                            short=short, want_unchanged=show_unchanged, 
-                           want_unversioned=want_unversioned, show_ids=show_ids)
+                           want_unversioned=want_unversioned, show_ids=show_ids,
+                           classify=classify)
 
             # show the ignored files among specific files (i.e. show the files
             # identified from input that we choose to ignore). 




More information about the bazaar-commits mailing list