From 34ea3a00a89492cf0a48f60a7e19157e98a61bd7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Jan 2013 16:47:14 +0530 Subject: [PATCH] ... --- setup/translations.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/setup/translations.py b/setup/translations.py index e3622d394e..e0a512d21c 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -227,10 +227,22 @@ class GetTranslations(Translations): # {{{ ans.append(line.split()[-1]) return ans + def resolve_conflicts(self): + conflict = False + for line in subprocess.check_output(['bzr', 'status']).splitlines(): + if line == 'conflicts:': + conflict = True + break + if not conflict: + raise Exception('bzr merge failed and no conflicts found') + subprocess.check_call(['bzr', 'resolve', '--take-other']) + def run(self, opts): if not self.modified_translations: - subprocess.check_call(['bzr', 'merge', self.BRANCH]) - subprocess.check_call(['bzr', 'resolve', '--take-other']) + try: + subprocess.check_call(['bzr', 'merge', self.BRANCH]) + except subprocess.CalledProcessError: + self.resolve_conflicts() self.check_for_errors() if self.modified_translations: