Merge lp:~jelmer/brz-git/fix-extras-reporting into lp:brz-git

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 1896
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz-git/fix-extras-reporting
Merge into: lp:brz-git
Diff against target: 53 lines (+13/-4)
1 file modified
tree.py (+13/-4)
To merge this branch: bzr merge lp:~jelmer/brz-git/fix-extras-reporting
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+342167@code.launchpad.net

Commit message

Report extras as unversioned in TreeDelta, rather than added.

Description of the change

Report extras as unversioned in TreeDelta, rather than added.

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

Rubberstamp! Proposer approves of own proposal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tree.py'
2--- tree.py 2018-03-26 00:32:23 +0000
3+++ tree.py 2018-03-27 02:04:48 +0000
4@@ -509,12 +509,15 @@
5
6 def tree_delta_from_git_changes(changes, mapping,
7 (old_fileid_map, new_fileid_map), specific_files=None,
8- require_versioned=False, include_root=False):
9+ require_versioned=False, include_root=False,
10+ target_extras=None):
11 """Create a TreeDelta from two git trees.
12
13 source and target are iterators over tuples with:
14 (filename, sha, mode)
15 """
16+ if target_extras is None:
17+ target_extras = set()
18 ret = delta.TreeDelta()
19 for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
20 if newpath == u'' and not include_root:
21@@ -530,8 +533,12 @@
22 if oldpath is None and newpath is None:
23 continue
24 if oldpath is None:
25- file_id = new_fileid_map.lookup_file_id(newpath)
26- ret.added.append((newpath.decode('utf-8'), file_id, mode_kind(newmode)))
27+ if newpath in target_extras:
28+ ret.unversioned.append(
29+ (osutils.normalized_filename(newpath)[0], None, mode_kind(newmode)))
30+ else:
31+ file_id = new_fileid_map.lookup_file_id(newpath)
32+ ret.added.append((newpath.decode('utf-8'), file_id, mode_kind(newmode)))
33 elif newpath is None:
34 file_id = old_fileid_map.lookup_file_id(oldpath)
35 ret.removed.append((oldpath.decode('utf-8'), file_id, mode_kind(oldmode)))
36@@ -556,6 +563,7 @@
37 else:
38 file_id = new_fileid_map.lookup_file_id(newpath)
39 ret.unchanged.append((newpath.decode('utf-8'), file_id, mode_kind(newmode)))
40+
41 return ret
42
43
44@@ -658,7 +666,8 @@
45 target_fileid_map = self.target._fileid_map
46 return tree_delta_from_git_changes(changes, self.target.mapping,
47 (source_fileid_map, target_fileid_map),
48- specific_files=specific_files, include_root=include_root)
49+ specific_files=specific_files, include_root=include_root,
50+ target_extras=target_extras)
51
52 def iter_changes(self, include_unchanged=False, specific_files=None,
53 pb=None, extra_trees=[], require_versioned=True,

Subscribers

People subscribed via source and target branches

to all changes: