rs-parsepatch 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rs_parsepatch-0.4.3/Cargo.lock +187 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/Cargo.toml +2 -2
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/PKG-INFO +1 -1
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/pyproject.toml +2 -4
- rs_parsepatch-0.4.3/requirements-dev.txt +3 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/common.rs +7 -7
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/counts.rs +5 -4
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/diffs.rs +7 -6
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/init.rs +10 -6
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/lines.rs +5 -4
- rs_parsepatch-0.4.2/Cargo.lock +0 -289
- rs_parsepatch-0.4.2/requirements-dev.txt +0 -3
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/README.md +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/src/lib.rs +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/__init__.py +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/77ec8a41ee73.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/7dabae5e261a.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/7e60ad275b73.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/81d3e4a2f3f3.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/b184c87f7606.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/c4c0ad8b3eaa.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/c58e9e70f971.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/c6f9187b0b2e.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/d4f80c4ba719.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/d7a700707ddb.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/f045ac9f76cf.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/patches/no_git_header.patch +0 -0
- {rs_parsepatch-0.4.2 → rs_parsepatch-0.4.3}/tests/test_parsepatch.py +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 3
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.4.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.0"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "heck"
|
|
19
|
+
version = "0.5.0"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "indoc"
|
|
25
|
+
version = "2.0.5"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "libc"
|
|
31
|
+
version = "0.2.159"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "log"
|
|
37
|
+
version = "0.4.22"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "memoffset"
|
|
43
|
+
version = "0.9.1"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"autocfg",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "once_cell"
|
|
52
|
+
version = "1.20.2"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|
55
|
+
|
|
56
|
+
[[package]]
|
|
57
|
+
name = "parsepatch"
|
|
58
|
+
version = "0.3.1"
|
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
+
checksum = "46c056f107e40038b8a19e5ff78ae6308ff0704dd36aaf4d1b1e0ec568f39543"
|
|
61
|
+
dependencies = [
|
|
62
|
+
"log",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "portable-atomic"
|
|
67
|
+
version = "1.9.0"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "proc-macro2"
|
|
73
|
+
version = "1.0.87"
|
|
74
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
+
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
|
|
76
|
+
dependencies = [
|
|
77
|
+
"unicode-ident",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "pyo3"
|
|
82
|
+
version = "0.22.3"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "15ee168e30649f7f234c3d49ef5a7a6cbf5134289bc46c29ff3155fa3221c225"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"cfg-if",
|
|
87
|
+
"indoc",
|
|
88
|
+
"libc",
|
|
89
|
+
"memoffset",
|
|
90
|
+
"once_cell",
|
|
91
|
+
"portable-atomic",
|
|
92
|
+
"pyo3-build-config",
|
|
93
|
+
"pyo3-ffi",
|
|
94
|
+
"pyo3-macros",
|
|
95
|
+
"unindent",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[[package]]
|
|
99
|
+
name = "pyo3-build-config"
|
|
100
|
+
version = "0.22.3"
|
|
101
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
+
checksum = "e61cef80755fe9e46bb8a0b8f20752ca7676dcc07a5277d8b7768c6172e529b3"
|
|
103
|
+
dependencies = [
|
|
104
|
+
"once_cell",
|
|
105
|
+
"target-lexicon",
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
[[package]]
|
|
109
|
+
name = "pyo3-ffi"
|
|
110
|
+
version = "0.22.3"
|
|
111
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
112
|
+
checksum = "67ce096073ec5405f5ee2b8b31f03a68e02aa10d5d4f565eca04acc41931fa1c"
|
|
113
|
+
dependencies = [
|
|
114
|
+
"libc",
|
|
115
|
+
"pyo3-build-config",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "pyo3-macros"
|
|
120
|
+
version = "0.22.3"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "2440c6d12bc8f3ae39f1e775266fa5122fd0c8891ce7520fa6048e683ad3de28"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"proc-macro2",
|
|
125
|
+
"pyo3-macros-backend",
|
|
126
|
+
"quote",
|
|
127
|
+
"syn",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[[package]]
|
|
131
|
+
name = "pyo3-macros-backend"
|
|
132
|
+
version = "0.22.3"
|
|
133
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
134
|
+
checksum = "1be962f0e06da8f8465729ea2cb71a416d2257dff56cbe40a70d3e62a93ae5d1"
|
|
135
|
+
dependencies = [
|
|
136
|
+
"heck",
|
|
137
|
+
"proc-macro2",
|
|
138
|
+
"pyo3-build-config",
|
|
139
|
+
"quote",
|
|
140
|
+
"syn",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
[[package]]
|
|
144
|
+
name = "quote"
|
|
145
|
+
version = "1.0.37"
|
|
146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
+
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
|
148
|
+
dependencies = [
|
|
149
|
+
"proc-macro2",
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "rs_parsepatch"
|
|
154
|
+
version = "0.4.3"
|
|
155
|
+
dependencies = [
|
|
156
|
+
"parsepatch",
|
|
157
|
+
"pyo3",
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[[package]]
|
|
161
|
+
name = "syn"
|
|
162
|
+
version = "2.0.79"
|
|
163
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
+
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
|
165
|
+
dependencies = [
|
|
166
|
+
"proc-macro2",
|
|
167
|
+
"quote",
|
|
168
|
+
"unicode-ident",
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
[[package]]
|
|
172
|
+
name = "target-lexicon"
|
|
173
|
+
version = "0.12.16"
|
|
174
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
175
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
176
|
+
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "unicode-ident"
|
|
179
|
+
version = "1.0.13"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
|
182
|
+
|
|
183
|
+
[[package]]
|
|
184
|
+
name = "unindent"
|
|
185
|
+
version = "0.2.3"
|
|
186
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
187
|
+
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "rs_parsepatch"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.3"
|
|
4
4
|
authors = ["calixteman <cdenizet@mozilla.com>"]
|
|
5
5
|
edition = "2018"
|
|
6
6
|
license = "MPL-2.0"
|
|
@@ -17,5 +17,5 @@ crate-type = ["cdylib"]
|
|
|
17
17
|
parsepatch = "0.3"
|
|
18
18
|
|
|
19
19
|
[dependencies.pyo3]
|
|
20
|
-
version = "0.
|
|
20
|
+
version = "0.22"
|
|
21
21
|
features = ["extension-module"]
|
|
@@ -7,13 +7,11 @@ name = "rs_parsepatch"
|
|
|
7
7
|
classifier = [
|
|
8
8
|
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
|
|
9
9
|
"Programming Language :: Python :: 3",
|
|
10
|
-
"Programming Language :: Python :: 3.5",
|
|
11
|
-
"Programming Language :: Python :: 3.6",
|
|
12
|
-
"Programming Language :: Python :: 3.7",
|
|
13
|
-
"Programming Language :: Python :: 3.8",
|
|
14
10
|
"Programming Language :: Python :: 3.9",
|
|
15
11
|
"Programming Language :: Python :: 3.10",
|
|
16
12
|
"Programming Language :: Python :: 3.11",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Programming Language :: Python :: 3.13",
|
|
17
15
|
"Programming Language :: Python",
|
|
18
16
|
"Programming Language :: Rust",
|
|
19
17
|
]
|
|
@@ -11,7 +11,7 @@ pub(crate) enum Bytes<'a> {
|
|
|
11
11
|
|
|
12
12
|
#[inline(always)]
|
|
13
13
|
pub fn create_mode(old: Option<u32>, new: Option<u32>, py: &Python) -> PyObject {
|
|
14
|
-
let dict = PyDict::
|
|
14
|
+
let dict = PyDict::new_bound(*py);
|
|
15
15
|
if let Some(old) = old {
|
|
16
16
|
dict.set_item("old", old).unwrap();
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ pub fn create_mode(old: Option<u32>, new: Option<u32>, py: &Python) -> PyObject
|
|
|
23
23
|
|
|
24
24
|
#[inline(always)]
|
|
25
25
|
pub fn create_file_mode(modes: Option<FileMode>, py: &Python) -> PyObject {
|
|
26
|
-
let dict = PyDict::
|
|
26
|
+
let dict = PyDict::new_bound(*py);
|
|
27
27
|
if let Some(modes) = modes {
|
|
28
28
|
dict.set_item("old", modes.old).unwrap();
|
|
29
29
|
dict.set_item("new", modes.new).unwrap();
|
|
@@ -37,12 +37,12 @@ pub fn create_bin_size(h: BinaryHunk, py: &Python) -> PyObject {
|
|
|
37
37
|
BinaryHunk::Literal(s) => ("literal", s),
|
|
38
38
|
BinaryHunk::Delta(s) => ("delta", s),
|
|
39
39
|
};
|
|
40
|
-
PyTuple::
|
|
40
|
+
PyTuple::new_bound(*py, &[x.0.to_object(*py), x.1.to_object(*py)]).to_object(*py)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
#[inline(always)]
|
|
44
44
|
pub fn set_info(
|
|
45
|
-
diff: &PyDict
|
|
45
|
+
diff: &Bound<'_, PyDict>,
|
|
46
46
|
old_name: &str,
|
|
47
47
|
new_name: &str,
|
|
48
48
|
op: FileOp,
|
|
@@ -113,11 +113,11 @@ pub fn set_info(
|
|
|
113
113
|
|
|
114
114
|
#[inline(always)]
|
|
115
115
|
pub(crate) fn get_bytes<'a>(py: Python<'a>, bytes: &'a PyObject) -> Option<Bytes<'a>> {
|
|
116
|
-
if let Ok(bytes) =
|
|
116
|
+
if let Ok(bytes) = bytes.bind(py).downcast::<PyBytes>() {
|
|
117
117
|
Some(Bytes::Slice(bytes.as_bytes()))
|
|
118
|
-
} else if let Ok(bytes) =
|
|
118
|
+
} else if let Ok(bytes) = bytes.bind(py).downcast::<PyString>() {
|
|
119
119
|
Some(Bytes::Slice(bytes.to_str().unwrap().as_bytes()))
|
|
120
|
-
} else if let Ok(bytes) =
|
|
120
|
+
} else if let Ok(bytes) = bytes.bind(py).downcast::<PyByteArray>() {
|
|
121
121
|
Some(Bytes::Vec(bytes.to_vec()))
|
|
122
122
|
} else {
|
|
123
123
|
None
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
use parsepatch::{BinaryHunk, Diff, FileMode, FileOp, Patch};
|
|
2
|
+
use pyo3::prelude::PyDictMethods;
|
|
2
3
|
use pyo3::types::PyDict;
|
|
3
|
-
use pyo3::{PyObject, PyResult, Python, ToPyObject};
|
|
4
|
+
use pyo3::{Bound, PyObject, PyResult, Python, ToPyObject};
|
|
4
5
|
|
|
5
6
|
pub struct PyDiff<'a> {
|
|
6
7
|
py: Python<'a>,
|
|
7
|
-
diff:
|
|
8
|
+
diff: Bound<'a, PyDict>,
|
|
8
9
|
add: u32,
|
|
9
10
|
del: u32,
|
|
10
11
|
}
|
|
@@ -13,7 +14,7 @@ impl<'a> PyDiff<'a> {
|
|
|
13
14
|
fn new(py: Python<'a>) -> Self {
|
|
14
15
|
PyDiff {
|
|
15
16
|
py,
|
|
16
|
-
diff: PyDict::
|
|
17
|
+
diff: PyDict::new_bound(py),
|
|
17
18
|
add: 0,
|
|
18
19
|
del: 0,
|
|
19
20
|
}
|
|
@@ -70,7 +71,7 @@ impl<'a> Diff for PyDiff<'a> {
|
|
|
70
71
|
file_mode: Option<FileMode>,
|
|
71
72
|
) {
|
|
72
73
|
crate::common::set_info(
|
|
73
|
-
self.diff,
|
|
74
|
+
&self.diff,
|
|
74
75
|
old_name,
|
|
75
76
|
new_name,
|
|
76
77
|
op,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
use parsepatch::{BinaryHunk, Diff, FileMode, FileOp, Patch};
|
|
2
|
+
use pyo3::prelude::PyDictMethods;
|
|
2
3
|
use pyo3::types::{PyBytes, PyDict, PyTuple};
|
|
3
|
-
use pyo3::{PyObject, PyResult, Python, ToPyObject};
|
|
4
|
+
use pyo3::{Bound, PyObject, PyResult, Python, ToPyObject};
|
|
4
5
|
|
|
5
6
|
pub struct PyDiff<'a> {
|
|
6
7
|
py: Python<'a>,
|
|
7
|
-
diff:
|
|
8
|
+
diff: Bound<'a, PyDict>,
|
|
8
9
|
lines: Vec<PyObject>,
|
|
9
10
|
hunks: Vec<Vec<PyObject>>,
|
|
10
11
|
has_hunks: bool,
|
|
@@ -14,7 +15,7 @@ impl<'a> PyDiff<'a> {
|
|
|
14
15
|
fn new(py: Python<'a>, has_hunks: bool) -> Self {
|
|
15
16
|
PyDiff {
|
|
16
17
|
py,
|
|
17
|
-
diff: PyDict::
|
|
18
|
+
diff: PyDict::new_bound(py),
|
|
18
19
|
lines: Vec::new(),
|
|
19
20
|
hunks: Vec::new(),
|
|
20
21
|
has_hunks,
|
|
@@ -92,7 +93,7 @@ impl<'a> Diff for PyDiff<'a> {
|
|
|
92
93
|
file_mode: Option<FileMode>,
|
|
93
94
|
) {
|
|
94
95
|
crate::common::set_info(
|
|
95
|
-
self.diff,
|
|
96
|
+
&self.diff,
|
|
96
97
|
old_name,
|
|
97
98
|
new_name,
|
|
98
99
|
op,
|
|
@@ -103,12 +104,12 @@ impl<'a> Diff for PyDiff<'a> {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
fn add_line(&mut self, old_line: u32, new_line: u32, line: &[u8]) {
|
|
106
|
-
let line = PyTuple::
|
|
107
|
+
let line = PyTuple::new_bound(
|
|
107
108
|
self.py,
|
|
108
109
|
&[
|
|
109
110
|
self.get_line(old_line),
|
|
110
111
|
self.get_line(new_line),
|
|
111
|
-
PyBytes::
|
|
112
|
+
PyBytes::new_bound(self.py, line).to_object(self.py),
|
|
112
113
|
],
|
|
113
114
|
)
|
|
114
115
|
.to_object(self.py);
|
|
@@ -40,10 +40,14 @@ macro_rules! parse_patch {
|
|
|
40
40
|
/// If the line is added then old_line_no is None.
|
|
41
41
|
/// If the line is deleted then new_line_no is None.
|
|
42
42
|
/// If the hunks=True is passed as argument then the lines are gathered by hunk
|
|
43
|
-
fn get_diffs(
|
|
43
|
+
fn get_diffs(
|
|
44
|
+
py: Python,
|
|
45
|
+
bytes: PyObject,
|
|
46
|
+
kwargs: Option<&Bound<'_, PyDict>>,
|
|
47
|
+
) -> PyResult<PyObject> {
|
|
44
48
|
let hunks = if let Some(kwargs) = kwargs {
|
|
45
|
-
kwargs.get_item("hunks")
|
|
46
|
-
PyBool
|
|
49
|
+
kwargs.get_item("hunks")?.map_or(false, |h| {
|
|
50
|
+
h.downcast::<PyBool>().ok().map_or(false, |h| h.is_true())
|
|
47
51
|
})
|
|
48
52
|
} else {
|
|
49
53
|
false
|
|
@@ -54,10 +58,10 @@ fn get_diffs(py: Python, bytes: PyObject, kwargs: Option<&PyDict>) -> PyResult<P
|
|
|
54
58
|
if let Some(bytes) = crate::common::get_bytes(py, &bytes) {
|
|
55
59
|
match bytes {
|
|
56
60
|
crate::common::Bytes::Slice(bytes) => {
|
|
57
|
-
PatchReader::by_buf(bytes, &mut patch).map_err(
|
|
61
|
+
PatchReader::by_buf(bytes, &mut patch).map_err(PPError)?
|
|
58
62
|
}
|
|
59
63
|
crate::common::Bytes::Vec(bytes) => {
|
|
60
|
-
PatchReader::by_buf(&bytes, &mut patch).map_err(
|
|
64
|
+
PatchReader::by_buf(&bytes, &mut patch).map_err(PPError)?
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
} else {
|
|
@@ -80,7 +84,7 @@ fn get_lines(py: Python, bytes: PyObject) -> PyResult<PyObject> {
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
#[pymodule]
|
|
83
|
-
fn rs_parsepatch(_py: Python, m: &PyModule) -> PyResult<()> {
|
|
87
|
+
fn rs_parsepatch(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
84
88
|
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
|
|
85
89
|
|
|
86
90
|
m.add_wrapped(wrap_pyfunction!(get_counts))?;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
use parsepatch::{BinaryHunk, Diff, FileMode, FileOp, Patch};
|
|
2
|
+
use pyo3::prelude::PyDictMethods;
|
|
2
3
|
use pyo3::types::PyDict;
|
|
3
|
-
use pyo3::{PyObject, PyResult, Python, ToPyObject};
|
|
4
|
+
use pyo3::{Bound, PyObject, PyResult, Python, ToPyObject};
|
|
4
5
|
|
|
5
6
|
pub struct PyDiff<'a> {
|
|
6
7
|
py: Python<'a>,
|
|
7
|
-
diff:
|
|
8
|
+
diff: Bound<'a, PyDict>,
|
|
8
9
|
add: Vec<u32>,
|
|
9
10
|
del: Vec<u32>,
|
|
10
11
|
}
|
|
@@ -13,7 +14,7 @@ impl<'a> PyDiff<'a> {
|
|
|
13
14
|
fn new(py: Python<'a>) -> Self {
|
|
14
15
|
PyDiff {
|
|
15
16
|
py,
|
|
16
|
-
diff: PyDict::
|
|
17
|
+
diff: PyDict::new_bound(py),
|
|
17
18
|
add: Vec::new(),
|
|
18
19
|
del: Vec::new(),
|
|
19
20
|
}
|
|
@@ -70,7 +71,7 @@ impl<'a> Diff for PyDiff<'a> {
|
|
|
70
71
|
file_mode: Option<FileMode>,
|
|
71
72
|
) {
|
|
72
73
|
crate::common::set_info(
|
|
73
|
-
self.diff,
|
|
74
|
+
&self.diff,
|
|
74
75
|
old_name,
|
|
75
76
|
new_name,
|
|
76
77
|
op,
|
rs_parsepatch-0.4.2/Cargo.lock
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
# This file is automatically @generated by Cargo.
|
|
2
|
-
# It is not intended for manual editing.
|
|
3
|
-
version = 3
|
|
4
|
-
|
|
5
|
-
[[package]]
|
|
6
|
-
name = "autocfg"
|
|
7
|
-
version = "1.1.0"
|
|
8
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|
10
|
-
|
|
11
|
-
[[package]]
|
|
12
|
-
name = "bitflags"
|
|
13
|
-
version = "1.3.2"
|
|
14
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
-
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
16
|
-
|
|
17
|
-
[[package]]
|
|
18
|
-
name = "cfg-if"
|
|
19
|
-
version = "1.0.0"
|
|
20
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
-
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
22
|
-
|
|
23
|
-
[[package]]
|
|
24
|
-
name = "indoc"
|
|
25
|
-
version = "1.0.9"
|
|
26
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
-
checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
|
|
28
|
-
|
|
29
|
-
[[package]]
|
|
30
|
-
name = "libc"
|
|
31
|
-
version = "0.2.147"
|
|
32
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
-
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
|
34
|
-
|
|
35
|
-
[[package]]
|
|
36
|
-
name = "lock_api"
|
|
37
|
-
version = "0.4.10"
|
|
38
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
-
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
|
|
40
|
-
dependencies = [
|
|
41
|
-
"autocfg",
|
|
42
|
-
"scopeguard",
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
[[package]]
|
|
46
|
-
name = "log"
|
|
47
|
-
version = "0.4.19"
|
|
48
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
-
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
|
50
|
-
|
|
51
|
-
[[package]]
|
|
52
|
-
name = "memoffset"
|
|
53
|
-
version = "0.9.0"
|
|
54
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
-
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
|
56
|
-
dependencies = [
|
|
57
|
-
"autocfg",
|
|
58
|
-
]
|
|
59
|
-
|
|
60
|
-
[[package]]
|
|
61
|
-
name = "once_cell"
|
|
62
|
-
version = "1.18.0"
|
|
63
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
64
|
-
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
|
65
|
-
|
|
66
|
-
[[package]]
|
|
67
|
-
name = "parking_lot"
|
|
68
|
-
version = "0.12.1"
|
|
69
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
-
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
|
71
|
-
dependencies = [
|
|
72
|
-
"lock_api",
|
|
73
|
-
"parking_lot_core",
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
[[package]]
|
|
77
|
-
name = "parking_lot_core"
|
|
78
|
-
version = "0.9.8"
|
|
79
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
-
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
|
|
81
|
-
dependencies = [
|
|
82
|
-
"cfg-if",
|
|
83
|
-
"libc",
|
|
84
|
-
"redox_syscall",
|
|
85
|
-
"smallvec",
|
|
86
|
-
"windows-targets",
|
|
87
|
-
]
|
|
88
|
-
|
|
89
|
-
[[package]]
|
|
90
|
-
name = "parsepatch"
|
|
91
|
-
version = "0.3.1"
|
|
92
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
-
checksum = "46c056f107e40038b8a19e5ff78ae6308ff0704dd36aaf4d1b1e0ec568f39543"
|
|
94
|
-
dependencies = [
|
|
95
|
-
"log",
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
[[package]]
|
|
99
|
-
name = "proc-macro2"
|
|
100
|
-
version = "1.0.64"
|
|
101
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
-
checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da"
|
|
103
|
-
dependencies = [
|
|
104
|
-
"unicode-ident",
|
|
105
|
-
]
|
|
106
|
-
|
|
107
|
-
[[package]]
|
|
108
|
-
name = "pyo3"
|
|
109
|
-
version = "0.19.1"
|
|
110
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111
|
-
checksum = "ffb88ae05f306b4bfcde40ac4a51dc0b05936a9207a4b75b798c7729c4258a59"
|
|
112
|
-
dependencies = [
|
|
113
|
-
"cfg-if",
|
|
114
|
-
"indoc",
|
|
115
|
-
"libc",
|
|
116
|
-
"memoffset",
|
|
117
|
-
"parking_lot",
|
|
118
|
-
"pyo3-build-config",
|
|
119
|
-
"pyo3-ffi",
|
|
120
|
-
"pyo3-macros",
|
|
121
|
-
"unindent",
|
|
122
|
-
]
|
|
123
|
-
|
|
124
|
-
[[package]]
|
|
125
|
-
name = "pyo3-build-config"
|
|
126
|
-
version = "0.19.1"
|
|
127
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
128
|
-
checksum = "554db24f0b3c180a9c0b1268f91287ab3f17c162e15b54caaae5a6b3773396b0"
|
|
129
|
-
dependencies = [
|
|
130
|
-
"once_cell",
|
|
131
|
-
"target-lexicon",
|
|
132
|
-
]
|
|
133
|
-
|
|
134
|
-
[[package]]
|
|
135
|
-
name = "pyo3-ffi"
|
|
136
|
-
version = "0.19.1"
|
|
137
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
-
checksum = "922ede8759e8600ad4da3195ae41259654b9c55da4f7eec84a0ccc7d067a70a4"
|
|
139
|
-
dependencies = [
|
|
140
|
-
"libc",
|
|
141
|
-
"pyo3-build-config",
|
|
142
|
-
]
|
|
143
|
-
|
|
144
|
-
[[package]]
|
|
145
|
-
name = "pyo3-macros"
|
|
146
|
-
version = "0.19.1"
|
|
147
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
148
|
-
checksum = "8a5caec6a1dd355964a841fcbeeb1b89fe4146c87295573f94228911af3cc5a2"
|
|
149
|
-
dependencies = [
|
|
150
|
-
"proc-macro2",
|
|
151
|
-
"pyo3-macros-backend",
|
|
152
|
-
"quote",
|
|
153
|
-
"syn",
|
|
154
|
-
]
|
|
155
|
-
|
|
156
|
-
[[package]]
|
|
157
|
-
name = "pyo3-macros-backend"
|
|
158
|
-
version = "0.19.1"
|
|
159
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
160
|
-
checksum = "e0b78ccbb160db1556cdb6fd96c50334c5d4ec44dc5e0a968d0a1208fa0efa8b"
|
|
161
|
-
dependencies = [
|
|
162
|
-
"proc-macro2",
|
|
163
|
-
"quote",
|
|
164
|
-
"syn",
|
|
165
|
-
]
|
|
166
|
-
|
|
167
|
-
[[package]]
|
|
168
|
-
name = "quote"
|
|
169
|
-
version = "1.0.29"
|
|
170
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
-
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
|
|
172
|
-
dependencies = [
|
|
173
|
-
"proc-macro2",
|
|
174
|
-
]
|
|
175
|
-
|
|
176
|
-
[[package]]
|
|
177
|
-
name = "redox_syscall"
|
|
178
|
-
version = "0.3.5"
|
|
179
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
-
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
|
181
|
-
dependencies = [
|
|
182
|
-
"bitflags",
|
|
183
|
-
]
|
|
184
|
-
|
|
185
|
-
[[package]]
|
|
186
|
-
name = "rs_parsepatch"
|
|
187
|
-
version = "0.4.2"
|
|
188
|
-
dependencies = [
|
|
189
|
-
"parsepatch",
|
|
190
|
-
"pyo3",
|
|
191
|
-
]
|
|
192
|
-
|
|
193
|
-
[[package]]
|
|
194
|
-
name = "scopeguard"
|
|
195
|
-
version = "1.1.0"
|
|
196
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
197
|
-
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|
198
|
-
|
|
199
|
-
[[package]]
|
|
200
|
-
name = "smallvec"
|
|
201
|
-
version = "1.11.0"
|
|
202
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
203
|
-
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
|
204
|
-
|
|
205
|
-
[[package]]
|
|
206
|
-
name = "syn"
|
|
207
|
-
version = "1.0.109"
|
|
208
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
209
|
-
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
|
210
|
-
dependencies = [
|
|
211
|
-
"proc-macro2",
|
|
212
|
-
"quote",
|
|
213
|
-
"unicode-ident",
|
|
214
|
-
]
|
|
215
|
-
|
|
216
|
-
[[package]]
|
|
217
|
-
name = "target-lexicon"
|
|
218
|
-
version = "0.12.9"
|
|
219
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
-
checksum = "df8e77cb757a61f51b947ec4a7e3646efd825b73561db1c232a8ccb639e611a0"
|
|
221
|
-
|
|
222
|
-
[[package]]
|
|
223
|
-
name = "unicode-ident"
|
|
224
|
-
version = "1.0.10"
|
|
225
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
226
|
-
checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73"
|
|
227
|
-
|
|
228
|
-
[[package]]
|
|
229
|
-
name = "unindent"
|
|
230
|
-
version = "0.1.11"
|
|
231
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
232
|
-
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
|
|
233
|
-
|
|
234
|
-
[[package]]
|
|
235
|
-
name = "windows-targets"
|
|
236
|
-
version = "0.48.1"
|
|
237
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
238
|
-
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
|
|
239
|
-
dependencies = [
|
|
240
|
-
"windows_aarch64_gnullvm",
|
|
241
|
-
"windows_aarch64_msvc",
|
|
242
|
-
"windows_i686_gnu",
|
|
243
|
-
"windows_i686_msvc",
|
|
244
|
-
"windows_x86_64_gnu",
|
|
245
|
-
"windows_x86_64_gnullvm",
|
|
246
|
-
"windows_x86_64_msvc",
|
|
247
|
-
]
|
|
248
|
-
|
|
249
|
-
[[package]]
|
|
250
|
-
name = "windows_aarch64_gnullvm"
|
|
251
|
-
version = "0.48.0"
|
|
252
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
-
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
|
254
|
-
|
|
255
|
-
[[package]]
|
|
256
|
-
name = "windows_aarch64_msvc"
|
|
257
|
-
version = "0.48.0"
|
|
258
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
259
|
-
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
|
260
|
-
|
|
261
|
-
[[package]]
|
|
262
|
-
name = "windows_i686_gnu"
|
|
263
|
-
version = "0.48.0"
|
|
264
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
265
|
-
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
|
266
|
-
|
|
267
|
-
[[package]]
|
|
268
|
-
name = "windows_i686_msvc"
|
|
269
|
-
version = "0.48.0"
|
|
270
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
-
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
|
272
|
-
|
|
273
|
-
[[package]]
|
|
274
|
-
name = "windows_x86_64_gnu"
|
|
275
|
-
version = "0.48.0"
|
|
276
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
277
|
-
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
|
278
|
-
|
|
279
|
-
[[package]]
|
|
280
|
-
name = "windows_x86_64_gnullvm"
|
|
281
|
-
version = "0.48.0"
|
|
282
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
283
|
-
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
|
284
|
-
|
|
285
|
-
[[package]]
|
|
286
|
-
name = "windows_x86_64_msvc"
|
|
287
|
-
version = "0.48.0"
|
|
288
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
289
|
-
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|