Merge lp:~jelmer/brz/dulwich-compat into lp:brz/3.2

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/dulwich-compat
Merge into: lp:brz/3.2
Diff against target: 79 lines (+9/-9)
3 files modified
breezy/git/tests/test_workingtree.py (+4/-4)
breezy/git/workingtree.py (+4/-3)
setup.py (+1/-2)
To merge this branch: bzr merge lp:~jelmer/brz/dulwich-compat
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+403171@code.launchpad.net

Commit message

Use IndexEntry type when accessing Dulwich indexes.

Description of the change

Use IndexEntry type when accessing Dulwich indexes.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/tests/test_workingtree.py'
2--- breezy/git/tests/test_workingtree.py 2020-08-10 15:00:17 +0000
3+++ breezy/git/tests/test_workingtree.py 2021-05-24 23:19:34 +0000
4@@ -85,8 +85,8 @@
5 self.build_tree(['conflicted'])
6 self.tree.add(['conflicted'])
7 with self.tree.lock_tree_write():
8- self.tree.index[b'conflicted'] = self.tree.index[b'conflicted'][:9] + \
9- (FLAG_STAGEMASK, )
10+ self.tree.index[b'conflicted'] = self.tree.index[b'conflicted']._replace(
11+ flags=FLAG_STAGEMASK)
12 self.tree._index_dirty = True
13 conflicts = self.tree.conflicts()
14 self.assertEqual(1, len(conflicts))
15@@ -358,7 +358,7 @@
16 self.build_tree_contents([('a/.git/HEAD', a.id)])
17 with self.wt.lock_tree_write():
18 (index, index_path) = self.wt._lookup_index(b'a')
19- index[b'a'] = IndexEntry(0, 0, 0, 0, S_IFGITLINK, 0, 0, 0, a.id, 0)
20+ index[b'a'] = IndexEntry(0, 0, 0, 0, S_IFGITLINK, 0, 0, 0, a.id, 0, 0)
21 self.wt._index_dirty = True
22 t = Tree()
23 t.add(b"a", S_IFGITLINK, a.id)
24@@ -369,7 +369,7 @@
25 a = Blob.from_string(b'irrelevant\n')
26 with self.wt.lock_tree_write():
27 (index, index_path) = self.wt._lookup_index(b'a')
28- index[b'a'] = IndexEntry(0, 0, 0, 0, S_IFGITLINK, 0, 0, 0, a.id, 0)
29+ index[b'a'] = IndexEntry(0, 0, 0, 0, S_IFGITLINK, 0, 0, 0, a.id, 0, 0)
30 self.wt._index_dirty = True
31 os.mkdir(self.wt.abspath('a'))
32 t = Tree()
33
34=== modified file 'breezy/git/workingtree.py'
35--- breezy/git/workingtree.py 2021-03-22 21:07:08 +0000
36+++ breezy/git/workingtree.py 2021-05-24 23:19:34 +0000
37@@ -27,6 +27,7 @@
38 from dulwich.file import GitFile, FileLocked
39 from dulwich.index import (
40 Index,
41+ IndexEntry,
42 SHA1Writer,
43 build_index_from_tree,
44 index_entry_from_path,
45@@ -981,9 +982,9 @@
46 value = self.index[path]
47 self._index_dirty = True
48 if conflicted:
49- self.index[path] = (value[:9] + (value[9] | FLAG_STAGEMASK, ))
50+ self.index[path] = self.index[path]._replace(flags=self.index[path].flags | FLAG_STAGEMASK)
51 else:
52- self.index[path] = (value[:9] + (value[9] & ~ FLAG_STAGEMASK, ))
53+ self.index[path] = self.index[path]._replace(flags=self.index[path].flags &~ FLAG_STAGEMASK)
54
55 def add_conflicts(self, new_conflicts):
56 with self.lock_tree_write():
57@@ -1139,7 +1140,7 @@
58 add_entry(dirname, 'directory')
59 dirname = decode_git_path(dirname)
60 dir_file_id = self.path2id(dirname)
61- if not isinstance(value, tuple) or len(value) != 10:
62+ if not isinstance(value, (tuple, IndexEntry)):
63 raise ValueError(value)
64 per_dir[(dirname, dir_file_id)].add(
65 (decode_git_path(path), decode_git_path(child_name),
66
67=== modified file 'setup.py'
68--- setup.py 2021-05-02 15:07:21 +0000
69+++ setup.py 2021-05-24 23:19:34 +0000
70@@ -67,8 +67,7 @@
71 'patiencediff',
72 # Technically, Breezy works without these two dependencies too. But there's
73 # no way to enable them by default and let users opt out.
74- 'dulwich>=0.19.12;python_version>="3.5"',
75- 'dulwich<0.20,>=0.19.12;python_version<"3.0"',
76+ 'dulwich>=0.20.22',
77 ],
78 'extras_require': {
79 'cext': ['cython>=0.29'],

Subscribers

People subscribed via source and target branches