Rev 4785: Some tweaks to how we report the old branch tip. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-pull-v
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 8 17:41:22 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-pull-v
------------------------------------------------------------
revno: 4785
revision-id: john at arbash-meinel.com-20091208174106-2n6nk83xrkbvww17
parent: guilhem at mysql.com-20091207183417-z29qxg71kc56fusw
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-pull-v
timestamp: Tue 2009-12-08 11:41:06 -0600
message:
Some tweaks to how we report the old branch tip.
Instead of giving the revno in the original context, give it in the new context.
This way we can give just the revno and not the revision id.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-12-07 15:52:22 +0000
+++ b/bzrlib/builtins.py 2009-12-08 17:41:06 +0000
@@ -966,10 +966,6 @@
if local and not branch_to.get_bound_location():
raise errors.LocalRequiresBoundBranch()
- tip_before_pull_msg = ("Tip revision before pull was: %d, revid:%s"
- % branch_to.last_revision_info())
- mutter(tip_before_pull_msg)
-
possible_transports = []
if location is not None:
try:
@@ -1012,6 +1008,7 @@
if revision is not None:
revision_id = revision.as_revision_id(branch_from)
+ result = None
branch_to.lock_write()
try:
if tree_to is not None:
@@ -1026,12 +1023,18 @@
result = branch_to.pull(
branch_from, overwrite, revision_id, local=local)
+ mutter('Pulled from %s => %s in branch %s'
+ % (result.old_revid, result.new_revid, branch_to.base))
result.report(self.outf)
if verbose and result.old_revid != result.new_revid:
+ old_dotted_revno = branch_to.revision_id_to_dotted_revno(
+ result.old_revid)
+ old_dotted_revno = '.'.join([str(i) for i in old_dotted_revno])
+ self.outf.write('Tip revision before pull was: %s\n'
+ % (old_dotted_revno,))
log.show_branch_change(
branch_to, self.outf, result.old_revno,
result.old_revid)
- self.outf.write(tip_before_pull_msg + "\n")
finally:
branch_to.unlock()
finally:
=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py 2009-12-07 15:52:22 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py 2009-12-08 17:41:06 +0000
@@ -397,8 +397,23 @@
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)
+ self.assertContainsRe(out, 'Tip revision before pull was: 1')
+
+ def test_pull_verbose_prints_dotted_tip(self):
+ builder = self.make_branch_builder('source')
+ builder.start_series()
+ builder.build_snapshot('A', None, [
+ ('add', ('', 'TREE_ROOT', 'directory', None))])
+ builder.build_snapshot('B', ['A'], [])
+ builder.build_snapshot('C', ['B'], [])
+ builder.build_snapshot('D', ['A', 'C'], [])
+ builder.finish_series()
+ b = builder.get_branch()
+ b.lock_write()
+ self.addCleanup(b.unlock)
+ b.bzrdir.sprout('target', revision_id='C')
+ out = self.run_bzr('pull -d target -v')[0]
+ self.assertContainsRe(out, 'Tip revision before pull was: 1.1.2')
def test_pull_verbose_does_not_print_tip_when_nothing_is_pulled(self):
parent = self.make_branch_and_tree('parent')
More information about the bazaar-commits
mailing list