Rev 6245: (gz) Only imply --check-clean for version-info if {clean} is in the template in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 8 15:29:30 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6245 [merge]
revision-id: pqm at pqm.ubuntu.com-20111108152929-kblb3iedk1iqflui
parent: pqm at pqm.ubuntu.com-20111108134627-frw63i8mjehg2lic
parent: wence at gmx.li-20111108114957-gy0eknv0o8tigyt3
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-11-08 15:29:29 +0000
message:
  (gz) Only imply --check-clean for version-info if {clean} is in the template
   (Lawrence Mitchell)
modified:
  bzrlib/cmd_version_info.py     __init__.py-20051228204928-697d01fdca29c99b
  bzrlib/tests/blackbox/test_version_info.py test_bb_version_info.py-20051228204928-91711c6559d952f7
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/cmd_version_info.py'
--- a/bzrlib/cmd_version_info.py	2011-10-06 10:25:48 +0000
+++ b/bzrlib/cmd_version_info.py	2011-11-08 10:54:09 +0000
@@ -113,10 +113,15 @@
         else:
             b = wt.branch
 
-        if all or template:
+        if all:
             include_history = True
             check_clean = True
             include_file_revisions = True
+        if template:
+            include_history = True
+            include_file_revisions = True
+            if '{clean}' in template:
+                check_clean = True
 
         if revision is not None:
             revision_id = revision[0].as_revision_id(b)

=== modified file 'bzrlib/tests/blackbox/test_version_info.py'
--- a/bzrlib/tests/blackbox/test_version_info.py	2011-10-14 13:56:45 +0000
+++ b/bzrlib/tests/blackbox/test_version_info.py	2011-10-31 15:49:35 +0000
@@ -20,7 +20,7 @@
 
 from bzrlib.revision import NULL_REVISION
 from bzrlib.tests import TestCaseWithTransport
-
+from bzrlib.version_info_formats import VersionInfoBuilder
 
 class TestVersionInfo(TestCaseWithTransport):
 
@@ -150,7 +150,17 @@
             '"{revno} {branch_nick} {clean}\n" branch')
         self.assertEqual("2 branch 0\n", out)
         self.assertEqual("", err)
-    
+
+    def test_custom_no_clean_in_template(self):
+        def should_not_be_called(self):
+            raise AssertionError("Method on %r should not have been used" % (self,))
+        self.overrideAttr(VersionInfoBuilder, "_extract_file_revisions",
+                          should_not_be_called)
+        self.create_tree()
+        out, err = self.run_bzr('version-info --custom --template=r{revno} branch')
+        self.assertEqual("r2", out)
+        self.assertEqual("", err)
+
     def test_non_ascii(self):
         """Test that we can output non-ascii data"""
         

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-11-08 12:49:00 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-11-08 15:29:29 +0000
@@ -72,6 +72,10 @@
 * ``bzr upgrade`` no longer treats 'already up-to-date' exceptions as
   errors. (Benoît Pierre, #716560).
 
+* ``bzr version-info`` no longer populates the clean state for custom
+  templates unless {clean} is explicitly asked for.
+  (Lawrence Mitchell, #882541)
+
 * Fix finding the CPU count when using Python >= 2.6 on BSD-based systems.
   (Jelmer Vernooij, #887151)
 




More information about the bazaar-commits mailing list