Skip to content

Commit

Permalink
consider revision when checking whether there was an update
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Apr 15, 2023
1 parent 71e0c96 commit 8ab80a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nix_update/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def git_commit(git_dir: str, package: Package) -> None:
if isinstance(package.cargo_lock, CargoLockInSource):
cmd.append(package.cargo_lock.path)
run(cmd, stdout=None)
if new_version and package.old_version != new_version.number:
if new_version and (
package.old_version != new_version.number
or (new_version.rev and new_version.rev != package.rev)
):
run(
["git", "-C", git_dir, "commit", "--verbose", "--message", msg], stdout=None
)
Expand Down
8 changes: 6 additions & 2 deletions nix_update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def replace_version(package: Package) -> bool:
if new_version.startswith("v"):
new_version = new_version[1:]

if old_version != new_version:
changed = old_version != new_version or (
package.new_version.rev is not None and package.new_version.rev != package.rev
)

if changed:
info(f"Update {old_version} -> {new_version} in {package.filename}")
with fileinput.FileInput(package.filename, inplace=True) as f:
for line in f:
Expand All @@ -38,7 +42,7 @@ def replace_version(package: Package) -> bool:
else:
info(f"Not updating version, already {old_version}")

return old_version != new_version
return changed


def to_sri(hashstr: str) -> str:
Expand Down

0 comments on commit 8ab80a4

Please sign in to comment.