INNER CODE UNIT · Python
get_commit_info
emanuele-f/PCAPdroid · tools/weblate.py:80
def get_commit_info(commit):
"""Return (name, email, date, message) for *commit*."""
out = git("log", "-1", "--format=%an\n%ae\n%aI\n%s", commit).stdout.strip()
name, email, date, message = out.split("\n", 3)
return name, email, date, message
def has_staged_changes():
return git("diff", "--cached", "--quiet", check=False).returncode != 0
def locale_exists_on_disk(locale):
return os.path.isdir(os.path.join(STRINGS_BASE, f"values-{locale}"))
def count_strings(content, translatable_only=False):
"""Count <string name= entries in an Android strings XML."""
if translatable_only:
return len(re.findall(r'<string name="[^"]*"(?![^>]*translatable="false")', content))
return len(re.findall(r'<string name="', content))