Rev 2796: The location being committed to is displayed. (Daniel Watkins, #52479) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 5 03:36:07 BST 2007


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

------------------------------------------------------------
revno: 2796
revision-id: pqm at pqm.ubuntu.com-20070905023600-6h6s51el362b171a
parent: pqm at pqm.ubuntu.com-20070905001648-0iigag4tq1u8mywn
parent: d.m.watkins at warwick.ac.uk-20070905004301-5fcr0ozifdbds1ui
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-09-05 03:36:00 +0100
message:
  The location being committed to is displayed.  (Daniel Watkins, #52479)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
    ------------------------------------------------------------
    revno: 2747.6.13
    merged: d.m.watkins at warwick.ac.uk-20070905004301-5fcr0ozifdbds1ui
    parent: d.m.watkins at warwick.ac.uk-20070905004051-hpi85tnra0ex5cf2
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 01:43:01 +0100
    message:
      Renamed test to reflect what it is actually doing.
    ------------------------------------------------------------
    revno: 2747.6.12
    merged: d.m.watkins at warwick.ac.uk-20070905004051-hpi85tnra0ex5cf2
    parent: d.m.watkins at warwick.ac.uk-20070905003607-e11a396avb4eqv62
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 01:40:51 +0100
    message:
      Modified tests to match new output.
    ------------------------------------------------------------
    revno: 2747.6.11
    merged: d.m.watkins at warwick.ac.uk-20070905003607-e11a396avb4eqv62
    parent: d.m.watkins at warwick.ac.uk-20070904232551-atbaa0o3wlb8utrp
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 01:36:07 +0100
    message:
      Modified ReportCommitToLog.started to use urlutils.unescape_for_display for 'location'.
    ------------------------------------------------------------
    revno: 2747.6.10
    merged: d.m.watkins at warwick.ac.uk-20070904232551-atbaa0o3wlb8utrp
    parent: d.m.watkins at warwick.ac.uk-20070904232325-s9tp2gafe0k3wulh
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:25:51 +0100
    message:
      Updated NEWS.
    ------------------------------------------------------------
    revno: 2747.6.9
    merged: d.m.watkins at warwick.ac.uk-20070904232325-s9tp2gafe0k3wulh
    parent: d.m.watkins at warwick.ac.uk-20070904232308-llshdntwiiiruzw6
    parent: pqm at pqm.ubuntu.com-20070904035759-iv4xl6d7ez69txba
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:23:25 +0100
    message:
      Merged bzr.dev.
    ------------------------------------------------------------
    revno: 2747.6.8
    merged: d.m.watkins at warwick.ac.uk-20070904232308-llshdntwiiiruzw6
    parent: d.m.watkins at warwick.ac.uk-20070904231500-npa4t7kodp415c1l
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:23:08 +0100
    message:
      Minor fix.
    ------------------------------------------------------------
    revno: 2747.6.7
    merged: d.m.watkins at warwick.ac.uk-20070904231500-npa4t7kodp415c1l
    parent: d.m.watkins at warwick.ac.uk-20070904231442-4ux6nn86qa13gh2g
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:15:00 +0100
    message:
      Modify tests to reflect change in commit output.
    ------------------------------------------------------------
    revno: 2747.6.6
    merged: d.m.watkins at warwick.ac.uk-20070904231442-4ux6nn86qa13gh2g
    parent: d.m.watkins at warwick.ac.uk-20070904231400-132tr6dhaqty9gzt
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:14:42 +0100
    message:
      Added call to CommitReport.started hook.
    ------------------------------------------------------------
    revno: 2747.6.5
    merged: d.m.watkins at warwick.ac.uk-20070904231400-132tr6dhaqty9gzt
    parent: d.m.watkins at warwick.ac.uk-20070826102337-k3rdbih0a0a4rzyz
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Wed 2007-09-05 00:14:00 +0100
    message:
      Added 'started' hook to CommitReporters and moved location functionality from completed hook into it.
    ------------------------------------------------------------
    revno: 2747.6.4
    merged: d.m.watkins at warwick.ac.uk-20070826102337-k3rdbih0a0a4rzyz
    parent: d.m.watkins at warwick.ac.uk-20070825190351-qbjrmoovuuln2m3k
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Sun 2007-08-26 12:23:37 +0200
    message:
      Modified test as suggested on-list.
    ------------------------------------------------------------
    revno: 2747.6.3
    merged: d.m.watkins at warwick.ac.uk-20070825190351-qbjrmoovuuln2m3k
    parent: d.m.watkins at warwick.ac.uk-20070825190206-th26i4r88y80tibw
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Sat 2007-08-25 21:03:51 +0200
    message:
      The message given when committing to a bound branch now includes the location of the master branch, fixing bug #52479.
    ------------------------------------------------------------
    revno: 2747.6.2
    merged: d.m.watkins at warwick.ac.uk-20070825190206-th26i4r88y80tibw
    parent: d.m.watkins at warwick.ac.uk-20070825190134-ymqv022bvz3869lq
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Sat 2007-08-25 21:02:06 +0200
    message:
      Added test for behaviour.
    ------------------------------------------------------------
    revno: 2747.6.1
    merged: d.m.watkins at warwick.ac.uk-20070825190134-ymqv022bvz3869lq
    parent: pqm at pqm.ubuntu.com-20070824133750-r25v5g25g1flggy6
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 52479
    timestamp: Sat 2007-08-25 21:01:34 +0200
    message:
      Added message at the end of commit for bound branches.
=== modified file 'NEWS'
--- a/NEWS	2007-09-04 04:12:07 +0000
+++ b/NEWS	2007-09-05 02:36:00 +0000
@@ -117,6 +117,9 @@
    * When two plugins conflict, the source of both the losing and now the
      winning definition is shown.  (Konstantin Mikhaylov, #5454)
 
+   * When committing to a branch, the location being committed to is
+     displayed.  (Daniel Watkins, #52479)
+
   IMPROVEMENTS:
 
    * Add the option "--show-diff" to the commit command in order to display

=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2007-09-02 05:37:08 +0000
+++ b/bzrlib/commit.py	2007-09-05 00:36:07 +0000
@@ -80,12 +80,16 @@
         deprecated_function,
         DEPRECATED_PARAMETER)
 from bzrlib.workingtree import WorkingTree
+from bzrlib.urlutils import unescape_for_display
 import bzrlib.ui
 
 
 class NullCommitReporter(object):
     """I report on progress of a commit."""
 
+    def started(self, revno, revid, location=None):
+        pass
+
     def snapshot_change(self, change, path):
         pass
 
@@ -121,6 +125,13 @@
             return
         self._note("%s %s", change, path)
 
+    def started(self, revno, rev_id, location=None):
+        if location is not None:
+            location = ' to "' + unescape_for_display(location, 'utf-8') + '"'
+        else:
+            location = ''
+        self._note('Committing revision %d%s.', revno, location)
+
     def completed(self, revno, rev_id):
         self._note('Committed revision %d.', revno)
     
@@ -290,7 +301,7 @@
             self._gather_parents()
             if len(self.parents) > 1 and self.specific_files:
                 raise errors.CannotCommitSelectedFileMerge(self.specific_files)
-            
+
             # Collect the changes
             self._set_progress_stage("Collecting changes",
                     entries_title="Directory")
@@ -298,6 +309,15 @@
                 self.config, timestamp, timezone, committer, revprops, rev_id)
             
             try:
+                # find the location being committed to
+                if self.bound_branch:
+                    master_location = self.master_branch.base
+                else:
+                    master_location = self.branch.base
+
+                # report the start of the commit
+                self.reporter.started(new_revno, self.rev_id, master_location)
+
                 self._update_builder_with_changes()
                 self._check_pointless()
 

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2007-09-04 03:57:59 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2007-09-05 00:43:01 +0000
@@ -35,7 +35,7 @@
         self.build_tree(['hello.txt'])
         out,err = self.run_bzr('commit -m empty', retcode=3)
         self.assertEqual('', out)
-        self.assertStartsWith(err, 'bzr: ERROR: no changes to commit.'
+        self.assertContainsRe(err, 'bzr: ERROR: no changes to commit\.'
                                   ' use --unchanged to commit anyhow\n')
 
     def test_commit_success(self):
@@ -75,9 +75,9 @@
         tree.add("hello.txt")
         out,err = self.run_bzr('commit -m added')
         self.assertEqual('', out)
-        self.assertEqual('added hello.txt\n'
-                         'Committed revision 1.\n',
-                         err)
+        self.assertContainsRe(err, '^Committing revision 1 to ".*"\.\n'
+                              'added hello.txt\n'
+                              'Committed revision 1.\n$',)
 
     def prepare_simple_history(self):
         """Prepare and return a working tree with one commit of one file"""
@@ -94,9 +94,9 @@
         self.build_tree_contents([('hello.txt', 'new contents')])
         out, err = self.run_bzr('commit -m modified')
         self.assertEqual('', out)
-        self.assertEqual('modified hello.txt\n'
-                         'Committed revision 2.\n',
-                         err)
+        self.assertContainsRe(err, '^Committing revision 2 to ".*"\.\n'
+                              'modified hello\.txt\n'
+                              'Committed revision 2\.\n$')
 
     def test_verbose_commit_renamed(self):
         # Verbose commit of renamed file should say so
@@ -104,9 +104,9 @@
         wt.rename_one('hello.txt', 'gutentag.txt')
         out, err = self.run_bzr('commit -m renamed')
         self.assertEqual('', out)
-        self.assertEqual('renamed hello.txt => gutentag.txt\n'
-                         'Committed revision 2.\n',
-                         err)
+        self.assertContainsRe(err, '^Committing revision 2 to ".*"\.\n'
+                              'renamed hello\.txt => gutentag\.txt\n'
+                              'Committed revision 2\.$\n')
 
     def test_verbose_commit_moved(self):
         # Verbose commit of file moved to new directory should say so
@@ -116,10 +116,10 @@
         wt.rename_one('hello.txt', 'subdir/hello.txt')
         out, err = self.run_bzr('commit -m renamed')
         self.assertEqual('', out)
-        self.assertEqualDiff('added subdir\n'
-                             'renamed hello.txt => subdir/hello.txt\n'
-                             'Committed revision 2.\n',
-                             err)
+        self.assertContainsRe(err, '^Committing revision 2 to ".*"\.\n'
+                              'added subdir\n'
+                              'renamed hello\.txt => subdir/hello\.txt\n'
+                              'Committed revision 2\.\n$')
 
     def test_verbose_commit_with_unknown(self):
         """Unknown files should not be listed by default in verbose output"""
@@ -129,9 +129,9 @@
         wt.add(['hello.txt'])
         out,err = self.run_bzr('commit -m added')
         self.assertEqual('', out)
-        self.assertEqual('added hello.txt\n'
-                         'Committed revision 1.\n',
-                         err)
+        self.assertContainsRe(err, '^Committing revision 1 to ".*"\.\n'
+                              'added hello\.txt\n'
+                              'Committed revision 1\.\n$')
 
     def test_verbose_commit_with_unchanged(self):
         """Unchanged files should not be listed by default in verbose output"""
@@ -142,9 +142,22 @@
         tree.add("hello.txt")
         out,err = self.run_bzr('commit -m added')
         self.assertEqual('', out)
-        self.assertEqual('added hello.txt\n'
-                         'Committed revision 2.\n',
-                         err)
+        self.assertContainsRe(err, '^Committing revision 2 to ".*"\.\n'
+                              'added hello\.txt\n'
+                              'Committed revision 2\.$\n')
+
+    def test_verbose_commit_includes_master_location(self):
+        """Location of master is displayed when committing to bound branch"""
+        a_tree = self.make_branch_and_tree('a')
+        self.build_tree(['a/b'])
+        a_tree.add('b')
+        a_tree.commit(message='Initial message')
+
+        b_tree = a_tree.branch.create_checkout('b')
+        expected = "%s/" % (os.path.abspath('a'), )
+        out, err = self.run_bzr('commit -m blah --unchanged', working_dir='b')
+        self.assertEqual(err, 'Committing revision 2 to "%s".\n'
+                         'Committed revision 2.\n' % expected)
 
     def test_commit_merge_reports_all_modified_files(self):
         # the commit command should show all the files that are shown by
@@ -198,9 +211,10 @@
         this_tree.merge_from_branch(other_tree.branch)
         os.chdir('this')
         out,err = self.run_bzr('commit -m added')
-        os.chdir('..')
         self.assertEqual('', out)
+        expected = '%s/' % (os.getcwd(), )
         self.assertEqualDiff(
+            'Committing revision 2 to "%s".\n'
             'modified filetomodify\n'
             'added newdir\n'
             'added newfile\n'
@@ -210,7 +224,7 @@
             'renamed filetorename => renamedfile\n'
             'deleted dirtoremove\n'
             'deleted filetoremove\n'
-            'Committed revision 2.\n',
+            'Committed revision 2.\n' % (expected, ),
             err)
 
     def test_empty_commit_message(self):
@@ -367,7 +381,9 @@
         output, err = self.run_bzr(
             'commit -m hello --fixes=lp:23452 tree/hello.txt')
         self.assertEqual('', output)
-        self.assertEqual('added hello.txt\nCommitted revision 1.\n', err)
+        self.assertContainsRe(err, 'Committing revision 1 to ".*"\.\n'
+                              'added hello\.txt\n'
+                              'Committed revision 1\.\n')
 
     def test_no_bugs_no_properties(self):
         """If no bugs are fixed, the bugs property is not set.




More information about the bazaar-commits mailing list