@@ -79,8 +79,8 @@ def submit_to_phabricator(rev_id):
7979 # Chain revisions together if needed
8080 @retry
8181 def chain_revisions (parent_rev , child_rev ):
82- # First get the PHID of the revision
83- cmd = "echo " + quote_echo_string ("""{"constraints": {"ids":[%s]}}""" % child_rev )
82+ # First get the PHID of the parent revision
83+ cmd = "echo " + quote_echo_string ("""{"constraints": {"ids":[%s]}}""" % parent_rev )
8484 cmd += " | %s call-conduit --conduit-uri=%s differential.revision.search --" "" % (_arc (), self .url )
8585
8686 ret = self .run (cmd , shell = True )
@@ -90,26 +90,26 @@ def chain_revisions(parent_rev, child_rev):
9090 raise Exception ("Could not decode response as JSON: %s" % ret .stdout .decode ())
9191
9292 if result ['error' ]:
93- raise Exception ("Got an error from phabricator when trying to search for %s" % (child_rev ))
93+ raise Exception ("Got an error from phabricator when trying to search for %s" % (parent_rev ))
9494
9595 assert 'response' in result
9696 assert 'data' in result ['response' ]
9797 if len (result ['response' ]['data' ]) != 1 :
9898 raise Exception ("When querying conduit for diff %s, we got back %i results"
99- % (child_rev , len (result ['response' ]['data' ])))
99+ % (parent_rev , len (result ['response' ]['data' ])))
100100
101- child_phid = result ['response' ]['data' ][0 ]['phid' ]
101+ parent_phid = result ['response' ]['data' ][0 ]['phid' ]
102102
103- # Now connect them
104- cmd = "echo " + quote_echo_string ("""{"transactions": [{"type":"parents.add", "value":["%s"]}], "objectIdentifier": "%s"}""" % (child_phid , parent_rev ))
103+ # Now connect them - add parent as parent of child
104+ cmd = "echo " + quote_echo_string ("""{"transactions": [{"type":"parents.add", "value":["%s"]}], "objectIdentifier": "%s"}""" % (parent_phid , child_rev ))
105105 cmd += " | %s call-conduit --conduit-uri=%s differential.revision.edit --" "" % (_arc (), self .url )
106106 ret = self .run (cmd , shell = True )
107107 try :
108108 result = json .loads (ret .stdout .decode ())
109109 except Exception :
110110 raise Exception ("Could not decode response as JSON: %s" % ret .stdout .decode ())
111111 if result ['error' ]:
112- raise Exception ("Got an error from phabricator when trying chain revisions, parent: %s, child %s %s" % (parent_rev , child_rev , child_phid ))
112+ raise Exception ("Got an error from phabricator when trying chain revisions, parent: %s, child %s %s" % (parent_rev , child_rev , parent_phid ))
113113
114114 parent_rev = phab_revisions [0 ]
115115 for child_rev in phab_revisions [1 :]:
0 commit comments