Merge lp:~jelmer/brz/diff-tree-reference into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/diff-tree-reference
Merge into: lp:brz
Diff against target: 35 lines (+17/-1)
1 file modified
breezy/diff.py (+17/-1)
To merge this branch: bzr merge lp:~jelmer/brz/diff-tree-reference
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+355881@code.launchpad.net

Commit message

Support running diff on tree references.

Description of the change

Support running diff on tree references.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/diff.py'
2--- breezy/diff.py 2018-11-25 21:48:55 +0000
3+++ breezy/diff.py 2019-02-09 10:34:25 +0000
4@@ -570,6 +570,21 @@
5 self.differs, old_path, new_path, None, new_kind)
6
7
8+class DiffTreeReference(DiffPath):
9+
10+ def diff(self, old_path, new_path, old_kind, new_kind):
11+ """Perform comparison between two tree references. (dummy)
12+
13+ """
14+ if 'tree-reference' not in (old_kind, new_kind):
15+ return self.CANNOT_DIFF
16+ if old_kind not in ('tree-reference', None):
17+ return self.CANNOT_DIFF
18+ if new_kind not in ('tree-reference', None):
19+ return self.CANNOT_DIFF
20+ return self.CHANGED
21+
22+
23 class DiffDirectory(DiffPath):
24
25 def diff(self, old_path, new_path, old_kind, new_kind):
26@@ -880,7 +895,8 @@
27 # list of factories that can provide instances of DiffPath objects
28 # may be extended by plugins.
29 diff_factories = [DiffSymlink.from_diff_tree,
30- DiffDirectory.from_diff_tree]
31+ DiffDirectory.from_diff_tree,
32+ DiffTreeReference.from_diff_tree]
33
34 def __init__(self, old_tree, new_tree, to_file, path_encoding='utf-8',
35 diff_text=None, extra_factories=None):

Subscribers

People subscribed via source and target branches