Merge lp:~nmb/bzr/559072-missing-tag into lp:bzr

Proposed by Neil Martinsen-Burrell
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 6521
Proposed branch: lp:~nmb/bzr/559072-missing-tag
Merge into: lp:bzr
Diff against target: 107 lines (+44/-4)
4 files modified
bzrlib/builtins.py (+9/-2)
bzrlib/missing.py (+6/-2)
bzrlib/tests/blackbox/test_missing.py (+26/-0)
doc/en/release-notes/bzr-2.6.txt (+3/-0)
To merge this branch: bzr merge lp:~nmb/bzr/559072-missing-tag
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+101220@code.launchpad.net

Commit message

Add tag information to the output of bzr missing.

Description of the change

This fixes bug 559072 by adding tag information to the output of the "bzr missing" command. The signature of bzrlib/missing.py:iter_log_revisions() was changed, but only by adding a keyword argument to the end, so I didn't think that it warranted mention as a compatibility change. This had to be done to get tag information from the appropriate branch.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks for working on this, looks good.

It might be nicer to pass in the reverse tags dictionary rather than the actual branch; that seems more consistent with the other parameters that are being passed in (revisions). What do you think?

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

I think that is indeed better. Change made in the branch. I also fixed it to print and test tags for the remote branch as well.

Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This has a conflict in the release notes; any chance you can fix that?

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

Fixed on lp:~nmb/bzr/559072-missing-tag.

On Sun, Apr 15, 2012 at 11:40, Jelmer Vernooij
<email address hidden> wrote:
> This has a conflict in the release notes; any chance you can fix that?
> --
> https://code.launchpad.net/~nmb/bzr/559072-missing-tag/+merge/101220
> You are the owner of lp:~nmb/bzr/559072-missing-tag.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2012-03-25 13:36:53 +0000
+++ bzrlib/builtins.py 2012-04-16 02:03:17 +0000
@@ -5002,9 +5002,13 @@
5002 "You have %d extra revisions:\n", 5002 "You have %d extra revisions:\n",
5003 len(local_extra)) %5003 len(local_extra)) %
5004 len(local_extra))5004 len(local_extra))
5005 rev_tag_dict = {}
5006 if local_branch.supports_tags():
5007 rev_tag_dict = local_branch.tags.get_reverse_tag_dict()
5005 for revision in iter_log_revisions(local_extra,5008 for revision in iter_log_revisions(local_extra,
5006 local_branch.repository,5009 local_branch.repository,
5007 verbose):5010 verbose,
5011 rev_tag_dict):
5008 lf.log_revision(revision)5012 lf.log_revision(revision)
5009 printed_local = True5013 printed_local = True
5010 status_code = 15014 status_code = 1
@@ -5018,9 +5022,12 @@
5018 "You are missing %d revisions:\n",5022 "You are missing %d revisions:\n",
5019 len(remote_extra)) %5023 len(remote_extra)) %
5020 len(remote_extra))5024 len(remote_extra))
5025 if remote_branch.supports_tags():
5026 rev_tag_dict = remote_branch.tags.get_reverse_tag_dict()
5021 for revision in iter_log_revisions(remote_extra,5027 for revision in iter_log_revisions(remote_extra,
5022 remote_branch.repository,5028 remote_branch.repository,
5023 verbose):5029 verbose,
5030 rev_tag_dict):
5024 lf.log_revision(revision)5031 lf.log_revision(revision)
5025 status_code = 15032 status_code = 1
50265033
50275034
=== modified file 'bzrlib/missing.py'
--- bzrlib/missing.py 2011-12-19 13:23:58 +0000
+++ bzrlib/missing.py 2012-04-16 02:03:17 +0000
@@ -25,9 +25,12 @@
25import bzrlib.revision as _mod_revision25import bzrlib.revision as _mod_revision
2626
2727
28def iter_log_revisions(revisions, revision_source, verbose):28def iter_log_revisions(revisions, revision_source, verbose, rev_tag_dict=None):
29 last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)29 last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)
30 last_rev_id = None30 last_rev_id = None
31
32 if rev_tag_dict is None:
33 rev_tag_dict = {}
31 for rev in revisions:34 for rev in revisions:
32 # We need the following for backward compatibilty (hopefully35 # We need the following for backward compatibilty (hopefully
33 # this will be deprecated soon :-/) -- vila 08091136 # this will be deprecated soon :-/) -- vila 080911
@@ -41,7 +44,8 @@
41 delta = revision_source.get_revision_delta(rev_id)44 delta = revision_source.get_revision_delta(rev_id)
42 else:45 else:
43 delta = None46 delta = None
44 yield log.LogRevision(rev, revno, merge_depth, delta=delta)47 yield log.LogRevision(rev, revno, merge_depth, delta=delta,
48 tags=rev_tag_dict.get(rev_id))
4549
4650
47def find_unmerged(local_branch, remote_branch, restrict='all',51def find_unmerged(local_branch, remote_branch, restrict='all',
4852
=== modified file 'bzrlib/tests/blackbox/test_missing.py'
--- bzrlib/tests/blackbox/test_missing.py 2012-01-05 13:02:31 +0000
+++ bzrlib/tests/blackbox/test_missing.py 2012-04-16 02:03:17 +0000
@@ -234,3 +234,29 @@
234 out1, err1 = self.run_bzr('missing ../b', retcode=1, working_dir='a')234 out1, err1 = self.run_bzr('missing ../b', retcode=1, working_dir='a')
235 self.assertEqualDiff(out1, out2)235 self.assertEqualDiff(out1, out2)
236 self.assertEqualDiff(err1, err2)236 self.assertEqualDiff(err1, err2)
237
238 def test_missing_tags(self):
239 """Test showing tags"""
240
241 # create a source branch
242 a_tree = self.make_branch_and_tree('a')
243 self.build_tree_contents([('a/a', 'initial\n')])
244 a_tree.add('a')
245 a_tree.commit(message='initial')
246
247 # clone and add a differing revision
248 b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
249 self.build_tree_contents([('b/a', 'initial\nmore\n')])
250 b_tree.commit(message='more')
251 b_tree.branch.tags.set_tag('a-tag', b_tree.last_revision())
252
253 for log_format in ['long', 'short', 'line']:
254 out, err = self.run_bzr(
255 'missing --log-format={0} ../a'.format(log_format),
256 working_dir='b', retcode=1)
257 self.assertContainsString(out, 'a-tag')
258
259 out, err = self.run_bzr(
260 'missing --log-format={0} ../b'.format(log_format),
261 working_dir='a', retcode=1)
262 self.assertContainsString(out, 'a-tag')
237263
=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- doc/en/release-notes/bzr-2.6.txt 2012-04-06 11:38:05 +0000
+++ doc/en/release-notes/bzr-2.6.txt 2012-04-16 02:03:17 +0000
@@ -35,6 +35,9 @@
35.. Fixes for situations where bzr would previously crash or give incorrect35.. Fixes for situations where bzr would previously crash or give incorrect
36 or undesirable results.36 or undesirable results.
3737
38* "bzr missing" now shows tag names when displaying revision information.
39 (#559072, Neil Martinsen-Burrell)
40
38* Implement ``ResponseFile.readline`` and ``ReponseFile.tell``,41* Implement ``ResponseFile.readline`` and ``ReponseFile.tell``,
39 fixing some clones over HTTP. (Jelmer Vernooij, #963769)42 fixing some clones over HTTP. (Jelmer Vernooij, #963769)
4043