-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
quick test for recording config history
- Loading branch information
1 parent
3469bc7
commit 56dddc0
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
File Version Information | ||
======================== | ||
|
||
- **sd-layout-battery.yaml**: Updated in `v0.5.0-17-g9d698e6` | ||
- **sd-layout.yaml**: Updated in `v0.5.0-17-g9d698e6` | ||
- **stream-buffer-header.yaml**: Updated in `v0.5.0-17-g9d698e6` | ||
- **wireless-200px.yml**: Updated in `v0.5.0-17-g9d698e6` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import subprocess | ||
from pathlib import Path | ||
|
||
def get_last_commit_id(file_path): | ||
result = subprocess.run( | ||
["git", "log", "-1", "--format=%H", "--", str(file_path)], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
text=True, | ||
check=True | ||
) | ||
return result.stdout.strip() | ||
|
||
def get_version_from_commit(commit_id): | ||
result = subprocess.run( | ||
["git", "describe", "--tags", commit_id], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
text=True, | ||
check=True | ||
) | ||
return result.stdout.strip() | ||
|
||
def gen_rst(directory, output_file): | ||
with open(output_file, 'w') as f: | ||
f.write("Config History\n") | ||
f.write("========================\n\n") | ||
for file_path in Path(directory).rglob('*'): | ||
if file_path.is_file(): | ||
commit_id = get_last_commit_id(file_path) | ||
if commit_id: | ||
version = get_version_from_commit(commit_id) | ||
f.write(f"- **{file_path.name}**: Updated in `{version}`\n") | ||
|
||
if __name__ == "__main__": | ||
dir = "miniscope_io/data/config" | ||
rst = "docs/history/config.rst" | ||
gen_rst(dir, rst) |
14 changes: 14 additions & 0 deletions
14
miniscope_io/data/config/wireless/sample_made_in_this_branch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
id: stream-buffer-header | ||
mio_model: miniscope_io.models.stream.StreamBufferHeaderFormat | ||
mio_version: "v5.0.0" | ||
linked_list: 0 | ||
frame_num: 1 | ||
buffer_count: 2 | ||
frame_buffer_count: 3 | ||
write_buffer_count: 4 | ||
dropped_buffer_count: 5 | ||
timestamp: 6 | ||
write_timestamp: 8 | ||
pixel_count: 7 | ||
battery_voltage_raw: 9 | ||
input_voltage_raw: 10 |