Skip to content

Commit ee0f56f

Browse files
committed
flake/diff-plugins: allow specifying HEAD commit
1 parent 01a861f commit ee0f56f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

flake/dev/diff-plugins.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@ def main():
1414

1515
parser = ArgumentParser(description="Compare nixvim plugins with another revision")
1616
parser.add_argument(
17-
"flakeref",
18-
metavar="old",
17+
"base_flakeref",
18+
metavar="before",
1919
help="the commit or flakeref to compare against",
2020
type=flakeref,
2121
)
22+
parser.add_argument(
23+
"head_flakeref",
24+
metavar="after",
25+
help="the commit or flakeref to compare to (default .)",
26+
type=flakeref,
27+
nargs="?",
28+
default=".",
29+
const=".",
30+
)
2231
parser.add_argument(
2332
"--compact",
2433
"-c",
@@ -27,8 +36,8 @@ def main():
2736
)
2837
args = parser.parse_args()
2938

30-
after_plugins = list_plugins(".")
31-
before_plugins = list_plugins(args.flakeref)
39+
before_plugins = list_plugins(args.base_flakeref)
40+
after_plugins = list_plugins(args.head_flakeref)
3241
print(
3342
json.dumps(
3443
diff(before_plugins, after_plugins),
@@ -51,7 +60,9 @@ def flakeref(arg):
5160
repo_rxp = re.compile(
5261
r"^(?P<protocol>[^:/]+:)?(?P<repo>(:?[^/]+)/(:?[^/]+))(?P<sha>/[A-Fa-f0-9]{6,40})?$"
5362
)
54-
if sha_rxp.match(arg):
63+
if arg.startswith("."):
64+
return arg
65+
elif sha_rxp.match(arg):
5566
return f"{default_protocol}{default_repo}/{arg}"
5667
elif m := repo_rxp.match(arg):
5768
protocol = m.group("protocol") or default_protocol

0 commit comments

Comments
 (0)