Пример #1
0
 def get_commits_to_push_summary(self):
     branch_refs = self.get_commits_to_push()
     unpushed_branches = len([v for v in branch_refs.values() if v])
     unpushed_commits = sum(len(v) for v in branch_refs.values())
     if unpushed_commits:
         if unpushed_branches > 1:
             # Translators: First element is replaced by translated "%d
             # unpushed commits", second element is replaced by translated
             # "%d branches"
             label = _("{unpushed_commits} in {unpushed_branches}").format(
                 unpushed_commits=ngettext(
                     "%d unpushed commit", "%d unpushed commits",
                     unpushed_commits) % unpushed_commits,
                 unpushed_branches=ngettext("%d branch", "%d branches",
                                            unpushed_branches) %
                 unpushed_branches,
             )
         else:
             # Translators: These messages cover the case where there is
             # only one branch, and are not part of another message.
             label = ngettext("%d unpushed commit", "%d unpushed commits",
                              unpushed_commits) % (unpushed_commits)
     else:
         label = ""
     return label
Пример #2
0
Файл: git.py Проект: GNOME/meld
 def get_commits_to_push_summary(self):
     branch_refs = self.get_commits_to_push()
     unpushed_branches = len([v for v in branch_refs.values() if v])
     unpushed_commits = sum(len(v) for v in branch_refs.values())
     if unpushed_commits:
         if unpushed_branches > 1:
             # Translators: First %s is replaced by translated "%d unpushed
             # commits", second %s is replaced by translated "%d branches"
             label = _("%s in %s") % (
                 ngettext("%d unpushed commit", "%d unpushed commits", unpushed_commits) % unpushed_commits,
                 ngettext("%d branch", "%d branches", unpushed_branches) % unpushed_branches,
             )
         else:
             # Translators: These messages cover the case where there is
             # only one branch, and are not part of another message.
             label = ngettext("%d unpushed commit", "%d unpushed commits", unpushed_commits) % (unpushed_commits)
     else:
         label = ""
     return label