From d54bbb3bebde4dac8057a21393539a9559ad03c1 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 7 Jun 2014 17:50:35 -0700 Subject: [PATCH] don't barf when something not found in git history -- just return nothing, as it's the dev case --- xwords4/android/scripts/info.py | 41 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/xwords4/android/scripts/info.py b/xwords4/android/scripts/info.py index d7b9597da..153b16d07 100755 --- a/xwords4/android/scripts/info.py +++ b/xwords4/android/scripts/info.py @@ -302,28 +302,29 @@ def getXlate( params, name, stringsHash ): head = repo.getHeadRev() logging.debug('head = %s' % head) rjavarevs = repo.getRevsBetween(head, stringsHash, rPath) - assert( 1 >= len(rjavarevs) ) - assert( stringsHash == rjavarevs[-1] ) - if 1 == len(rjavarevs): - firstPossible = head - else: - firstPossible = rjavarevs[-2] + '^' - # get actual number for rev^ - firstPossible = repo.getRevsBetween( firstPossible, firstPossible )[0] - logging.debug('firstPossible: %s' % firstPossible) + if rjavarevs: + assert( 1 >= len(rjavarevs) ) + assert( stringsHash == rjavarevs[-1] ) + if 1 == len(rjavarevs): + firstPossible = head + else: + firstPossible = rjavarevs[-2] + '^' + # get actual number for rev^ + firstPossible = repo.getRevsBetween( firstPossible, firstPossible )[0] + logging.debug('firstPossible: %s' % firstPossible) - for entry in params: - curVers = entry[k_XLATEVERS] - if not curVers == firstPossible: - locale = entry[k_LOCALE] + for entry in params: + curVers = entry[k_XLATEVERS] + if not curVers == firstPossible: + locale = entry[k_LOCALE] - data = mk_for_download.getXlationFor( repo, rDotJava, locale, \ - firstPossible ) - if data: result.append( { k_LOCALE: locale, - k_OLD: curVers, - k_NEW: firstPossible, - k_PAIRS: data, - } ) + data = mk_for_download.getXlationFor( repo, rDotJava, locale, \ + firstPossible ) + if data: result.append( { k_LOCALE: locale, + k_OLD: curVers, + k_NEW: firstPossible, + k_PAIRS: data, + } ) if 0 == len(result): result = None logging.debug( "getXlate=>%s" % (json.dumps(result)) )