Rev 2545: Note lsprof filename via trace.note, not stdout in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jun 22 17:08:27 BST 2007


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

------------------------------------------------------------
revno: 2545
revision-id: pqm at pqm.ubuntu.com-20070622160825-17gv0lorkzbr3x76
parent: pqm at pqm.ubuntu.com-20070621070542-od3c9uxurv03i41p
parent: abentley at panoramicfeedback.com-20070622152719-b843debqfvuykj0y
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-06-22 17:08:25 +0100
message:
  Note lsprof filename via trace.note, not stdout
added:
  bzrlib/tests/blackbox/test_lsprof.py test_lsprof.py-20070622025641-nbsm2svy8anvj9df-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.33
    merged: abentley at panoramicfeedback.com-20070622152719-b843debqfvuykj0y
    parent: abentley at panoramicfeedback.com-20070622152525-6uh2x3zz21s95t5q
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-06-22 11:27:19 -0400
    message:
      Add NEWS entry
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.32
    merged: abentley at panoramicfeedback.com-20070622152525-6uh2x3zz21s95t5q
    parent: abentley at panoramicfeedback.com-20070622152245-e5cewlvmqlj3q76w
    parent: pqm at pqm.ubuntu.com-20070621070542-od3c9uxurv03i41p
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-06-22 11:25:25 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.31
    merged: abentley at panoramicfeedback.com-20070622152245-e5cewlvmqlj3q76w
    parent: aaron.bentley at utoronto.ca-20070622032823-2rsipnu2wmt1qoa3
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-06-22 11:22:45 -0400
    message:
      Add check for LSProf
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.30
    merged: aaron.bentley at utoronto.ca-20070622032823-2rsipnu2wmt1qoa3
    parent: aaron.bentley at utoronto.ca-20070619052015-y7r2d7i5sihpfadm
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Thu 2007-06-21 23:28:23 -0400
    message:
      Write lsprof file name to stderr, not stdout
=== added file 'bzrlib/tests/blackbox/test_lsprof.py'
--- a/bzrlib/tests/blackbox/test_lsprof.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/blackbox/test_lsprof.py	2007-06-22 15:22:45 +0000
@@ -0,0 +1,33 @@
+# Copyright (C) 2005, 2006, 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from bzrlib import tests
+from bzrlib.tests import test_lsprof
+
+
+class TestLSProf(tests.TestCaseInTempDir):
+
+    _test_needs_features = [test_lsprof.LSProfFeature]
+
+    def test_file(self):
+        out, err = self.run_bzr('--lsprof-file', 'output.callgrind', 'rocks')
+        self.assertNotContainsRe(out, 'Profile data written to')
+        self.assertContainsRe(err, 'Profile data written to')
+
+    def test_stdout(self):
+        out, err = self.run_bzr('--lsprof', 'rocks')
+        self.assertContainsRe(out, 'CallCount')
+        self.assertNotContainsRe(err, 'Profile data written to')

=== modified file 'NEWS'
--- a/NEWS	2007-06-21 06:39:27 +0000
+++ b/NEWS	2007-06-22 15:27:19 +0000
@@ -38,6 +38,9 @@
     * Various operations that are now faster due to avoiding unnecessary
       topological sorts. (Aaron Bentley)
 
+    * The lsprof filename note is emitted via trace.note(), not standard
+      output.  (Aaron Bentley)
+
   TESTING:
 
     * Removed the ``--keep-output`` option from selftest and clean up test

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2007-06-06 11:06:04 +0000
+++ b/bzrlib/commands.py	2007-06-22 03:28:23 +0000
@@ -534,14 +534,13 @@
 
 def apply_lsprofiled(filename, the_callable, *args, **kwargs):
     from bzrlib.lsprof import profile
-    import cPickle
     ret, stats = profile(the_callable, *args, **kwargs)
     stats.sort()
     if filename is None:
         stats.pprint()
     else:
         stats.save(filename)
-        print 'Profile data written to %r.' % filename
+        trace.note('Profile data written to "%s".', filename)
     return ret
 
 

=== modified file 'bzrlib/tests/blackbox/__init__.py'
--- a/bzrlib/tests/blackbox/__init__.py	2007-04-25 06:50:22 +0000
+++ b/bzrlib/tests/blackbox/__init__.py	2007-06-22 03:28:23 +0000
@@ -69,6 +69,7 @@
                      'bzrlib.tests.blackbox.test_log',
                      'bzrlib.tests.blackbox.test_logformats',
                      'bzrlib.tests.blackbox.test_ls',
+                     'bzrlib.tests.blackbox.test_lsprof',
                      'bzrlib.tests.blackbox.test_merge',
                      'bzrlib.tests.blackbox.test_merge_directive',
                      'bzrlib.tests.blackbox.test_missing',




More information about the bazaar-commits mailing list