Skip to content

Commit

Permalink
Use git rev-parse to check for git repository, bump to version 13.1 (#10
Browse files Browse the repository at this point in the history
)

* Use git rev-parse to verify git repository

* Clean up unused imports

* Bump version to 13.1
flodolo authored Jun 4, 2024
1 parent a4061af commit e0183e8
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## fluent.migrate 0.13.1 (Jun 4, 2024)

- Use `git rev-parse` directly to check if the folder is within a git repository ([#10](https://github.com/mozilla/fluent-migrate/pull/10)). This is needed to support migrations in a git monorepo instead of individual hg repositories.

## fluent.migrate 0.13.0 (Feb 1, 2024)

- Add RepoClient as wrapper that auto-detects and supports both git & hg ([#6](https://github.com/mozilla/fluent-migrate/pull/6))
11 changes: 6 additions & 5 deletions fluent/migrate/repo_client.py
Original file line number Diff line number Diff line change
@@ -28,13 +28,14 @@ def __init__(self, root: str):
self.root = root
if isdir(join(root, ".hg")):
self.hgclient = hglib.open(root, "utf-8")
elif isdir(join(root, ".git")):
else:
self.hgclient = None
stdout = git(self.root, "rev-parse", "--is-inside-work-tree")
try:
stdout = git(self.root, "rev-parse", "--is-inside-work-tree")
except Exception:
stdout = ""
if stdout != "true\n":
raise Exception("git rev-parse failed")
else:
raise Exception(f"Unsupported repository: {root}")
raise Exception(f"Unsupported repository: {root}")

def close(self):
if self.hgclient:
1 change: 0 additions & 1 deletion fluent/migrate/validator.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
from fluent.migrate import transforms
from fluent.migrate.errors import MigrationError
from fluent.migrate.helpers import transforms_from
from fluent.syntax import ast as FTL
from fluent.syntax.visitor import Visitor
from compare_locales import mozpath

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

setup(
name="fluent.migrate",
version="0.13.0",
version="0.13.1",
description="Toolchain to migrate legacy translation to Fluent.",
author="Mozilla",
author_email="l10n-drivers@mozilla.org",
6 changes: 2 additions & 4 deletions tests/migrate/test_concat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import unittest
from compare_locales.parser import PropertiesParser, DTDParser

import fluent.syntax.ast as FTL
from fluent.migrate.util import parse, ftl_pattern_to_json
from fluent.migrate.helpers import VARIABLE_REFERENCE, MESSAGE_REFERENCE
from fluent.migrate.transforms import CONCAT, COPY, REPLACE
from fluent.migrate.helpers import MESSAGE_REFERENCE
from fluent.migrate.transforms import CONCAT, COPY


class TestConcatSingleChild(unittest.TestCase):
2 changes: 1 addition & 1 deletion tests/migrate/test_concat_integration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from compare_locales.parser import PropertiesParser, DTDParser
from compare_locales.parser import DTDParser

import fluent.syntax.ast as FTL
from fluent.migrate.util import parse, ftl_pattern_to_json

0 comments on commit e0183e8

Please sign in to comment.