Merge "Fixes clone fork change URL" into stable/euphrates
authorTim Rozet <trozet@redhat.com>
Sat, 23 Sep 2017 19:46:31 +0000 (19:46 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Sat, 23 Sep 2017 19:46:31 +0000 (19:46 +0000)
apex/build/build_utils.py

index 14327a9..66a63d3 100644 (file)
@@ -16,6 +16,8 @@ import re
 import shutil
 import sys
 
+from urllib.parse import quote_plus
+
 
 def clone_fork(args):
     ref = None
@@ -35,7 +37,9 @@ def clone_fork(args):
         change_id = m.group(1)
         logging.info("Using change ID {} from {}".format(change_id, args.repo))
         rest = GerritRestAPI(url=args.url)
-        change_str = "changes/{}?o=CURRENT_REVISION".format(change_id)
+        change_path = "{}~{}~{}".format(args.repo, quote_plus(args.branch),
+                                        change_id)
+        change_str = "changes/{}?o=CURRENT_REVISION".format(change_path)
         change = rest.get(change_str)
         try:
             assert change['status'] not in 'ABANDONED' 'CLOSED',\
@@ -104,5 +108,6 @@ def main():
         parser.print_help()
         exit(1)
 
+
 if __name__ == "__main__":
     main()