Commit 1aaf6fa
authored
Blame: support builtin repository packages (and files) (spack#50877)
Fixes spack#50876
Without these changes, `spack blame <package>` fails. For example, with `builtin` configured with the `git` url:
```
$ spack blame lua
fatal: '/Users/dahlgren1/.spack/package_repos/fncqgg4/repos/spack_repo/builtin/packages/lua/package.py' is outside repository at '/Users/dahlgren1/github/prs/spack'
==> Error: Command exited with status 128:
'/usr/bin/git' 'blame' '--line-porcelain' '--ignore-revs-file' '$spack/.git-blame-ignore-revs' $HOME/.spack/package_repos/fncqgg4/repos/spack_repo/builtin/packages/lua/package.py'
```
and `builtin` configured for a user's local repository (e.g., a clone of `spack/spack-packages`):
```
$ spack blame lua
fatal: '$spack-packages/repos/spack_repo/builtin/packages/lua/package.py' is outside repository at '$spack'
==> Error: Command exited with status 128:
'/usr/bin/git' 'blame' '--line-porcelain' '--ignore-revs-file' '$spack/.git-blame-ignore-revs' '$spack-packages/repos/spack_repo/builtin/packages/lua/package.py'
```
With these changes, you get the expected output:
```
$ spack blame lua
LAST_COMMIT LINES % AUTHOR EMAIL
3 weeks ago 5 2.0 Harmen Stoppels <[email protected]>
a month ago 12 4.7 Adam J. Stewart <[email protected]>
5 months ago 51 20.1 Todd Gamblin <[email protected]>
7 months ago 21 8.3 Giuncan <[email protected]>
7 months ago 133 52.4 Tom Scogland <[email protected]>
8 months ago 2 0.8 Auriane R. <[email protected]>
a year ago 2 0.8 John W. Parent <[email protected]>
a year ago 11 4.3 Chris White <[email protected]>
a year ago 1 0.4 Martin Aumüller <[email protected]>
2 years ago 3 1.2 Massimiliano Culpo <[email protected]>
3 years ago 1 0.4 Tamara Dahlgren <[email protected]>
3 years ago 1 0.4 Vanessasaurus <[email protected]>
5 years ago 9 3.5 Robert Pavel <[email protected]>
6 years ago 2 0.8 Stephen Herbein <[email protected]>
3 weeks ago 254 100.0
```
And if the equivalent ignore commits are added to `spack/spack-packages` (spack/spack-packages#199), the `spack blame` output is a little different:
```
$ spack -d blame lua
...
/.git-blame-ignore-revs' '--line-porcelain' '/Users/dahlgren1/github/spack-packages/repos/spack_repo/builtin/packages/lua/package.py'
LAST_COMMIT LINES % AUTHOR EMAIL
3 weeks ago 5 2.0 Harmen Stoppels <[email protected]>
a month ago 9 3.5 Adam J. Stewart <[email protected]>
5 months ago 20 7.9 Todd Gamblin <[email protected]>
7 months ago 21 8.3 Giuncan <[email protected]>
7 months ago 147 57.9 Tom Scogland <[email protected]>
8 months ago 2 0.8 Auriane R. <[email protected]>
a year ago 2 0.8 John W. Parent <[email protected]>
a year ago 11 4.3 Chris White <[email protected]>
a year ago 1 0.4 Martin Aumüller <[email protected]>
2 years ago 4 1.6 Massimiliano Culpo <[email protected]>
3 years ago 3 1.2 Peter Brady <[email protected]>
3 years ago 1 0.4 Tamara Dahlgren <[email protected]>
3 years ago 2 0.8 Vanessasaurus <[email protected]>
4 years ago 24 9.4 Robert Pavel <[email protected]>
6 years ago 2 0.8 Stephen Herbein <[email protected]>
3 weeks ago 254 100.0
```
The changes also allow `spack blame` to report on non-package files in spack repositories:
```
$ spack -d blame pyproject.toml
...
==> [2025-06-10-15:16:00.717914] '/usr/bin/git' 'blame' '--ignore-revs-file' '$pack-packages/.git-blame-ignore-revs' '--line-porcelain' '$spack-packages/pyproject.toml'
LAST_COMMIT LINES % AUTHOR EMAIL
2 weeks ago 242 100.0 Ryan Krattiger <[email protected]>
2 weeks ago 242 100.0
```
---
Signed-off-by: Todd Gamblin <[email protected]>1 parent c702f5b commit 1aaf6fa
2 files changed
+329
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
115 | 216 | | |
116 | 217 | | |
117 | 218 | | |
118 | | - | |
119 | | - | |
| 219 | + | |
120 | 220 | | |
121 | | - | |
| 221 | + | |
| 222 | + | |
122 | 223 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
127 | 228 | | |
| 229 | + | |
| 230 | + | |
128 | 231 | | |
129 | | - | |
130 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
131 | 265 | | |
132 | | - | |
133 | | - | |
134 | 266 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
150 | 283 | | |
151 | 284 | | |
152 | 285 | | |
| |||
0 commit comments