Merge lp:~jelmer/brz/log-per-file into lp:brz/3.0

Proposed by Jelmer Vernooij on 2019-10-20
Status: Merged
Approved by: Jelmer Vernooij on 2019-11-17
Approved revision: 7329
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/log-per-file
Merge into: lp:brz/3.0
Diff against target: 85 lines (+29/-3)
4 files modified
breezy/git/annotate.py (+2/-1)
breezy/git/filegraph.py (+2/-2)
breezy/git/tests/test_blackbox.py (+22/-0)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/log-per-file
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve on 2019-11-17
Review via email: mp+374410@code.launchpad.net

Commit message

Fix filegraph operations on Git.

Description of the change

Fix filegraph operations on Git.

To post a comment you must log in.
Jelmer Vernooij (jelmer) :
review: Approve
lp:~jelmer/brz/log-per-file updated on 2019-11-17
7329. By Jelmer Vernooij on 2019-11-17

merge 3.0.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/annotate.py'
2--- breezy/git/annotate.py 2018-11-11 14:23:06 +0000
3+++ breezy/git/annotate.py 2019-11-17 23:21:06 +0000
4@@ -100,11 +100,12 @@
5 self.change_scanner.repository.lookup_bzr_revision_id(
6 text_revision))
7 text_parents = []
8+ path = path.encode('utf-8')
9 for commit_parent in self.store[commit_id].parents:
10 try:
11 (path, text_parent) = (
12 self.change_scanner.find_last_change_revision(
13- path.encode('utf-8'), commit_parent))
14+ path, commit_parent))
15 except KeyError:
16 continue
17 if text_parent not in text_parents:
18
19=== modified file 'breezy/git/filegraph.py'
20--- breezy/git/filegraph.py 2018-11-11 14:23:06 +0000
21+++ breezy/git/filegraph.py 2019-11-17 23:21:06 +0000
22@@ -84,7 +84,7 @@
23 self.change_scanner.repository.lookup_bzr_revision_id(
24 text_revision))
25 try:
26- path = mapping.parse_file_id(file_id)
27+ path = mapping.parse_file_id(file_id).encode('utf-8')
28 except ValueError:
29 raise KeyError(file_id)
30 text_parents = []
31@@ -92,7 +92,7 @@
32 try:
33 (path, text_parent) = (
34 self.change_scanner.find_last_change_revision(
35- path.encode('utf-8'), commit_parent))
36+ path, commit_parent))
37 except KeyError:
38 continue
39 if text_parent not in text_parents:
40
41=== modified file 'breezy/git/tests/test_blackbox.py'
42--- breezy/git/tests/test_blackbox.py 2019-06-16 21:40:13 +0000
43+++ breezy/git/tests/test_blackbox.py 2019-11-17 23:21:06 +0000
44@@ -169,6 +169,28 @@
45 # Check that bzr log does not fail and includes the revision.
46 output, error = self.run_bzr(['log', '-v'])
47
48+ def test_log_file(self):
49+ # Smoke test for "bzr log" in a git repository.
50+ repo = GitRepo.init(self.test_dir)
51+ builder = tests.GitBranchBuilder()
52+ builder.set_file('a', b'text for a\n', False)
53+ r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'First')
54+ builder.set_file('a', b'text 3a for a\n', False)
55+ r2a = builder.commit(b'Joe Foo <joe@foo.com>', u'Second a', base=r1)
56+ builder.set_file('a', b'text 3b for a\n', False)
57+ r2b = builder.commit(b'Joe Foo <joe@foo.com>', u'Second b', base=r1)
58+ builder.set_file('a', b'text 4 for a\n', False)
59+ builder.commit(b'Joe Foo <joe@foo.com>', u'Third', merge=[r2a], base=r2b)
60+ builder.finish()
61+
62+ # Check that bzr log does not fail and includes the revision.
63+ output, error = self.run_bzr(['log', '-n2', 'a'])
64+ self.assertEqual(error, '')
65+ self.assertIn('Second a', output)
66+ self.assertIn('Second b', output)
67+ self.assertIn('First', output)
68+ self.assertIn('Third', output)
69+
70 def test_tags(self):
71 git_repo, commit_sha1 = self.simple_commit()
72 git_repo.refs[b"refs/tags/foo"] = commit_sha1
73
74=== modified file 'doc/en/release-notes/brz-3.0.txt'
75--- doc/en/release-notes/brz-3.0.txt 2019-11-17 21:06:21 +0000
76+++ doc/en/release-notes/brz-3.0.txt 2019-11-17 23:21:06 +0000
77@@ -36,6 +36,9 @@
78 significantly slow down startup on some platforms.
79 (Jelmer Vernooij, #1832868)
80
81+ * Fix file graph operations on Git repositories.
82+ (Jelmer Vernooij, #1847913)
83+
84 * Allow running tests without launchpadlib installed.
85 (Jelmer Vernooij, #1849988)
86

Subscribers

People subscribed via source and target branches