-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathresolve_567.py
More file actions
40 lines (33 loc) · 858 Bytes
/
Copy pathresolve_567.py
File metadata and controls
40 lines (33 loc) · 858 Bytes
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
with open("cargo-budget-report/src/main.rs", "r") as f:
text = f.read()
import re
# Block 1: Keep HEAD
text = re.sub(
r"<<<<<<< HEAD\n(.*?)\n=======\n(?:.*?)\n>>>>>>> origin/main\n",
r"\1\n",
text,
count=1,
flags=re.DOTALL
)
# Block 2: Keep origin/main
text = re.sub(
r"<<<<<<< HEAD\n(?:.*?)\n=======\n(.*?)\n>>>>>>> origin/main\n",
r"\1\n",
text,
count=1,
flags=re.DOTALL
)
with open("cargo-budget-report/src/main.rs", "w") as f:
f.write(text)
with open("cargo-budget-report/tests/integration.rs", "r") as f:
text_test = f.read()
# Block 3: Keep origin/main
text_test = re.sub(
r"<<<<<<< HEAD\n(?:.*?)\n=======\n(.*?)\n>>>>>>> origin/main\n",
r"\1\n",
text_test,
count=1,
flags=re.DOTALL
)
with open("cargo-budget-report/tests/integration.rs", "w") as f:
f.write(text_test)