Rev 4784: Small tweaks and a NEWS entry. in file:///home/vila/src/bzr/reviews/bzr-pull-verbose-shows-tip-before-pull/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Dec 7 15:52:23 GMT 2009


At file:///home/vila/src/bzr/reviews/bzr-pull-verbose-shows-tip-before-pull/

------------------------------------------------------------
revno: 4784
revision-id: v.ladeuil+lp at free.fr-20091207155222-jk9xdb2endwrbs0u
parent: guilhem at mysql.com-20091204210514-ih6ine0ig20w35wp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bzr-pull-verbose-shows-tip-before-pull
timestamp: Mon 2009-12-07 16:52:22 +0100
message:
  Small tweaks and a NEWS entry.
  
  * bzrlib/tests/blackbox/test_pull.py:
  (TestPull.test_pull_verbose_prints_tip_before_pull,
  TestPull.test_pull_verbose_does_not_print_tip_when_nothing_is_pulled):
  Force the revids to simplify the tests.
  
  * bzrlib/builtins.py:
  (cmd_pull.run): Display both the revno and revid before pulling.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-11-03 03:58:26 +0000
+++ b/NEWS	2009-12-07 15:52:22 +0000
@@ -18,6 +18,11 @@
 New Features
 ************
 
+* ``bzr pull -v`` will now displays the tip revision before the pull
+  occurred to make it easier to rollback if needed. This is also
+  unconditionally recorded in ``.bzr.log``.
+  (Guilhem Bichot)
+
 Bug Fixes
 *********
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-12-04 21:05:14 +0000
+++ b/bzrlib/builtins.py	2009-12-07 15:52:22 +0000
@@ -931,8 +931,8 @@
     _see_also = ['push', 'update', 'status-flags', 'send']
     takes_options = ['remember', 'overwrite', 'revision',
         custom_help('verbose',
-            help='Show logs of pulled revisions, show destination branch\'s'
-                    ' tip before pulling.'),
+            help="Show logs of pulled revisions, show destination branch's"
+                    " tip before pulling."),
         Option('directory',
             help='Branch to pull into, '
                  'rather than the one containing the working directory.',
@@ -962,12 +962,12 @@
         except errors.NoWorkingTree:
             tree_to = None
             branch_to = Branch.open_containing(directory)[0]
-        
+
         if local and not branch_to.get_bound_location():
             raise errors.LocalRequiresBoundBranch()
 
-        tip_before_pull_msg = "Tip revision before pull was: {%s}" % \
-                              branch_to.last_revision()
+        tip_before_pull_msg = ("Tip revision before pull was: %d, revid:%s"
+                               % branch_to.last_revision_info())
         mutter(tip_before_pull_msg)
 
         possible_transports = []

=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py	2009-12-04 21:05:14 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2009-12-07 15:52:22 +0000
@@ -392,22 +392,18 @@
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 
     def test_pull_verbose_prints_tip_before_pull(self):
-        a_tree = self.example_branch('a')
-        a_rev_id = a_tree.branch.get_rev_id(1)
-        a_tree.bzrdir.sprout('b', revision_id=a_rev_id)
-        os.chdir('b')
-        out = self.run_bzr('pull -v')[0]
-        # not using assertContainsRe because revision id contains hostname
-        # which may contain '(' ')' which are special regex characters,
-        # which could make the regex matching fail.
-        # Alternative: implement assertContains().
-        self.assertNotEqual(out.find(r'Tip revision before pull was: {' +
-                                     a_rev_id + r'}') , -1)
+        parent = self.make_branch_and_tree('parent')
+        rev1 = parent.commit(message='first commit', rev_id='number-one')
+        rev2 = parent.commit(message='second commit', rev_id='number-two')
+        parent.bzrdir.sprout('branch', revision_id=rev1)
+        out = self.run_bzr('pull -d branch -v')[0]
+        self.assertContainsRe(out, 'Tip revision before pull was:'
+                              ' 1, revid:%s' % rev1)
 
-    def test_pull_non_verbose_does_not_print_tip_before_pull(self):
-        a_tree = self.example_branch('a')
-        a_rev_id = a_tree.branch.get_rev_id(1)
-        a_tree.bzrdir.sprout('b', revision_id=a_rev_id)
-        os.chdir('b')
-        out = self.run_bzr('pull')[0]
-        self.assertNotContainsRe(out, r'Tip revision before pull was: {')
+    def test_pull_verbose_does_not_print_tip_when_nothing_is_pulled(self):
+        parent = self.make_branch_and_tree('parent')
+        rev1 = parent.commit(message='first commit', rev_id='number-one')
+        rev2 = parent.commit(message='second commit', rev_id='number-two')
+        parent.bzrdir.sprout('branch', revision_id=rev2)
+        out = self.run_bzr('pull -d branch -v')[0]
+        self.assertNotContainsRe(out, 'Tip revision before pull was')



More information about the bazaar-commits mailing list