don't barf when something not found in git history -- just return nothing, as it's the dev case

This commit is contained in:
Eric House 2014-06-07 17:50:35 -07:00
parent f3daed2e12
commit d54bbb3beb

View file

@ -302,28 +302,29 @@ def getXlate( params, name, stringsHash ):
head = repo.getHeadRev() head = repo.getHeadRev()
logging.debug('head = %s' % head) logging.debug('head = %s' % head)
rjavarevs = repo.getRevsBetween(head, stringsHash, rPath) rjavarevs = repo.getRevsBetween(head, stringsHash, rPath)
assert( 1 >= len(rjavarevs) ) if rjavarevs:
assert( stringsHash == rjavarevs[-1] ) assert( 1 >= len(rjavarevs) )
if 1 == len(rjavarevs): assert( stringsHash == rjavarevs[-1] )
firstPossible = head if 1 == len(rjavarevs):
else: firstPossible = head
firstPossible = rjavarevs[-2] + '^' else:
# get actual number for rev^ firstPossible = rjavarevs[-2] + '^'
firstPossible = repo.getRevsBetween( firstPossible, firstPossible )[0] # get actual number for rev^
logging.debug('firstPossible: %s' % firstPossible) firstPossible = repo.getRevsBetween( firstPossible, firstPossible )[0]
logging.debug('firstPossible: %s' % firstPossible)
for entry in params: for entry in params:
curVers = entry[k_XLATEVERS] curVers = entry[k_XLATEVERS]
if not curVers == firstPossible: if not curVers == firstPossible:
locale = entry[k_LOCALE] locale = entry[k_LOCALE]
data = mk_for_download.getXlationFor( repo, rDotJava, locale, \ data = mk_for_download.getXlationFor( repo, rDotJava, locale, \
firstPossible ) firstPossible )
if data: result.append( { k_LOCALE: locale, if data: result.append( { k_LOCALE: locale,
k_OLD: curVers, k_OLD: curVers,
k_NEW: firstPossible, k_NEW: firstPossible,
k_PAIRS: data, k_PAIRS: data,
} ) } )
if 0 == len(result): result = None if 0 == len(result): result = None
logging.debug( "getXlate=>%s" % (json.dumps(result)) ) logging.debug( "getXlate=>%s" % (json.dumps(result)) )