mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
fix breakages due to fbconduit api changes regarding missing revs
Summary: FBConduit used to throw a conduit error when a rev didn't map. Now, it just returns an empty string for the mapping. This updates the fbconduit extension so that it matches the server behavior. Test Plan: passed unit tests. Reviewers: mitrandir, ericsumner, durham Reviewed By: ericsumner Subscribers: mitrandir Differential Revision: https://phabricator.fb.com/D2331464 Tasks: 7970302 Signature: t1:2331464:1439500203:cbf79e9b9c54aebdf33bbad82c1982b5a69e8bc9
This commit is contained in:
parent
273f9d02a8
commit
6fdff081b8
16
fbconduit.py
16
fbconduit.py
@ -142,7 +142,9 @@ def showgitnode(repo, ctx, templ, **args):
|
||||
to_scm='git',
|
||||
revs=[ctx.hex()]
|
||||
)
|
||||
matches.append((backingrepo, result[ctx.hex()]))
|
||||
githash = result[ctx.hex()]
|
||||
if githash != "":
|
||||
matches.append((backingrepo, githash))
|
||||
except ConduitError:
|
||||
pass
|
||||
|
||||
@ -170,6 +172,7 @@ def gitnode(repo, subset, x):
|
||||
backingrepos = repo.ui.configlist('fbconduit', 'backingrepos', default=[reponame])
|
||||
|
||||
peerpath = repo.ui.expandpath('default')
|
||||
translationerror = False
|
||||
for backingrepo in backingrepos:
|
||||
try:
|
||||
result = _call_conduit('scmquery.get.mirrored.revs',
|
||||
@ -179,13 +182,18 @@ def gitnode(repo, subset, x):
|
||||
to_scm='hg',
|
||||
revs=[n]
|
||||
)
|
||||
break
|
||||
hghash = result[n]
|
||||
if hghash != '':
|
||||
break
|
||||
except ConduitError as e:
|
||||
pass
|
||||
else:
|
||||
if 'unknown revision' not in str(e.args):
|
||||
repo.ui.warn("Could not translate revision {0}.\n".format(n))
|
||||
translationerror = True
|
||||
|
||||
if translationerror or result[n] == "":
|
||||
repo.ui.warn("Could not translate revision {0}.\n".format(n))
|
||||
return subset.filter(lambda r: False)
|
||||
|
||||
rn = repo[node.bin(result[n])].rev()
|
||||
return subset.filter(lambda r: r == rn)
|
||||
|
||||
|
@ -32,14 +32,10 @@ class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
response = {}
|
||||
|
||||
for rev in revs:
|
||||
if not translations.has_key(rev):
|
||||
response['result'] = None
|
||||
response['error_code'] = "ERR-CONDUIT-CORE"
|
||||
response['error_info'] = "get_mirrored_revs Failed, " \
|
||||
"error: 'NoneType' object is not "\
|
||||
"iterable"
|
||||
break
|
||||
translated_revs[rev] = translations[rev]
|
||||
if rev in translations:
|
||||
translated_revs[rev] = translations[rev]
|
||||
else:
|
||||
translated_revs[rev] = ""
|
||||
else:
|
||||
response['result'] = translated_revs
|
||||
response['error_code'] = None
|
||||
|
Loading…
Reference in New Issue
Block a user