-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use moz.l10n diff instead of git diff #55
Conversation
@@ -1,2 +1,3 @@ | |||
compare-locales ~= 9.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update to 9.0.4 since we're at this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not; I'm hoping to drop the c-l dependency in subsequent PRs. Also, ~=
includes 9.0.4 so that's what we're already using in CI: https://github.com/mozilla-l10n/firefox-l10n-source/actions/runs/9830946288/job/27137710120#step:5:13
for dirpath, dirnames, filenames in walk(a_root): | ||
dirnames[:] = [dn for dn in dirnames if not dn.startswith((".", "_"))] | ||
for fn in filenames: | ||
if not fn.startswith((".", "_")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even have files starting with _
that we want to ignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have directories starting with _
to ignore, and it makes more sense to keep the rule for files as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, would it make sense to put the check into a function? e.g. something along the line of
def ignore_global(name: str) -> bool:
return name.startswith((".", "_"))
dirnames[:] = [dn for dn in dirnames if not ignore_global(dn)]
if not ignore_global(fn):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, sure, but this is a hacky utility script where code quality and maintainability really aren't paramount. If this thing lives for a long time, I'll refactor it to use moz.l10n.paths.L10nDiscoverPaths
instead.
Co-authored-by: Francesco Lodolo <flod@lodolo.net>
for dirpath, dirnames, filenames in walk(a_root): | ||
dirnames[:] = [dn for dn in dirnames if not dn.startswith((".", "_"))] | ||
for fn in filenames: | ||
if not fn.startswith((".", "_")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, would it make sense to put the check into a function? e.g. something along the line of
def ignore_global(name: str) -> bool:
return name.startswith((".", "_"))
dirnames[:] = [dn for dn in dirnames if not ignore_global(dn)]
if not ignore_global(fn):
This uses the purpose-built
l10n_equal()
comparison function frommoz.l10n.resource
, which ignores irrelevant details like message order.Filed initially as a draft, pending on mozilla/moz-l10n#9 and a subsequent release of moz.l10n v0.1.1.Edit: Done.