Rev 3926: (abentley) Clean up and optimize pull -v and push -v in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jan 8 00:13:30 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3926
revision-id: pqm at pqm.ubuntu.com-20090108001325-wcp1mp2u7a4li3na
parent: pqm at pqm.ubuntu.com-20090107230451-wf9c14ejiue3wvaj
parent: aaron at aaronbentley.com-20090107123410-nzvdkgd91m7atuj1
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-01-08 00:13:25 +0000
message:
(abentley) Clean up and optimize pull -v and push -v
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/push.py push.py-20080606021927-5fe39050e8xne9un-1
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 3848.1.22
revision-id: aaron at aaronbentley.com-20090107123410-nzvdkgd91m7atuj1
parent: aaron at aaronbentley.com-20090107123109-ctc0oum02zg4kjdr
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Wed 2009-01-07 07:34:10 -0500
message:
Fix spelling
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
------------------------------------------------------------
revno: 3848.1.21
revision-id: aaron at aaronbentley.com-20090107123109-ctc0oum02zg4kjdr
parent: aaron at aaronbentley.com-20090102021640-h00h1vlndulevo2e
parent: pqm at pqm.ubuntu.com-20090106171520-9pzjoqa7m74hvhht
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Wed 2009-01-07 07:31:09 -0500
message:
Merge bzr.dev into pull-log
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/patiencediff.py patiencediff.py-20070721205536-jz8gaykeb7xtampk-1
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
------------------------------------------------------------
revno: 3848.1.20
revision-id: aaron at aaronbentley.com-20090102021640-h00h1vlndulevo2e
parent: aaron at aaronbentley.com-20090102015848-fk53vt2zz00nc24x
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2009-01-01 21:16:40 -0500
message:
Update NEWS
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3848.1.19
revision-id: aaron at aaronbentley.com-20090102015848-fk53vt2zz00nc24x
parent: aaron at aaronbentley.com-20090102014555-6hygozc4b5d578df
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2009-01-01 20:58:48 -0500
message:
Show log for non-initial push -v
modified:
bzrlib/push.py push.py-20080606021927-5fe39050e8xne9un-1
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
------------------------------------------------------------
revno: 3848.1.18
revision-id: aaron at aaronbentley.com-20090102014555-6hygozc4b5d578df
parent: aaron at aaronbentley.com-20090101192648-122w07gvty01uspo
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2009-01-01 20:45:55 -0500
message:
Update push to use show_branch_change
modified:
bzrlib/push.py push.py-20080606021927-5fe39050e8xne9un-1
------------------------------------------------------------
revno: 3848.1.17
revision-id: aaron at aaronbentley.com-20090101192648-122w07gvty01uspo
parent: aaron at aaronbentley.com-20081212045246-mno3aaknnmgzmau9
parent: pqm at pqm.ubuntu.com-20081224050842-15xix09apawzgs05
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2009-01-01 14:26:48 -0500
message:
Merge bzr.dev
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/_dirstate_helpers_c.h _dirstate_helpers_c.-20070802205935-hqo9yzuzjix271dd-1
bzrlib/atomicfile.py atomicfile.py-20050509044450-dbd24e6c564f7c66
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/delta.py delta.py-20050729221636-54cf14ef94783d0a
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/fifo_cache.py fifo_cache.py-20081209212307-31ffjwvteyvmydnf-1
bzrlib/foreign.py foreign.py-20081112170002-olsxmandkk8qyfuq-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/msgeditor.py msgeditor.py-20050901111708-ef6d8de98f5d8f2f
bzrlib/push.py push.py-20080606021927-5fe39050e8xne9un-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/shelf_ui.py shelver.py-20081005210102-33worgzwrtdw0yrm-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
bzrlib/tests/blackbox/test_shelve.py test_ls_shelf.py-20081202053526-thlo8yt0pi1cgor1-1
bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_fifo_cache.py test_fifo_cache.py-20081209212307-31ffjwvteyvmydnf-2
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_info.py test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/tests/test_source.py test_source.py-20051207061333-a58dea6abecc030d
bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
bzrlib/tests/workingtree_implementations/test_add.py test_add.py-20070226165239-4vo178spkrnhavc7-1
bzrlib/tests/workingtree_implementations/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
bzrlib/tests/workingtree_implementations/test_move.py test_move.py-20070225171927-mohn2vqj5fx7edc6-1
bzrlib/tests/workingtree_implementations/test_rename_one.py test_rename_one.py-20070226161242-2d8ibdedl700jgio-1
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/transport/decorator.py decorator.py-20060402223305-e913a0f25319ab42
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
bzrlib/xml4.py xml4.py-20050916091259-db5ab55e7e6ca324
bzrlib/xml5.py xml5.py-20080328030717-t9guwinq8hom0ar3-1
bzrlib/xml7.py xml7.py-20061029182747-d5tiiny21bvrd2jj-1
bzrlib/xml8.py xml5.py-20050907032657-aac8f960815b66b1
bzrlib/xml_serializer.py xml.py-20050309040759-57d51586fdec365d
doc/en/user-guide/organizing_branches.txt organizing_branches.-20071123154453-dk2mjhrg1vpjm5w2-3
doc/en/user-guide/publishing_a_branch.txt publishing_a_branch.-20071123055134-k5x4ekduci2lbn36-2
doc/en/user-guide/reusing_a_checkout.txt reusing_a_checkout.t-20071123055134-k5x4ekduci2lbn36-3
doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
doc/en/user-guide/using_checkouts.txt using_checkouts.txt-20071123055134-k5x4ekduci2lbn36-4
tools/win32/build_release.py build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
------------------------------------------------------------
revno: 3848.1.16
revision-id: aaron at aaronbentley.com-20081212045246-mno3aaknnmgzmau9
parent: aaron at aaronbentley.com-20081212044902-sua9um7pvz8uhug6
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 20:52:46 -0800
message:
Update NEWS
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3848.1.15
revision-id: aaron at aaronbentley.com-20081212044902-sua9um7pvz8uhug6
parent: aaron at aaronbentley.com-20081212044712-7mtluuokvaztvonx
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 20:49:02 -0800
message:
Stop determining branch format in pull.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
------------------------------------------------------------
revno: 3848.1.14
revision-id: aaron at aaronbentley.com-20081212044712-7mtluuokvaztvonx
parent: aaron at aaronbentley.com-20081212044327-620s5l5rd3r4fzc4
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 20:47:12 -0800
message:
Remove use old_rh
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
------------------------------------------------------------
revno: 3848.1.13
revision-id: aaron at aaronbentley.com-20081212044327-620s5l5rd3r4fzc4
parent: aaron at aaronbentley.com-20081212034503-9052jvv90ub5qobw
parent: pqm at pqm.ubuntu.com-20081212025611-838ms79rnxjl7yr2
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 20:43:27 -0800
message:
Merge bzr.dev into pull-log
added:
bzrlib/_chunks_to_lines_py.py _chunks_to_lines_py.-20081211024848-6uc3mtuje8j14l60-1
bzrlib/_chunks_to_lines_pyx.pyx _chunks_to_lines_pyx-20081211021736-op7n8vrxgrd8snfi-1
bzrlib/fifo_cache.py fifo_cache.py-20081209212307-31ffjwvteyvmydnf-1
bzrlib/tests/blackbox/test_shelve.py test_ls_shelf.py-20081202053526-thlo8yt0pi1cgor1-1
bzrlib/tests/per_repository/test_add_inventory_by_delta.py test_add_inventory_d-20081013002626-rut81igtlqb4590z-1
bzrlib/tests/test__chunks_to_lines.py test__chunks_to_line-20081211024848-6uc3mtuje8j14l60-2
bzrlib/tests/test_fifo_cache.py test_fifo_cache.py-20081209212307-31ffjwvteyvmydnf-2
modified:
.bzrignore bzrignore-20050311232317-81f7b71efa2db11a
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/lru_cache.py lru_cache.py-20070119165515-tlw203kuwh0id5gv-1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/shelf.py prepare_shelf.py-20081005181341-n74qe6gu1e65ad4v-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
bzrlib/tests/blackbox/test_revision_info.py test_revision_info.py-20050917162600-21dab3877aa348d7
bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
bzrlib/tests/per_repository/__init__.py __init__.py-20060131092037-9564957a7d4a841b
bzrlib/tests/per_repository/test_add_fallback_repository.py test_add_fallback_re-20080215040003-8w9n4ck9uqdxj18m-1
bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_graph.py test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
bzrlib/tests/test_lru_cache.py test_lru_cache.py-20070119165535-hph6rk4h9rzy4180-1
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_shelf.py test_prepare_shelf.p-20081005181341-n74qe6gu1e65ad4v-2
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
bzrlib/weave.py knit.py-20050627021749-759c29984154256b
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3848.1.12
revision-id: aaron at aaronbentley.com-20081212034503-9052jvv90ub5qobw
parent: aaron at aaronbentley.com-20081212024342-z9wf9wqms5hndjr0
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 19:45:03 -0800
message:
Fix test parameter order
modified:
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 3848.1.11
revision-id: aaron at aaronbentley.com-20081212024342-z9wf9wqms5hndjr0
parent: aaron at aaronbentley.com-20081211163606-yvggl6js249qyhb0
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 18:43:42 -0800
message:
Cleanup and use of show_branch_change
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
------------------------------------------------------------
revno: 3848.1.10
revision-id: aaron at aaronbentley.com-20081211163606-yvggl6js249qyhb0
parent: aaron at aaronbentley.com-20081210015547-jb33j6v5zuvtbiq9
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Thu 2008-12-11 08:36:06 -0800
message:
Move log display into show_flat_log
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
------------------------------------------------------------
revno: 3848.1.9
revision-id: aaron at aaronbentley.com-20081210015547-jb33j6v5zuvtbiq9
parent: aaron at aaronbentley.com-20081210014952-hpl6y56om2t2tc65
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Tue 2008-12-09 17:55:47 -0800
message:
new/old sections are omitted as appropriate.
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 3848.1.8
revision-id: aaron at aaronbentley.com-20081210014952-hpl6y56om2t2tc65
parent: aaron at aaronbentley.com-20081210005442-gk2968uw2x29no6w
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Tue 2008-12-09 17:49:52 -0800
message:
Implement basic show_branch_change
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 3848.1.7
revision-id: aaron at aaronbentley.com-20081210005442-gk2968uw2x29no6w
parent: aaron at aaronbentley.com-20081210003334-mojgnnbfli1bxiun
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Tue 2008-12-09 16:54:42 -0800
message:
Use repository in get_history_change
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
------------------------------------------------------------
revno: 3848.1.6
revision-id: aaron at aaronbentley.com-20081210003334-mojgnnbfli1bxiun
parent: aaron at aaronbentley.com-20081209151508-nd1jb1vv2z22llwm
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: pull-log
timestamp: Tue 2008-12-09 16:33:34 -0800
message:
Implement get_history_change
modified:
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
=== modified file 'NEWS'
--- a/NEWS 2009-01-07 23:04:51 +0000
+++ b/NEWS 2009-01-08 00:13:25 +0000
@@ -91,6 +91,8 @@
* ``pull -v`` now respects the log_format configuration variable.
(Aaron Bentley)
+ * ``push -v`` now works on non-initial pushes. (Aaron Bentley)
+
* Use the short status format when the short format is used for log.
(Vincent Ladeuil, #87179)
@@ -181,6 +183,9 @@
asking for many texts that share ancestry, as the individual chunks
can be shared between versions of the file. (John Arbash Meinel)
+ * ``pull -v`` and ``push -v`` use new function
+ ``bzrlib.log.show_branch_change`` (Aaron Bentley)
+
bzr 1.10 2008-12-05
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-12-23 22:34:38 +0000
+++ b/bzrlib/builtins.py 2009-01-01 19:26:48 +0000
@@ -801,15 +801,8 @@
result.report(self.outf)
if verbose and result.old_revid != result.new_revid:
- old_rh = list(
- branch_to.repository.iter_reverse_revision_history(
- result.old_revid))
- old_rh.reverse()
- new_rh = branch_to.revision_history()
- log_format = branch_to.get_config().log_format()
- log.show_changed_revisions(branch_to, old_rh, new_rh,
- to_file=self.outf,
- log_format=log_format)
+ log.show_branch_change(branch_to, self.outf, result.old_revno,
+ result.old_revid)
finally:
branch_to.unlock()
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2008-12-11 07:12:28 +0000
+++ b/bzrlib/log.py 2009-01-07 12:34:10 +0000
@@ -1010,6 +1010,101 @@
search=None)
+def get_history_change(old_revision_id, new_revision_id, repository):
+ """Calculate the uncommon lefthand history between two revisions.
+
+ :param old_revision_id: The original revision id.
+ :param new_revision_id: The new revision id.
+ :param repository: The repository to use for the calculation.
+
+ return old_history, new_history
+ """
+ old_history = []
+ old_revisions = set()
+ new_history = []
+ new_revisions = set()
+ new_iter = repository.iter_reverse_revision_history(new_revision_id)
+ old_iter = repository.iter_reverse_revision_history(old_revision_id)
+ stop_revision = None
+ do_old = True
+ do_new = True
+ while do_new or do_old:
+ if do_new:
+ try:
+ new_revision = new_iter.next()
+ except StopIteration:
+ do_new = False
+ else:
+ new_history.append(new_revision)
+ new_revisions.add(new_revision)
+ if new_revision in old_revisions:
+ stop_revision = new_revision
+ break
+ if do_old:
+ try:
+ old_revision = old_iter.next()
+ except StopIteration:
+ do_old = False
+ else:
+ old_history.append(old_revision)
+ old_revisions.add(old_revision)
+ if old_revision in new_revisions:
+ stop_revision = old_revision
+ break
+ new_history.reverse()
+ old_history.reverse()
+ if stop_revision is not None:
+ new_history = new_history[new_history.index(stop_revision) + 1:]
+ old_history = old_history[old_history.index(stop_revision) + 1:]
+ return old_history, new_history
+
+
+def show_branch_change(branch, output, old_revno, old_revision_id):
+ """Show the changes made to a branch.
+
+ :param branch: The branch to show changes about.
+ :param output: A file-like object to write changes to.
+ :param old_revno: The revno of the old tip.
+ :param old_revision_id: The revision_id of the old tip.
+ """
+ new_revno, new_revision_id = branch.last_revision_info()
+ old_history, new_history = get_history_change(old_revision_id,
+ new_revision_id,
+ branch.repository)
+ if old_history == [] and new_history == []:
+ output.write('Nothing seems to have changed\n')
+ return
+
+ log_format = log_formatter_registry.get_default(branch)
+ lf = log_format(show_ids=False, to_file=output, show_timezone='original')
+ if old_history != []:
+ output.write('*'*60)
+ output.write('\nRemoved Revisions:\n')
+ show_flat_log(branch.repository, old_history, old_revno, lf)
+ output.write('*'*60)
+ output.write('\n\n')
+ if new_history != []:
+ output.write('Added Revisions:\n')
+ start_revno = new_revno - len(new_history) + 1
+ show_log(branch, lf, None, verbose=False, direction='forward',
+ start_revision=start_revno,)
+
+
+def show_flat_log(repository, history, last_revno, lf):
+ """Show a simple log of the specified history.
+
+ :param repository: The repository to retrieve revisions from.
+ :param history: A list of revision_ids indicating the lefthand history.
+ :param last_revno: The revno of the last revision_id in the history.
+ :param lf: The log formatter to use.
+ """
+ start_revno = last_revno - len(history) + 1
+ revisions = repository.get_revisions(history)
+ for i, rev in enumerate(revisions):
+ lr = LogRevision(rev, i + last_revno, 0, None)
+ lf.log_revision(lr)
+
+
properties_handler_registry = registry.Registry()
properties_handler_registry.register_lazy("foreign",
"bzrlib.foreign",
=== modified file 'bzrlib/push.py'
--- a/bzrlib/push.py 2008-12-04 16:02:51 +0000
+++ b/bzrlib/push.py 2009-01-02 01:58:48 +0000
@@ -16,7 +16,8 @@
"""UI helper for the push command."""
-from bzrlib import builtins, bzrdir, errors, transport
+from bzrlib import (builtins, bzrdir, errors, revision as _mod_revision,
+ transport)
from bzrlib.trace import note, warning
@@ -63,8 +64,6 @@
repository_to = br_to.repository
push_result = None
- if verbose:
- old_rh = []
if dir_to is None:
# The destination doesn't exist; create it.
# XXX: Refactor the create_prefix/no_create_prefix code into a
@@ -147,8 +146,6 @@
# (We don't need to successfully push because of possible divergence.)
if br_from.get_push_location() is None or remember:
br_from.set_push_location(br_to.base)
- if verbose:
- old_rh = br_to.revision_history()
try:
try:
tree_to = dir_to.open_workingtree()
@@ -174,14 +171,15 @@
' Try using "merge" and then "push".')
if push_result is not None:
push_result.report(to_file)
- elif verbose:
- new_rh = br_to.revision_history()
- if old_rh != new_rh:
- # Something changed
- from bzrlib.log import show_changed_revisions
- show_changed_revisions(br_to, old_rh, new_rh,
- to_file=to_file)
+ old_revid = push_result.old_revid
+ old_revno = push_result.old_revno
else:
- # we probably did a clone rather than a push, so a message was
- # emitted above
- pass
+ old_revid = _mod_revision.NULL_REVISION
+ old_revno = 0
+ if verbose:
+ br_to.lock_read()
+ try:
+ from bzrlib.log import show_branch_change
+ show_branch_change(br_to, to_file, old_revno, old_revid)
+ finally:
+ br_to.unlock()
=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py 2008-12-16 04:13:39 +0000
+++ b/bzrlib/tests/blackbox/test_push.py 2009-01-02 01:58:48 +0000
@@ -382,6 +382,19 @@
# fulltext record for f-id @ rev-1, then this will fail.
out, err = self.run_bzr('push -d repo/local remote -r 3')
+ def test_push_verbose_shows_log(self):
+ tree = self.make_branch_and_tree('source')
+ tree.commit('rev1')
+ out, err = self.run_bzr('push -v -d source target')
+ # initial push contains log
+ self.assertContainsRe(out, 'rev1')
+ tree.commit('rev2')
+ out, err = self.run_bzr('push -v -d source target')
+ # subsequent push contains log
+ self.assertContainsRe(out, 'rev2')
+ # subsequent log is accurate
+ self.assertNotContainsRe(out, 'rev1')
+
class RedirectingMemoryTransport(MemoryTransport):
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2008-11-26 09:05:22 +0000
+++ b/bzrlib/tests/test_log.py 2008-12-12 03:45:03 +0000
@@ -1149,3 +1149,100 @@
# revisions are not in the same order.
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)],
[('3', 3), ('4', 4), ('2', 2), ('1', 2),])
+
+
+class TestHistoryChange(tests.TestCaseWithTransport):
+
+ def setup_a_tree(self):
+ tree = self.make_branch_and_tree('tree')
+ tree.lock_write()
+ self.addCleanup(tree.unlock)
+ tree.commit('1a', rev_id='1a')
+ tree.commit('2a', rev_id='2a')
+ tree.commit('3a', rev_id='3a')
+ return tree
+
+ def setup_ab_tree(self):
+ tree = self.setup_a_tree()
+ tree.set_last_revision('1a')
+ tree.branch.set_last_revision_info(1, '1a')
+ tree.commit('2b', rev_id='2b')
+ tree.commit('3b', rev_id='3b')
+ return tree
+
+ def setup_ac_tree(self):
+ tree = self.setup_a_tree()
+ tree.set_last_revision(revision.NULL_REVISION)
+ tree.branch.set_last_revision_info(0, revision.NULL_REVISION)
+ tree.commit('1c', rev_id='1c')
+ tree.commit('2c', rev_id='2c')
+ tree.commit('3c', rev_id='3c')
+ return tree
+
+ def test_all_new(self):
+ tree = self.setup_ab_tree()
+ old, new = log.get_history_change('1a', '3a', tree.branch.repository)
+ self.assertEqual([], old)
+ self.assertEqual(['2a', '3a'], new)
+
+ def test_all_old(self):
+ tree = self.setup_ab_tree()
+ old, new = log.get_history_change('3a', '1a', tree.branch.repository)
+ self.assertEqual([], new)
+ self.assertEqual(['2a', '3a'], old)
+
+ def test_null_old(self):
+ tree = self.setup_ab_tree()
+ old, new = log.get_history_change(revision.NULL_REVISION,
+ '3a', tree.branch.repository)
+ self.assertEqual([], old)
+ self.assertEqual(['1a', '2a', '3a'], new)
+
+ def test_null_new(self):
+ tree = self.setup_ab_tree()
+ old, new = log.get_history_change('3a', revision.NULL_REVISION,
+ tree.branch.repository)
+ self.assertEqual([], new)
+ self.assertEqual(['1a', '2a', '3a'], old)
+
+ def test_diverged(self):
+ tree = self.setup_ab_tree()
+ old, new = log.get_history_change('3a', '3b', tree.branch.repository)
+ self.assertEqual(old, ['2a', '3a'])
+ self.assertEqual(new, ['2b', '3b'])
+
+ def test_unrelated(self):
+ tree = self.setup_ac_tree()
+ old, new = log.get_history_change('3a', '3c', tree.branch.repository)
+ self.assertEqual(old, ['1a', '2a', '3a'])
+ self.assertEqual(new, ['1c', '2c', '3c'])
+
+ def test_show_branch_change(self):
+ tree = self.setup_ab_tree()
+ s = StringIO()
+ log.show_branch_change(tree.branch, s, 3, '3a')
+ self.assertContainsRe(s.getvalue(),
+ '[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*'
+ '[*]{60}\n\nAdded Revisions:\n(.|\n)*2b(.|\n)*3b')
+
+ def test_show_branch_change_no_change(self):
+ tree = self.setup_ab_tree()
+ s = StringIO()
+ log.show_branch_change(tree.branch, s, 3, '3b')
+ self.assertEqual(s.getvalue(),
+ 'Nothing seems to have changed\n')
+
+ def test_show_branch_change_no_old(self):
+ tree = self.setup_ab_tree()
+ s = StringIO()
+ log.show_branch_change(tree.branch, s, 2, '2b')
+ self.assertContainsRe(s.getvalue(), 'Added Revisions:')
+ self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:')
+
+ def test_show_branch_change_no_new(self):
+ tree = self.setup_ab_tree()
+ tree.branch.set_last_revision_info(2, '2b')
+ s = StringIO()
+ log.show_branch_change(tree.branch, s, 3, '3b')
+ self.assertContainsRe(s.getvalue(), 'Removed Revisions:')
+ self.assertNotContainsRe(s.getvalue(), 'Added Revisions:')
More information about the bazaar-commits
mailing list