Skip to content

Commit a349377

Browse files
bors[bot]figsoda
andauthored
Merge #152
152: consider revision when checking whether there was an update r=figsoda a=figsoda Co-authored-by: figsoda <[email protected]>
2 parents 71e0c96 + 8ab80a4 commit a349377

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

nix_update/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ def git_commit(git_dir: str, package: Package) -> None:
160160
if isinstance(package.cargo_lock, CargoLockInSource):
161161
cmd.append(package.cargo_lock.path)
162162
run(cmd, stdout=None)
163-
if new_version and package.old_version != new_version.number:
163+
if new_version and (
164+
package.old_version != new_version.number
165+
or (new_version.rev and new_version.rev != package.rev)
166+
):
164167
run(
165168
["git", "-C", git_dir, "commit", "--verbose", "--message", msg], stdout=None
166169
)

nix_update/update.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def replace_version(package: Package) -> bool:
2828
if new_version.startswith("v"):
2929
new_version = new_version[1:]
3030

31-
if old_version != new_version:
31+
changed = old_version != new_version or (
32+
package.new_version.rev is not None and package.new_version.rev != package.rev
33+
)
34+
35+
if changed:
3236
info(f"Update {old_version} -> {new_version} in {package.filename}")
3337
with fileinput.FileInput(package.filename, inplace=True) as f:
3438
for line in f:
@@ -38,7 +42,7 @@ def replace_version(package: Package) -> bool:
3842
else:
3943
info(f"Not updating version, already {old_version}")
4044

41-
return old_version != new_version
45+
return changed
4246

4347

4448
def to_sri(hashstr: str) -> str:

0 commit comments

Comments
 (0)