-
Notifications
You must be signed in to change notification settings - Fork 14
Commit 1f39d80
refactor(url): reversible SSH-style URL patch
why:
- Previously, enabling SSH-style URL detection mutated libvcs’s DEFAULT_RULES on import and lost the rule’s original metadata.
- Users couldn’t cleanly disable the patch or restore upstream defaults if libvcs changed.
- Implicit module-import side-effects are harder to reason about.
what:
- Introduce private `_orig_rule_meta` to snapshot rule’s original metadata.
- Store original metadata on first enable and apply `(True, 100)`.
- Restore saved metadata (or safe defaults) on disable, clearing snapshot.
- Remove auto-patch on import; require explicit call.
- Add `ssh_style_url_detection` context manager.
- Call `enable_ssh_style_url_detection()` in `update_repo()` to maintain behavior.
- Add pytest tests for enable/disable roundtrip and context manager.1 parent f8375ed commit 1f39d80
3 files changed
+92
-10
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 | + | ||
15 | 16 |
| |
16 | 17 |
| |
17 | 18 |
| |
| |||
147 | 148 |
| |
148 | 149 |
| |
149 | 150 |
| |
151 | + | ||
152 | + | ||
150 | 153 |
| |
151 | 154 |
| |
152 | 155 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 | + | ||
6 | + | ||
5 | 7 |
| |
6 | 8 |
| |
9 | + | ||
10 | + | ||
7 | 11 |
| |
8 | 12 |
| |
9 | 13 |
| |
| |||
23 | 27 |
| |
24 | 28 |
| |
25 | 29 |
| |
30 | + | ||
26 | 31 |
| |
27 | 32 |
| |
28 | - | ||
33 | + | ||
34 | + | ||
29 | 35 |
| |
30 | - | ||
31 | 36 |
| |
37 | + | ||
32 | 38 |
| |
33 | 39 |
| |
34 | 40 |
| |
| |||
39 | 45 |
| |
40 | 46 |
| |
41 | 47 |
| |
42 | - | ||
48 | + | ||
49 | + | ||
43 | 50 |
| |
44 | 51 |
| |
45 | 52 |
| |
| |||
50 | 57 |
| |
51 | 58 |
| |
52 | 59 |
| |
60 | + | ||
53 | 61 |
| |
54 | 62 |
| |
55 | - | ||
56 | - | ||
57 | - | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
58 | 72 |
| |
59 | 73 |
| |
60 | 74 |
| |
| |||
70 | 84 |
| |
71 | 85 |
| |
72 | 86 |
| |
73 | - | ||
74 | - | ||
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 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
6 | + | ||
7 | 7 |
| |
8 | - | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
9 | 13 |
| |
10 | 14 |
| |
11 | 15 |
| |
| |||
99 | 103 |
| |
100 | 104 |
| |
101 | 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 | + |
0 commit comments