Rev 2579: (Daniel Watkins) Bug #113990 - update should print summary of changes (like pull does) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jul 4 03:40:22 BST 2007


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

------------------------------------------------------------
revno: 2579
revision-id: pqm at pqm.ubuntu.com-20070704024013-cwx0ld720nvdfb8q
parent: pqm at pqm.ubuntu.com-20070703184919-6iz3vo2rx42smf25
parent: ian.clatworthy at internode.on.net-20070704015326-c9vt1dxbxh7mmy26
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-07-04 03:40:13 +0100
message:
  (Daniel Watkins) Bug #113990 - update should print summary of changes (like pull does)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_update.py test_update.py-20060212125639-c4dad1a5c56d5919
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
    ------------------------------------------------------------
    revno: 2578.1.1
    merged: ian.clatworthy at internode.on.net-20070704015326-c9vt1dxbxh7mmy26
    parent: pqm at pqm.ubuntu.com-20070703184919-6iz3vo2rx42smf25
    parent: d.m.watkins at warwick.ac.uk-20070605001422-j0je4kv0k53l5y3z
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Wed 2007-07-04 11:53:26 +1000
    message:
      (Daniel Watkins) Bug #113990 - update should print summary of changes (like pull does)
    ------------------------------------------------------------
    revno: 2504.2.4
    merged: d.m.watkins at warwick.ac.uk-20070605001422-j0je4kv0k53l5y3z
    parent: d.m.watkins at warwick.ac.uk-20070604020326-xytfikeijqusd5v5
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 113990
    timestamp: Tue 2007-06-05 01:14:22 +0100
    message:
      Reformatted code to fit in 79 columns.
    ------------------------------------------------------------
    revno: 2504.2.3
    merged: d.m.watkins at warwick.ac.uk-20070604020326-xytfikeijqusd5v5
    parent: d.m.watkins at warwick.ac.uk-20070604002011-6xz29dbsc1z53n5t
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 113990
    timestamp: Mon 2007-06-04 03:03:26 +0100
    message:
      Further modified existing tests to cover the new output.
    ------------------------------------------------------------
    revno: 2504.2.2
    merged: d.m.watkins at warwick.ac.uk-20070604002011-6xz29dbsc1z53n5t
    parent: d.m.watkins at warwick.ac.uk-20070604001930-ixh34lrwhcw340wq
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 113990
    timestamp: Mon 2007-06-04 01:20:11 +0100
    message:
      Modified existing tests to reflect changes to output.
    ------------------------------------------------------------
    revno: 2504.2.1
    merged: d.m.watkins at warwick.ac.uk-20070604001930-ixh34lrwhcw340wq
    parent: pqm at pqm.ubuntu.com-20070602184854-kwqaduxs0b19r76n
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 113990
    timestamp: Mon 2007-06-04 01:19:30 +0100
    message:
      builtins.py now passes a delta._ChangeReporter down the line when update is called, causing the changes the update makes to be displayed.
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-07-03 00:40:04 +0000
+++ b/bzrlib/builtins.py	2007-07-04 01:53:26 +0000
@@ -1013,7 +1013,8 @@
                     revno = tree.branch.revision_id_to_revno(last_rev)
                     note("Tree is up to date at revision %d." % (revno,))
                     return 0
-            conflicts = tree.update()
+            conflicts = tree.update(delta._ChangeReporter(
+                                        unversioned_filter=tree.is_ignored))
             revno = tree.branch.revision_id_to_revno(tree.last_revision())
             note('Updated to revision %d.' % (revno,))
             if tree.get_parent_ids()[1:] != existing_pending_merges:

=== modified file 'bzrlib/tests/blackbox/test_update.py'
--- a/bzrlib/tests/blackbox/test_update.py	2007-06-26 10:12:33 +0000
+++ b/bzrlib/tests/blackbox/test_update.py	2007-07-04 01:53:26 +0000
@@ -66,8 +66,9 @@
         # now branch should be out of date
         out,err = self.run_bzr('update branch')
         self.assertEqual('', out)
-        self.assertEqual('All changes applied successfully.\n'
-                         'Updated to revision 1.\n', err)
+        self.assertContainsRe(err, '\+N  file')
+        self.assertEndsWith(err, 'All changes applied successfully.\n'
+                         'Updated to revision 1.\n')
         self.failUnlessExists('branch/file')
 
     def test_update_out_of_date_light_checkout(self):
@@ -80,9 +81,9 @@
         self.run_bzr('commit -m add-file checkout')
         # now checkout2 should be out of date
         out,err = self.run_bzr('update checkout2')
-        self.assertEqual('All changes applied successfully.\n'
-                         'Updated to revision 1.\n',
-                         err)
+        self.assertContainsRe(err, '\+N  file')
+        self.assertEndsWith(err, 'All changes applied successfully.\n'
+                         'Updated to revision 1.\n')
         self.assertEqual('', out)
 
     def test_update_conflicts_returns_2(self):
@@ -104,9 +105,10 @@
         a_file.write('Bar')
         a_file.close()
         out,err = self.run_bzr('update checkout2', retcode=1)
+        self.assertContainsRe(err, 'M  file')
         self.assertEqual(['1 conflicts encountered.',
                           'Updated to revision 2.'],
-                         err.split('\n')[1:3])
+                         err.split('\n')[-3:-1])
         self.assertContainsRe(err, 'Text conflict in file\n')
         self.assertEqual('', out)
 
@@ -144,6 +146,8 @@
         # get all three files and a pending merge.
         out, err = self.run_bzr('update', 'checkout')
         self.assertEqual('', out)
+        self.assertContainsRe(err, '\+N  file')
+        self.assertContainsRe(err, '\+N  file_b')
         self.assertContainsRe(err, 'Updated to revision 1.\n'
                                    'Your local commits will now show as'
                                    ' pending merges')
@@ -192,9 +196,9 @@
         # merges, because they were real merges
         out, err = self.run_bzr('update')
         self.assertEqual('', out)
-        self.assertEqual('All changes applied successfully.\n'
-                         'Updated to revision 2.\n', err)
-
+        self.assertEndsWith(err, 'All changes applied successfully.\n'
+                         'Updated to revision 2.\n')
+        self.assertContainsRe(err, r'\+N  file3')
         # The pending merges should still be there
         self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
 

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-06-28 07:15:28 +0000
+++ b/bzrlib/workingtree.py	2007-07-04 01:53:26 +0000
@@ -1970,7 +1970,7 @@
         """
         raise NotImplementedError(self.unlock)
 
-    def update(self):
+    def update(self, change_reporter=None):
         """Update a working tree along its branch.
 
         This will update the branch if its bound too, which means we have
@@ -2006,12 +2006,12 @@
                 old_tip = self.branch.update()
             else:
                 old_tip = None
-            return self._update_tree(old_tip)
+            return self._update_tree(old_tip, change_reporter)
         finally:
             self.unlock()
 
     @needs_tree_write_lock
-    def _update_tree(self, old_tip=None):
+    def _update_tree(self, old_tip=None, change_reporter=None):
         """Update a tree to the master branch.
 
         :param old_tip: if supplied, the previous tip revision the branch,
@@ -2045,7 +2045,8 @@
                                       self.branch,
                                       to_tree,
                                       basis,
-                                      this_tree=self)
+                                      this_tree=self,
+                                      change_reporter=change_reporter)
             finally:
                 basis.unlock()
             # TODO - dedup parents list with things merged by pull ?
@@ -2093,7 +2094,8 @@
                                   self.branch,
                                   other_tree,
                                   base_tree,
-                                  this_tree=self)
+                                  this_tree=self,
+                                  change_reporter=change_reporter)
         return result
 
     def _write_hashcache_if_dirty(self):




More information about the bazaar-commits mailing list