cm: build: Fix cherry picking specific patchsets

Change-Id: I396a1218f141a1ff4cb45252cc01a1487c2afd31
diff --git a/build/tools/repopick.py b/build/tools/repopick.py
index 7d16438..6634357 100755
--- a/build/tools/repopick.py
+++ b/build/tools/repopick.py
@@ -268,6 +268,7 @@
             continue
 
         change = int(change)
+        patchset = int(patchset)
         review = next((x for x in reviews if x['number'] == change), None)
         if review is None:
             print('Change %d not found, skipping' % change)
@@ -286,7 +287,7 @@
         mergables[-1]['id'] = change
         if patchset:
             try:
-                mergables[-1]['fetch'] = [x['fetch'] for x in review['revisions'] if x['_number'] == patchset][0]
+                mergables[-1]['fetch'] = [review['revisions'][x]['fetch'] for x in review['revisions'] if review['revisions'][x]['_number'] == patchset][0]
                 mergables[-1]['id'] = '{0}/{1}'.format(change, patchset)
             except (IndexError, ValueError):
                 args.quiet or print('ERROR: The patch set {0}/{1} could not be found, using CURRENT_REVISION instead.'.format(change, patchset))