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
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2012-03-25 13:36:53 +0000
3+++ bzrlib/builtins.py 2012-04-16 02:03:17 +0000
4@@ -5002,9 +5002,13 @@
5 "You have %d extra revisions:\n",
6 len(local_extra)) %
7 len(local_extra))
8+ rev_tag_dict = {}
9+ if local_branch.supports_tags():
10+ rev_tag_dict = local_branch.tags.get_reverse_tag_dict()
11 for revision in iter_log_revisions(local_extra,
12 local_branch.repository,
13- verbose):
14+ verbose,
15+ rev_tag_dict):
16 lf.log_revision(revision)
17 printed_local = True
18 status_code = 1
19@@ -5018,9 +5022,12 @@
20 "You are missing %d revisions:\n",
21 len(remote_extra)) %
22 len(remote_extra))
23+ if remote_branch.supports_tags():
24+ rev_tag_dict = remote_branch.tags.get_reverse_tag_dict()
25 for revision in iter_log_revisions(remote_extra,
26 remote_branch.repository,
27- verbose):
28+ verbose,
29+ rev_tag_dict):
30 lf.log_revision(revision)
31 status_code = 1
32
33
34=== modified file 'bzrlib/missing.py'
35--- bzrlib/missing.py 2011-12-19 13:23:58 +0000
36+++ bzrlib/missing.py 2012-04-16 02:03:17 +0000
37@@ -25,9 +25,12 @@
38 import bzrlib.revision as _mod_revision
39
40
41-def iter_log_revisions(revisions, revision_source, verbose):
42+def iter_log_revisions(revisions, revision_source, verbose, rev_tag_dict=None):
43 last_tree = revision_source.revision_tree(_mod_revision.NULL_REVISION)
44 last_rev_id = None
45+
46+ if rev_tag_dict is None:
47+ rev_tag_dict = {}
48 for rev in revisions:
49 # We need the following for backward compatibilty (hopefully
50 # this will be deprecated soon :-/) -- vila 080911
51@@ -41,7 +44,8 @@
52 delta = revision_source.get_revision_delta(rev_id)
53 else:
54 delta = None
55- yield log.LogRevision(rev, revno, merge_depth, delta=delta)
56+ yield log.LogRevision(rev, revno, merge_depth, delta=delta,
57+ tags=rev_tag_dict.get(rev_id))
58
59
60 def find_unmerged(local_branch, remote_branch, restrict='all',
61
62=== modified file 'bzrlib/tests/blackbox/test_missing.py'
63--- bzrlib/tests/blackbox/test_missing.py 2012-01-05 13:02:31 +0000
64+++ bzrlib/tests/blackbox/test_missing.py 2012-04-16 02:03:17 +0000
65@@ -234,3 +234,29 @@
66 out1, err1 = self.run_bzr('missing ../b', retcode=1, working_dir='a')
67 self.assertEqualDiff(out1, out2)
68 self.assertEqualDiff(err1, err2)
69+
70+ def test_missing_tags(self):
71+ """Test showing tags"""
72+
73+ # create a source branch
74+ a_tree = self.make_branch_and_tree('a')
75+ self.build_tree_contents([('a/a', 'initial\n')])
76+ a_tree.add('a')
77+ a_tree.commit(message='initial')
78+
79+ # clone and add a differing revision
80+ b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
81+ self.build_tree_contents([('b/a', 'initial\nmore\n')])
82+ b_tree.commit(message='more')
83+ b_tree.branch.tags.set_tag('a-tag', b_tree.last_revision())
84+
85+ for log_format in ['long', 'short', 'line']:
86+ out, err = self.run_bzr(
87+ 'missing --log-format={0} ../a'.format(log_format),
88+ working_dir='b', retcode=1)
89+ self.assertContainsString(out, 'a-tag')
90+
91+ out, err = self.run_bzr(
92+ 'missing --log-format={0} ../b'.format(log_format),
93+ working_dir='a', retcode=1)
94+ self.assertContainsString(out, 'a-tag')
95
96=== modified file 'doc/en/release-notes/bzr-2.6.txt'
97--- doc/en/release-notes/bzr-2.6.txt 2012-04-06 11:38:05 +0000
98+++ doc/en/release-notes/bzr-2.6.txt 2012-04-16 02:03:17 +0000
99@@ -35,6 +35,9 @@
100 .. Fixes for situations where bzr would previously crash or give incorrect
101 or undesirable results.
102
103+* "bzr missing" now shows tag names when displaying revision information.
104+ (#559072, Neil Martinsen-Burrell)
105+
106 * Implement ``ResponseFile.readline`` and ``ReponseFile.tell``,
107 fixing some clones over HTTP. (Jelmer Vernooij, #963769)
108