Rev 4109: (jamesw) Improve the help topic and errors around --fixes. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Mar 11 01:17:47 GMT 2009


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

------------------------------------------------------------
revno: 4109
revision-id: pqm at pqm.ubuntu.com-20090311011743-ei3fkpip8ecywy5k
parent: pqm at pqm.ubuntu.com-20090310131846-8f45p0k6f0nftk31
parent: james.westby at canonical.com-20090311003033-z9w8x8bz8uw2b4vg
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-03-11 01:17:43 +0000
message:
  (jamesw) Improve the help topic and errors around --fixes.
modified:
  bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
  bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
    ------------------------------------------------------------
    revno: 4108.1.2
    revision-id: james.westby at canonical.com-20090311003033-z9w8x8bz8uw2b4vg
    parent: james.westby at canonical.com-20090310233948-fybemou7wys2n7v9
    committer: James Westby <james.westby at canonical.com>
    branch nick: jamesw-integration
    timestamp: Wed 2009-03-11 10:30:33 +1000
    message:
      Remove the header line to avoid a problem with rst.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 4108.1.1
    revision-id: james.westby at canonical.com-20090310233948-fybemou7wys2n7v9
    parent: pqm at pqm.ubuntu.com-20090310131846-8f45p0k6f0nftk31
    parent: james.westby at canonical.com-20090310084456-gtmvlad2wx3oikza
    committer: James Westby <james.westby at canonical.com>
    branch nick: jamesw-integration
    timestamp: Wed 2009-03-11 09:39:48 +1000
    message:
      Improve the help topic and errors around --fixes.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
    ------------------------------------------------------------
    revno: 3535.10.11
    revision-id: james.westby at canonical.com-20090310084456-gtmvlad2wx3oikza
    parent: james.westby at canonical.com-20090310083930-4459ia6z28o8tmbu
    committer: James Westby <james.westby at canonical.com>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2009-03-10 18:44:56 +1000
    message:
      Fix test for change in error message.
    modified:
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
    ------------------------------------------------------------
    revno: 3535.10.10
    revision-id: james.westby at canonical.com-20090310083930-4459ia6z28o8tmbu
    parent: james.westby at canonical.com-20090310083535-7uqrw5k93ntpdc09
    committer: James Westby <james.westby at canonical.com>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2009-03-10 18:39:30 +1000
    message:
      Change "Tracker id" to "Abbreviation" to be less ambiguous.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 3535.10.9
    revision-id: james.westby at canonical.com-20090310083535-7uqrw5k93ntpdc09
    parent: james.westby at canonical.com-20090310080827-2mnz4bt4c5nepwqr
    committer: James Westby <james.westby at canonical.com>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2009-03-10 18:35:35 +1000
    message:
      Make the improved messages show up in the UI.
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 3535.10.8
    revision-id: james.westby at canonical.com-20090310080827-2mnz4bt4c5nepwqr
    parent: jw+debian at jameswestby.net-20080729231222-t1dg0d70jxicb62h
    committer: James Westby <james.westby at canonical.com>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2009-03-10 18:08:27 +1000
    message:
      Correct the id for bugs.debian.org in the help.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 3535.10.7
    revision-id: jw+debian at jameswestby.net-20080729231222-t1dg0d70jxicb62h
    parent: jw+debian at jameswestby.net-20080729220747-a8rvx49izztnr39k
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Wed 2008-07-30 00:12:22 +0100
    message:
      Make the --fixes option conform to the style guide check once more.
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 3535.10.6
    revision-id: jw+debian at jameswestby.net-20080729220747-a8rvx49izztnr39k
    parent: jw+debian at jameswestby.net-20080729215613-uo72ieu675jsp0rs
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 23:07:47 +0100
    message:
      Mention that the a plugin can support their tracker as the last resort.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 3535.10.5
    revision-id: jw+debian at jameswestby.net-20080729215613-uo72ieu675jsp0rs
    parent: jw+debian at jameswestby.net-20080729211234-ywhpd8ub44f60987
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 22:56:13 +0100
    message:
      Don't say "well-known" as suggested by Robert.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 3535.10.4
    revision-id: jw+debian at jameswestby.net-20080729211234-ywhpd8ub44f60987
    parent: jw+debian at jameswestby.net-20080729211043-15vil1xxss6uvp4q
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 22:12:34 +0100
    message:
      Give and example of --fixes in the help for the option.
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
    ------------------------------------------------------------
    revno: 3535.10.3
    revision-id: jw+debian at jameswestby.net-20080729211043-15vil1xxss6uvp4q
    parent: jw+debian at jameswestby.net-20080729195425-53q8lat7mz9rgfvl
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 22:10:43 +0100
    message:
      Talk about "trackers" rather than "tags" as it may be less confusing.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 3535.10.2
    revision-id: jw+debian at jameswestby.net-20080729195425-53q8lat7mz9rgfvl
    parent: jw+debian at jameswestby.net-20080729193626-9vvf16b4nlpypyiw
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 20:54:25 +0100
    message:
      Flesh out the bugs help topic and explain the simple things first.
    modified:
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
    ------------------------------------------------------------
    revno: 3535.10.1
    revision-id: jw+debian at jameswestby.net-20080729193626-9vvf16b4nlpypyiw
    parent: pqm at pqm.ubuntu.com-20080709135859-wq3r1d1fjcafelgw
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.bugs
    timestamp: Tue 2008-07-29 20:36:26 +0100
    message:
      Point to "bzr help bugs" from MalformedBugIdentifier.
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
=== modified file 'bzrlib/bugtracker.py'
--- a/bzrlib/bugtracker.py	2008-11-27 22:43:40 +0000
+++ b/bzrlib/bugtracker.py	2009-03-11 00:30:33 +0000
@@ -44,13 +44,32 @@
 recorded by using the --fixes option. For each bug marked as fixed, an
 entry is included in the 'bugs' revision property stating '<url> <status>'.
 (The only ``status`` value currently supported is ``fixed.``)
-Support for Launchpad's central bug tracker is built in. For other bug
-trackers, configuration is required in advance so that the correct URL
-can be recorded.
-
-In addition to Launchpad, Bazaar directly supports the generation of
-URLs appropriate for Bugzilla and Trac. If your project uses a different
-bug tracker, it is easy to add support for it.
+
+The --fixes option allows you to specify a bug tracker and a bug identifier
+rather than a full URL. This looks like
+
+    bzr commit --fixes <tracker>:<id>
+
+where "<tracker>" is an identifier for the bug tracker, and "<id>" is the
+identifier for that bug within the bugtracker, usually the bug number.
+
+Bazaar knows about a few bug trackers that have many users. If
+you use one of these bug trackers then there is no setup required to
+use this feature, you just need to know the tracker identifier to use.
+These are the bugtrackers that are built in:
+
+     URL                          | Abbreviation | Example
+     https://bugs.launchpad.net/  | lp           | lp:12345
+     http://bugs.debian.org/      | deb          | deb:12345
+     http://bugzilla.gnome.org/   | gnome        | gnome:12345
+
+For the bug trackers not listed above configuration is required.
+Support for generating the URLs for any project using Bugzilla or Trac
+is built in, along with a template mechanism for other bugtrackers with
+simple URL schemes. If your bug tracker can't be described by one
+of the schemes described below then you can write a plugin to support
+it.
+
 If you use Bugzilla or Trac, then you only need to set a configuration
 variable which contains the base URL of the bug tracker. These options
 can go into ``bazaar.conf``, ``branch.conf`` or into a branch-specific

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-03-10 02:44:32 +0000
+++ b/bzrlib/builtins.py	2009-03-10 23:39:48 +0000
@@ -2681,7 +2681,8 @@
                     help="Refuse to commit if there are unknown "
                     "files in the working tree."),
              ListOption('fixes', type=str,
-                    help="Mark a bug as being fixed by this revision."),
+                    help="Mark a bug as being fixed by this revision "
+                         "(see \"bzr help bugs\")."),
              ListOption('author', type=unicode,
                     help="Set the author's name, if it's different "
                          "from the committer."),
@@ -2704,18 +2705,18 @@
             tokens = fixed_bug.split(':')
             if len(tokens) != 2:
                 raise errors.BzrCommandError(
-                    "Invalid bug %s. Must be in the form of 'tag:id'. "
-                    "Commit refused." % fixed_bug)
+                    "Invalid bug %s. Must be in the form of 'tracker:id'. "
+                    "See \"bzr help bugs\" for more information on this "
+                    "feature.\nCommit refused." % fixed_bug)
             tag, bug_id = tokens
             try:
                 bug_url = bugtracker.get_bug_url(tag, branch, bug_id)
             except errors.UnknownBugTrackerAbbreviation:
                 raise errors.BzrCommandError(
                     'Unrecognized bug %s. Commit refused.' % fixed_bug)
-            except errors.MalformedBugIdentifier:
+            except errors.MalformedBugIdentifier, e:
                 raise errors.BzrCommandError(
-                    "Invalid bug identifier for %s. Commit refused."
-                    % fixed_bug)
+                    "%s\nCommit refused." % (str(e),))
             properties.append('%s fixed' % bug_url)
         return '\n'.join(properties)
 

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2009-03-07 20:45:34 +0000
+++ b/bzrlib/errors.py	2009-03-10 23:39:48 +0000
@@ -2503,7 +2503,8 @@
 
 class MalformedBugIdentifier(BzrError):
 
-    _fmt = "Did not understand bug identifier %(bug_id)s: %(reason)s"
+    _fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
+            'See "bzr help bugs" for more information on this feature.')
 
     def __init__(self, bug_id, reason):
         self.bug_id = bug_id

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2009-02-27 15:14:34 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2009-03-10 23:39:48 +0000
@@ -517,7 +517,9 @@
         self.build_tree(['tree/hello.txt'])
         tree.add('hello.txt')
         self.run_bzr_error(
-            ["Invalid bug identifier for %s. Commit refused." % 'lp:orange'],
+            ["Did not understand bug identifier orange: Must be an integer. "
+             "See \"bzr help bugs\" for more information on this feature.\n"
+             "Commit refused."],
             'commit -m add-b --fixes=lp:orange',
             working_dir='tree')
 
@@ -527,7 +529,8 @@
         self.build_tree(['tree/hello.txt'])
         tree.add('hello.txt')
         self.run_bzr_error(
-            [r"Invalid bug orange. Must be in the form of 'tag:id'\. "
+            [r"Invalid bug orange. Must be in the form of 'tracker:id'\. "
+             r"See \"bzr help bugs\" for more information on this feature.\n"
              r"Commit refused\."],
             'commit -m add-b --fixes=orange',
             working_dir='tree')

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2009-02-24 08:09:17 +0000
+++ b/bzrlib/tests/test_errors.py	2009-03-10 23:39:48 +0000
@@ -404,7 +404,8 @@
         """Test the formatting of MalformedBugIdentifier."""
         error = errors.MalformedBugIdentifier('bogus', 'reason for bogosity')
         self.assertEqual(
-            "Did not understand bug identifier bogus: reason for bogosity",
+            'Did not understand bug identifier bogus: reason for bogosity. '
+            'See "bzr help bugs" for more information on this feature.',
             str(error))
 
     def test_unknown_bug_tracker_abbreviation(self):




More information about the bazaar-commits mailing list