about summary refs log tree commit diff
path: root/pkgs/by-name/ki/ki/update-to-newer-anki-versions.patch
blob: e0f8549f120d280d172d159910686865c185f46f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
diff --git a/ki/__init__.py b/ki/__init__.py
index 3f29c1a..f4ad950 100644
--- a/ki/__init__.py
+++ b/ki/__init__.py
@@ -1321,7 +1321,7 @@ def _clone1(collection: str, directory: str = "") -> git.Repo:
     try:
         col = M.collection(col_file)
         _, _ = _clone2(col, targetdir, msg="Initial commit", silent=False)
-        col.close(save=False)
+        col.close()
         kirepo: KiRepo = M.kirepo(targetdir)
         kirepo.repo.create_tag(LCA)
         kirepo.repo.close()
@@ -1404,11 +1404,11 @@ def _pull1() -> None:
     hashes = list(filter(lambda l: l != "", hashes))
     if md5sum in hashes[-1]:
         echo("ki pull: up to date.")
-        col.close(save=False)
+        col.close()
         return
 
     col = _pull2(kirepo, col)
-    col.close(save=False)
+    col.close()
 
 
 @beartype
@@ -1545,7 +1545,7 @@ def _push() -> PushResult:
     # If there are no changes, quit.
     if len(set(deltas)) == 0:
         echo("ki push: up to date.")
-        col.close(save=False)
+        col.close()
         return PushResult.UP_TO_DATE
 
     echo(f"Pushing to '{kirepo.col_file}'")
@@ -1603,7 +1603,7 @@ def write_collection(
     do(warn, F.cat(map(push_note(tempcol, timestamp_ns, guids, new_nids), decknotes)))
 
     # It is always safe to save changes to the DB, since the DB is a copy.
-    tempcol.close(save=True)
+    tempcol.close()
 
     # Backup collection file and overwrite collection.
     backup(kirepo)
@@ -1621,7 +1621,7 @@ def write_collection(
     renames = filter(lambda a: a.file.name != a.new_name, map(addmedia(col), mbytes))
     warnings = map(lambda r: RenamedMediaFileWarning(r.file.name, r.new_name), renames)
     do(warn, warnings)
-    col.close(save=True)
+    col.close()
 
     # Append and commit collection checksum to hashes file.
     append_md5sum(kirepo.ki, kirepo.col_file.name, F.md5(kirepo.col_file))
diff --git a/tests/test_integration.py b/tests/test_integration.py
index e046b8c..93d3661 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -320,7 +320,7 @@ def test_clone_generates_deck_tree_correctly():
     # Create empty decks.
     col = opencol(a)
     do(col.decks.id, [":a:::b:", "blank::blank", "blank::Hello"])
-    col.close(save=True)
+    col.close()
 
     os.chdir(F.mkdtemp())
     clone(a)
@@ -401,7 +401,7 @@ def test_clone_writes_media_files():
     a: File = mkcol([("Basic", ["Default"], 1, ["a", "b[sound:1sec.mp3]"])])
     col = opencol(a)
     col.media.add_file(DATA / "media/1sec.mp3")
-    col.close(save=True)
+    col.close()
     clone(a)
     assert (Path(MEDIA) / "1sec.mp3").is_file()
 
@@ -883,7 +883,7 @@ def test_push_writes_media():
     write_basic("Default", ("air", '<img src="bullhorn-lg.png">'))
     col = opencol(a)
     col.media.add_file(DATA / "media/bullhorn-lg.png")
-    col.close(save=True)
+    col.close()
     F.commitall(repo, ".")
     repo.close()
     out = push()
@@ -987,7 +987,7 @@ def test_push_doesnt_unnecessarily_deduplicate_notetypes():
 
     col = opencol(a)
     models = col.models.all_names_and_ids()
-    col.close(save=False)
+    col.close()
 
     # Remove a note.
     assert os.path.isfile("Default/a.md")
@@ -1012,7 +1012,7 @@ def test_push_doesnt_unnecessarily_deduplicate_notetypes():
 
     col = opencol(a)
     assert len(models) == len(col.models.all_names_and_ids())
-    col.close(save=False)
+    col.close()
 
 
 def test_push_is_nontrivial_when_pushed_changes_are_reverted_in_repository():
diff --git a/tests/test_ki.py b/tests/test_ki.py
index 5270b56..e5f3297 100644
--- a/tests/test_ki.py
+++ b/tests/test_ki.py
@@ -482,7 +482,7 @@ def mkcol(ns: List[NoteSpec]) -> File:
     file = F.touch(F.mkdtemp(), "a.anki2")
     col = opencol(file)
     do(addnote(col), ns)
-    col.close(save=True)
+    col.close()
     return F.chk(file)
 
 
@@ -491,7 +491,7 @@ def rm(f: File, nid: int) -> File:
     """Remove note with given `nid`."""
     col = opencol(f)
     col.remove_notes([nid])
-    col.close(save=True)
+    col.close()
     return f
 
 
@@ -514,7 +514,7 @@ def edit(f: File, spec: NoteSpec) -> File:
     """Edit a note with specified nid."""
     col = opencol(f)
     editnote(col, spec)
-    col.close(save=True)
+    col.close()
     return f
 
 
@@ -531,7 +531,7 @@ def editcol(
     do(addnote(col), adds)
     do(editnote(col), edits)
     col.remove_notes(deletes)
-    col.close(save=True)
+    col.close()
     return f