2604: Why do we find opened files ('Affected files') by using pattern matching instead of 'p4 opened -c CHANGESET'?

eyu****@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Dec. 27, 2013
What version are you running?
1.6.1

What's the URL of the page containing the problem?
No particular URL. It is a question about postreview.py in rbtools

What steps will reproduce the problem?
In postrevew.py, I see this code:
2190         if cl_is_pending and (v[0] < 2002 or (v[0] == "2002" and v[1] < 2)      
2191                               or changenum == "default"):                       
2192             # Pre-2002.2 doesn't give file list in pending changelists,         
2193             # or we don't have a description for a default changeset,           
2194             # so we have to get it a different way.                             
2195             info = execute(["p4", "opened", "-c", str(changenum)],              
2196                            split_lines=True)                                    
2197                                                                                 
2198             if len(info) == 1 and info[0].startswith("File(s) not opened on this client."):
2199                 die("Couldn't find any affected files for this change.")        
2200                                                                                 
2201             for line in info:                                                   
2202                 data = line.split(" ")                                          
2203                 description.append("... %s %s" % (data[0], data[2]))            
2204                                                                                 
2205         else:                                                                   
2206             # Get the file list                                                 
2207             for line_num, line in enumerate(description):                       
2208                 if 'Affected files ...' in line:                                
2209                     break                                                       
2210             else:                                                               
2211                 # Got to the end of all the description lines and didn't find   
2212                 # what we were looking for.                                     
2213                 die("Couldn't find any affected files for this change.")        


So any p4d process that is after 2002.2 is getting the changed file list by searching for 'Affected files ...' in output from p4 describe -s. Why can't you just get the files directly from p4 opened -c?

With the current way of getting file list, it is possible to error out if someone put the string 'Affect files ...' in the change description they put in the perforce form.
david
#1 david
  • +Component-RBTools
david
#2 david
  • +PendingReview
  • +david
david
#3 david
Fixed in rbtools master (5d12350).
  • -PendingReview
    +Fixed