Rev 4355: (igc) improve commit help and error message (Ian Clatworthy) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 13 06:39:17 BST 2009


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

------------------------------------------------------------
revno: 4355
revision-id: pqm at pqm.ubuntu.com-20090513053911-fjajgycew5in8q5s
parent: pqm at pqm.ubuntu.com-20090512090530-v9355ohetp61ltc1
parent: ian.clatworthy at canonical.com-20090512072558-mn4bct2nxz24oucu
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-05-13 06:39:11 +0100
message:
  (igc) improve commit help and error message (Ian Clatworthy)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 4353.1.1
    revision-id: ian.clatworthy at canonical.com-20090512072558-mn4bct2nxz24oucu
    parent: pqm at pqm.ubuntu.com-20090512045404-3gjp1vrdmrjpwjgh
    parent: ian.clatworthy at canonical.com-20090512042932-uepe968yp3immxo2
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: integration
    timestamp: Tue 2009-05-12 17:25:58 +1000
    message:
      (igc) improve commit help & error message (Ian Clatworthy)
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 4351.1.2
    revision-id: ian.clatworthy at canonical.com-20090512042932-uepe968yp3immxo2
    parent: ian.clatworthy at canonical.com-20090512041037-abg452eaen1uhgnn
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: commit-help
    timestamp: Tue 2009-05-12 14:29:32 +1000
    message:
      tweak grammar in error message
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 4351.1.1
    revision-id: ian.clatworthy at canonical.com-20090512041037-abg452eaen1uhgnn
    parent: pqm at pqm.ubuntu.com-20090512001525-dnk0gpt8n0h8rbvb
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: commit-help
    timestamp: Tue 2009-05-12 14:10:37 +1000
    message:
      improve commit help
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-05-11 18:35:20 +0000
+++ b/bzrlib/builtins.py	2009-05-12 04:29:32 +0000
@@ -2727,42 +2727,75 @@
 class cmd_commit(Command):
     """Commit changes into a new revision.
 
-    If no arguments are given, the entire tree is committed.
-
-    If selected files are specified, only changes to those files are
-    committed.  If a directory is specified then the directory and everything
-    within it is committed.
-
-    When excludes are given, they take precedence over selected files.
-    For example, too commit only changes within foo, but not changes within
-    foo/bar::
-
-      bzr commit foo -x foo/bar
-
-    If author of the change is not the same person as the committer, you can
-    specify the author's name using the --author option. The name should be
-    in the same format as a committer-id, e.g. "John Doe <jdoe at example.com>".
-    If there is more than one author of the change you can specify the option
-    multiple times, once for each author.
-
-    A selected-file commit may fail in some cases where the committed
-    tree would be invalid. Consider::
-
-      bzr init foo
-      mkdir foo/bar
-      bzr add foo/bar
-      bzr commit foo -m "committing foo"
-      bzr mv foo/bar foo/baz
-      mkdir foo/bar
-      bzr add foo/bar
-      bzr commit foo/bar -m "committing bar but not baz"
-
-    In the example above, the last commit will fail by design. This gives
-    the user the opportunity to decide whether they want to commit the
-    rename at the same time, separately first, or not at all. (As a general
-    rule, when in doubt, Bazaar has a policy of Doing the Safe Thing.)
-
-    Note: A selected-file commit after a merge is not yet supported.
+    An explanatory message needs to be given for each commit. This is
+    often done by using the --message option (getting the message from the
+    command line) or by using the --file option (getting the message from
+    a file). If neither of these options is given, an editor is opened for
+    the user to enter the message. To see the changed files in the
+    boilerplate text loaded into the editor, use the --show-diff option.
+
+    By default, the entire tree is committed and the person doing the
+    commit is assumed to be the author. These defaults can be overridden
+    as explained below.
+
+    :Selective commits:
+
+      If selected files are specified, only changes to those files are
+      committed.  If a directory is specified then the directory and
+      everything within it is committed.
+  
+      When excludes are given, they take precedence over selected files.
+      For example, to commit only changes within foo, but not changes
+      within foo/bar::
+  
+        bzr commit foo -x foo/bar
+  
+      A selective commit after a merge is not yet supported.
+
+    :Custom authors:
+
+      If the author of the change is not the same person as the committer,
+      you can specify the author's name using the --author option. The
+      name should be in the same format as a committer-id, e.g.
+      "John Doe <jdoe at example.com>". If there is more than one author of
+      the change you can specify the option multiple times, once for each
+      author.
+  
+    :Checks:
+
+      A common mistake is to forget to add a new file or directory before
+      running the commit command. The --strict option checks for unknown
+      files and aborts the commit if any are found. More advanced pre-commit
+      checks can be implemented by defining hooks. See ``bzr help hooks``
+      for details.
+
+    :Things to note:
+
+      If you accidentially commit the wrong changes or make a spelling
+      mistake in the commit message say, you can use the uncommit command
+      to undo it. See ``bzr help uncommit`` for details.
+
+      Hooks can also be configured to run after a commit. This allows you
+      to trigger updates to external systems like bug trackers. The --fixes
+      option can be used to record the association between a revision and
+      one or more bugs. See ``bzr help bugs`` for details.
+
+      A selective commit may fail in some cases where the committed
+      tree would be invalid. Consider::
+  
+        bzr init foo
+        mkdir foo/bar
+        bzr add foo/bar
+        bzr commit foo -m "committing foo"
+        bzr mv foo/bar foo/baz
+        mkdir foo/bar
+        bzr add foo/bar
+        bzr commit foo/bar -m "committing bar but not baz"
+  
+      In the example above, the last commit will fail by design. This gives
+      the user the opportunity to decide whether they want to commit the
+      rename at the same time, separately first, or not at all. (As a general
+      rule, when in doubt, Bazaar has a policy of Doing the Safe Thing.)
     """
     # TODO: Run hooks on tree to-be-committed, and after commit.
 
@@ -2773,7 +2806,7 @@
 
     # XXX: verbose currently does nothing
 
-    _see_also = ['bugs', 'uncommit']
+    _see_also = ['add', 'bugs', 'hooks', 'uncommit']
     takes_args = ['selected*']
     takes_options = [
             ListOption('exclude', type=str, short_name='x',
@@ -2900,8 +2933,8 @@
         except PointlessCommit:
             # FIXME: This should really happen before the file is read in;
             # perhaps prepare the commit; get the message; then actually commit
-            raise errors.BzrCommandError("no changes to commit."
-                              " use --unchanged to commit anyhow")
+            raise errors.BzrCommandError("No changes to commit."
+                              " Use --unchanged to commit anyhow.")
         except ConflictsInTree:
             raise errors.BzrCommandError('Conflicts detected in working '
                 'tree.  Use "bzr conflicts" to list, "bzr resolve FILE" to'

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2009-03-27 04:10:25 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2009-05-12 04:29:32 +0000
@@ -43,8 +43,8 @@
         self.build_tree(['hello.txt'])
         out,err = self.run_bzr('commit -m empty', retcode=3)
         self.assertEqual('', out)
-        self.assertContainsRe(err, 'bzr: ERROR: no changes to commit\.'
-                                  ' use --unchanged to commit anyhow\n')
+        self.assertContainsRe(err, 'bzr: ERROR: No changes to commit\.'
+                                  ' Use --unchanged to commit anyhow.\n')
 
     def test_commit_success(self):
         """Successful commit should not leave behind a bzr-commit-* file"""
@@ -395,7 +395,7 @@
 
         # With no changes, it should just be 'no changes'
         # Make sure that commit is failing because there is nothing to do
-        self.run_bzr_error(['no changes to commit'],
+        self.run_bzr_error(['No changes to commit'],
                            'commit --strict -m no-changes',
                            working_dir='tree')
 




More information about the bazaar-commits mailing list