Rev 3348: Support status --no-pending (jwestby #202830) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 9 06:57:14 BST 2008


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

------------------------------------------------------------
revno: 3348
revision-id:pqm at pqm.ubuntu.com-20080409055704-gkzxh5nkpxai1h6x
parent: pqm at pqm.ubuntu.com-20080409041736-3oh91gmqxjq9xnoc
parent: aaron at aaronbentley.com-20080409030055-ih70q9lit130fuzx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-04-09 06:57:04 +0100
message:
  Support status --no-pending (jwestby #202830)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
    ------------------------------------------------------------
    revno: 3346.1.1
    revision-id:aaron at aaronbentley.com-20080409030055-ih70q9lit130fuzx
    parent: pqm at pqm.ubuntu.com-20080408192311-eoozb2m0s383xt35
    parent: jw+debian at jameswestby.net-20080316151757-2jaszc20rxd30m1t
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Tue 2008-04-08 23:00:55 -0400
    message:
      Merge no-pending fix
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
    ------------------------------------------------------------
    revno: 3270.6.1
    revision-id:jw+debian at jameswestby.net-20080316151757-2jaszc20rxd30m1t
    parent: pqm at pqm.ubuntu.com-20080313004030-mff9aq1jfg13n0qi
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.jw
    timestamp: Sun 2008-03-16 15:17:57 +0000
    message:
      Add --no-pending to status to not show the pending merges. (#202830)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
=== modified file 'NEWS'
--- a/NEWS	2008-04-08 19:23:11 +0000
+++ b/NEWS	2008-04-09 03:00:55 +0000
@@ -16,7 +16,7 @@
 
    * On Linux bzr additionally looks for plugins in arch-independent site
      directory. (Toshio Kuratomi)
- 
+
    * When a plugin cannot be loaded as the file path is not a valid
      python module name bzr will now strip a ``bzr_`` prefix from the
      front of the suggested name, as many plugins (e.g. bzr-svn)
@@ -37,6 +37,10 @@
 
     * Added start_commit hook for mutable trees. (Jelmer Vernooij, #186422)
 
+    * ``status`` now accepts ``--no-pending`` to show the status without
+      listing pending merges, which speeds up the command a lot on large
+      histories.  (James Westby, #202830)
+
   IMPROVEMENTS:
 
     * ``bzr commit --fixes`` now recognises "gnome" as a tag by default.

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-04-04 00:43:07 +0000
+++ b/bzrlib/builtins.py	2008-04-09 03:00:55 +0000
@@ -166,7 +166,9 @@
                      Option('short', help='Use short status indicators.',
                             short_name='S'),
                      Option('versioned', help='Only show versioned files.',
-                            short_name='V')
+                            short_name='V'),
+                     Option('no-pending', help='Don\'t show pending merges.',
+                           ),
                      ]
     aliases = ['st', 'stat']
 
@@ -175,7 +177,7 @@
     
     @display_command
     def run(self, show_ids=False, file_list=None, revision=None, short=False,
-            versioned=False):
+            versioned=False, no_pending=False):
         from bzrlib.status import show_tree_status
 
         if revision and len(revision) > 2:
@@ -186,7 +188,8 @@
             
         show_tree_status(tree, show_ids=show_ids,
                          specific_files=file_list, revision=revision,
-                         to_file=self.outf, short=short, versioned=versioned)
+                         to_file=self.outf, short=short, versioned=versioned,
+                         show_pending=not no_pending)
 
 
 class cmd_cat_revision(Command):

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2007-09-04 01:20:26 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2008-03-16 15:17:57 +0000
@@ -44,20 +44,22 @@
 class BranchStatus(TestCaseWithTransport):
     
     def assertStatus(self, expected_lines, working_tree,
-        revision=None, short=False):
+        revision=None, short=False, pending=True):
         """Run status in working_tree and look for output.
         
         :param expected_lines: The lines to look for.
         :param working_tree: The tree to run status in.
         """
-        output_string = self.status_string(working_tree, revision, short)
+        output_string = self.status_string(working_tree, revision, short,
+                pending)
         self.assertEqual(expected_lines, output_string.splitlines(True))
     
-    def status_string(self, wt, revision=None, short=False):
+    def status_string(self, wt, revision=None, short=False, pending=True):
         # use a real file rather than StringIO because it doesn't handle
         # Unicode very well.
         tof = codecs.getwriter('utf-8')(TemporaryFile())
-        show_tree_status(wt, to_file=tof, revision=revision, short=short)
+        show_tree_status(wt, to_file=tof, revision=revision, short=short,
+                show_pending=pending)
         tof.seek(0)
         return tof.read().decode('utf-8')
 
@@ -102,6 +104,17 @@
                 'P   pending at pending-0-0\n',
             ],
             wt, short=True)
+        self.assertStatus([
+                'unknown:\n',
+                '  bye.c\n',
+                '  hello.c\n',
+            ],
+            wt, pending=False)
+        self.assertStatus([
+                '?   bye.c\n',
+                '?   hello.c\n',
+            ],
+            wt, short=True, pending=False)
 
     def test_branch_status_revisions(self):
         """Tests branch status with revisions"""
@@ -415,6 +428,22 @@
         out, err = self.run_bzr('status -r 1..23..123', retcode=3)
         self.assertContainsRe(err, 'one or two revision specifiers')
 
+    def test_status_no_pending(self):
+        a_tree = self.make_branch_and_tree('a')
+        self.build_tree(['a/a'])
+        a_tree.add('a')
+        a_tree.commit('a')
+        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
+        self.build_tree(['b/b'])
+        b_tree.add('b')
+        b_tree.commit('b')
+
+        chdir('a')
+        self.run_bzr('merge ../b')
+        out, err = self.run_bzr('status --no-pending')
+        self.assertEquals(out, "added:\n  b\n")
+
+
 
 class TestStatusEncodings(TestCaseWithTransport):
     




More information about the bazaar-commits mailing list