Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Changelog script to include changes in lib dependencies. #420

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions .github/tools/gitchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ def getTags():
tags = filter(lambda x: "-" not in x, tags)
return natsorted(tags,reverse=True)

def getCommitsBetween( tagA, tagB = "HEAD" ):
commits = os.popen(f"git -P shortlog {tagA}..{tagB}").read().strip().splitlines()
return "\n".join(map( lambda x: x.replace(" ", " - "), commits ))
def getCommitsBetween( tagA, tagB = "HEAD", dir=None):
if dir:
original_dir = os.getcwd()
os.chdir(dir)
Comment on lines +52 to +55
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to easily run this function in other directories I've added the dir parameter to temporarily change the current working directory.

commits = os.popen(f'git log --format="%s (by %an)" --no-merges --reverse {tagA}..{tagB}').read().strip().splitlines()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no way to change shortlog to not group commits, so I've replaced it with git log --no-merges. Reverse was needed because that's the order used by shortlog, which I guess makes sense with older commits first, as we read top to bottom.

The format includes the git author name at the end of the commit title, in case we wanted to still provide attribution.
%s -> commit title
%an -> commit author name

if dir:
os.chdir(original_dir)
return "\n - ".join([""] + commits)

def getRepoURL():
origin = os.popen("git remote get-url origin").read().strip().split( "github.com/", maxsplit=1 )
Expand All @@ -62,6 +67,22 @@ def printLibraryLinks():
for lib in config['libraries']:
output( F" - {lib['name']} = {lib['url']}/tree/{lib['branch']}" )

def getOldAndNewLibCommits(old_commit, new_commit):
old_target_locked = json.loads(os.popen(f"git show {old_commit}:target-locked.json").read())
new_target_locked = json.loads(os.popen(f"git show {new_commit}:target-locked.json").read())
lib_versions = {}
# We only have a handful of libraries in the list, okay to be inefficient
for old_lib in old_target_locked["libraries"]:
for new_lib in new_target_locked["libraries"]:
if old_lib["name"] == new_lib["name"]:
lib_versions[old_lib["name"]] = {
"old": old_lib["branch"],
"new": new_lib["branch"],
"url": old_lib["url"]
}
return lib_versions


tags = getTags()

defaultTag = "v0.0.1"
Expand Down Expand Up @@ -109,12 +130,23 @@ def printLibraryLinks():
print( "Nothing to do, Stop." )
exit( 0 )

# Target commits
logURL = f"{url}compare/{lastTag}...{options.tag}"

output( f"## [{options.tag}]({logURL})", forcePrint=True )
output( '', forcePrint=True )
output( getCommitsBetween( lastTag, options.tag ), forcePrint=True )

# Library commits
libInfo = getOldAndNewLibCommits( lastTag, options.tag )
for libName, lib in libInfo.items():
libCommits = getCommitsBetween(lib['old'], lib['new'], dir=f"../{libName}")
if libCommits:
diffUrl = f"{lib['url']}/compare/{lib['old']}...{lib['new']}"
diffUrlMarkdown = f"[{lib['old'][:7]}...{lib['new'][:7]}]({diffUrl})"
output(f"\n### {libName} ({diffUrlMarkdown})", forcePrint=True)
output(libCommits, forcePrint=True)

output( '', forcePrint=True )

output( line )
else:
output( line )
Expand Down
51 changes: 25 additions & 26 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,38 @@ The current tag uses the following library versions:

## [v0.2.66](https://github.com/lancaster-university/codal-microbit-v2/compare/v0.2.65...v0.2.66)

Dr John Vidler (2):
- Applying the patch suggested by @dpgeorge to handle large receiving buffers for pullInto()
- Update Changelog.md
- Snapshot v0.2.66
- Updated the Changelog (by Github Actions)
- Update Changelog.md (by Dr John Vidler)
- Snapshot v0.2.66 (by Dr John Vidler)

Github Actions (1):
- Updated the Changelog
### codal-core ([7b6f9df...992c0b1](https://github.com/lancaster-university/codal-core/compare/7b6f9df3b586f8dd9bede4bd0baa0cdc212b6ba2...992c0b11a0eb2a1edca9c2f76821f89a99a3acec))

- Applying the patch suggested by @dpgeorge to handle large receiving buffers for pullInto() (by Dr John Vidler)

## [v0.2.65](https://github.com/lancaster-university/codal-microbit-v2/compare/v0.2.63...v0.2.65)

Carlos Pereira Atencio (1):
- Set MICROBIT_RADIO_MAX_PACKET_SIZE as a configurable value. (#387)

Dr John Vidler (10):
- Merged patch to fix the various sample rate issues
- Corrected Changelog.md after my tag snarfu
- Refined the changelog script to only update the head of the log under normal cases
- Resolved conflict in the manual updates to the ChangeLog
- Added a new CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE constant for channels with no defined rate to use
- Fixed a bug where in some conditions the microphone would not auto-start
- Added MicroBitButton.h to the required includes for MicroBitCompat.h so its still included in the build when not using bluetooth
- Moved the MicroBitButton inclusion to the tail of MicroBitCompat to avoid circular dependencies or a bunch of needless forward declarations
- Bumped the default Mixer2 channel sample rate back up to 44100
- Snapshot v0.2.65
- Updated the Changelog (by Github Actions)
- Corrected Changelog.md after my tag snarfu (by Dr John Vidler)
- Refined the changelog script to only update the head of the log under normal cases (by Dr John Vidler)
- Set MICROBIT_RADIO_MAX_PACKET_SIZE as a configurable value. (#387) (by Carlos Pereira Atencio)
- Change datalog CSV download mime type from text/plain to text/csv (#339) (by Martin Williams)
- Added a new CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE constant for channels with no defined rate to use (by Dr John Vidler)
- Fixed a bug where in some conditions the microphone would not auto-start (by Dr John Vidler)
- Update MicroBitLog to support 3 header formats (#399) (by Matt Hillsdon)
- Added MicroBitButton.h to the required includes for MicroBitCompat.h so its still included in the build when not using bluetooth (by Dr John Vidler)
- Moved the MicroBitButton inclusion to the tail of MicroBitCompat to avoid circular dependencies or a bunch of needless forward declarations (by Dr John Vidler)
- Bumped the default Mixer2 channel sample rate back up to 44100 (by Dr John Vidler)
- Snapshot v0.2.65 (by Dr John Vidler)

Github Actions (1):
- Updated the Changelog
### codal-core ([63f017f...7b6f9df](https://github.com/lancaster-university/codal-core/compare/63f017fdcd12aca769264c36fe47e6071a40e502...7b6f9df3b586f8dd9bede4bd0baa0cdc212b6ba2))

Martin Williams (1):
- Change datalog CSV download mime type from text/plain to text/csv (#339)
- Updated to correctly restore mic state on returning from a deep sleep (by Dr John Vidler)
- Typo (by Dr John Vidler)
- Working audio resampling rates if requested by downstream components of a SplitterChannel (by Dr John Vidler)

Matt Hillsdon (1):
- Update MicroBitLog to support 3 header formats (#399)
### codal-microbit-nrf5sdk ([5714cbe...d41d5c7](https://github.com/microbit-foundation/codal-microbit-nrf5sdk/compare/5714cbe338c3544793bbb841a7ae81708a3ffae1...d41d5c7ebe53a1d01935e61d4ffa891e5112e119))

- Revert "Quieted a warning on fallthrough, as this is intended behaviour" (by Dr John Vidler)

## [v0.2.63](https://github.com/lancaster-university/codal-microbit-v2/compare/v0.2.62...v0.2.63)

Expand Down
Loading