Rev 4270: make ls not recursive by default (Ian Clatworthy) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 8 11:19:35 BST 2009


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

------------------------------------------------------------
revno: 4270
revision-id: pqm at pqm.ubuntu.com-20090408101928-9vp4pp5lwj6s25r1
parent: pqm at pqm.ubuntu.com-20090408093053-bmb2x9h7jeyac5b7
parent: ian.clatworthy at canonical.com-20090408083541-xrfiw9pd3fw1hu22
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-04-08 11:19:28 +0100
message:
  make ls not recursive by default (Ian Clatworthy)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
    ------------------------------------------------------------
    revno: 4267.2.1
    revision-id: ian.clatworthy at canonical.com-20090408083541-xrfiw9pd3fw1hu22
    parent: pqm at pqm.ubuntu.com-20090408062211-qhu50uezgnlj7ked
    parent: ian.clatworthy at canonical.com-20090326133831-orvicmmc6w29mpfp
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: ianc-integration
    timestamp: Wed 2009-04-08 18:35:41 +1000
    message:
      make ls not recursive by default (Ian Clatworthy)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
    ------------------------------------------------------------
    revno: 4206.2.1
    revision-id: ian.clatworthy at canonical.com-20090326133831-orvicmmc6w29mpfp
    parent: pqm at pqm.ubuntu.com-20090326063330-evutyvml3067dpsz
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: bzr.ls-recursive-off
    timestamp: Thu 2009-03-26 23:38:31 +1000
    message:
      ls should be non-recursive by default
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
=== modified file 'NEWS'
--- a/NEWS	2009-04-08 03:34:31 +0000
+++ b/NEWS	2009-04-08 08:35:41 +0000
@@ -6,6 +6,39 @@
 .. contents:: List of Releases
    :depth: 1
 
+In Development
+##############
+
+Compatibility Breaks
+********************
+
+* ``bzr ls`` is no longer recursive by default. To recurse, use the
+  new ``-R`` option. The old ``--non-recursive`` option has been removed.
+  If you alias ``ls`` to ``ls -R``, you can disable recursion using
+  ``--no-recursive`` instead.  (Ian Clatworthy)
+
+New Features
+************
+
+Improvements
+************
+
+Bug Fixes
+*********
+
+Documentation
+*************
+
+API Changes
+***********
+
+Testing
+*******
+
+Internals
+*********
+
+
 bzr 1.14rc1
 ###########
 :Codename: brisbane-core

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-04-08 03:34:31 +0000
+++ b/bzrlib/builtins.py	2009-04-08 08:35:41 +0000
@@ -2298,12 +2298,11 @@
 
     _see_also = ['status', 'cat']
     takes_args = ['path?']
-    # TODO: Take a revision or remote path and list that tree instead.
     takes_options = [
             'verbose',
             'revision',
-            Option('non-recursive',
-                   help='Don\'t recurse into subdirectories.'),
+            Option('recursive', short_name='R',
+                   help='Recurse into subdirectories.'),
             Option('from-root',
                    help='Print paths relative to the root of the branch.'),
             Option('unknown', help='Print unknown files.'),
@@ -2320,7 +2319,7 @@
             ]
     @display_command
     def run(self, revision=None, verbose=False,
-            non_recursive=False, from_root=False,
+            recursive=False, from_root=False,
             unknown=False, versioned=False, ignored=False,
             null=False, kind=None, show_ids=False, path=None):
 
@@ -2364,7 +2363,7 @@
             for fp, fc, fkind, fid, entry in tree.list_files(include_root=False):
                 if fp.startswith(relpath):
                     fp = osutils.pathjoin(prefix, fp[len(relpath):])
-                    if non_recursive and '/' in fp:
+                    if not recursive and '/' in fp:
                         continue
                     if not all and not selection[fc]:
                         continue

=== modified file 'bzrlib/tests/blackbox/test_ls.py'
--- a/bzrlib/tests/blackbox/test_ls.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_ls.py	2009-03-26 13:38:31 +0000
@@ -36,10 +36,12 @@
                                  ('a', 'hello\n'),
                                  ])
 
-    def ls_equals(self, value, args=None):
+    def ls_equals(self, value, args=None, recursive=True):
         command = 'ls'
         if args is not None:
             command += ' ' + args
+        if recursive:
+            command += ' -R'
         out, err = self.run_bzr(command)
         self.assertEqual('', err)
         self.assertEqualDiff(value, out)
@@ -108,19 +110,19 @@
                        'a\0a-id\0'
                        'subdir\0subdir-id\0', '--show-ids --null')
 
-    def test_ls_recursive(self):
+    def test_ls_no_recursive(self):
         self.build_tree(['subdir/', 'subdir/b'])
         self.wt.add(['a', 'subdir/', 'subdir/b', '.bzrignore'])
 
         self.ls_equals('.bzrignore\n'
                        'a\n'
                        'subdir/\n'
-                       , '--non-recursive')
+                       , recursive=False)
 
         self.ls_equals('V        .bzrignore\n'
                        'V        a\n'
                        'V        subdir/\n'
-                       , '--verbose --non-recursive')
+                       , '--verbose', recursive=False)
 
         # Check what happens in a sub-directory
         os.chdir('subdir')
@@ -140,7 +142,7 @@
         self.ls_equals('.bzrignore\n'
                        'a\n'
                        'subdir/\n'
-                       , '--from-root --non-recursive')
+                       , '--from-root', recursive=False)
 
     def test_ls_path(self):
         """If a path is specified, files are listed with that prefix"""




More information about the bazaar-commits mailing list