BranchedJobs.py #1

  • //
  • guest/
  • lester_cheung/
  • p4util/
  • p4util/
  • script/
  • BranchedJobs.py
  • View
  • Commits
  • Open Download .zip Download (832 B)
#! python
# Copyright (C) 2011 Sven Erik Knop, Perforce Software. All rights reserved.
# This is a demonstration script, not production quality.
# There is no warranty implied or given.

import sys
import P4

def findJobsBetween(branch1, branch2):
	p4 = P4.P4()
	p4.connect() # implies environment is set correctly outside the script

	changes1 = [ x['change'] for x in p4.run_changes('-i', branch1) ]
	changes2 = [ x['change'] for x in p4.run_changes('-i', branch2) ]

	diff = [ x for x in changes2 if x not in changes1 ]
	
	jobs = []
	for c in diff:
		fixes = p4.run_fixes('-c', c)
		for f in fixes:
			jobs.append( f['Job'] )

	for j in jobs:
		print(j)

	p4.disconnect()
 
if __name__ == '__main__':
	if len(sys.argv) < 3:
		print("Usage: python pca.py path1 path2")
		sys.exit(1)
	
	findJobsBetween(sys.argv[1], sys.argv[2])
	
# Change User Description Committed
#1 8773 Lester Cheung "p4util" as an importable Python package.
//guest/lester_cheung/p4util/script/BranchedJobs.py
#1 8534 Lester Cheung Great artists steal - so I'm stealing Sven's Python library
to make it better!
//guest/sven_erik_knop/P4Pythonlib/scripts/BranchedJobs.py
#1 7974 Sven Erik Knop Added BranchedJobs.py.\nProvided with two codelines (in Perforce format with ...)\nit will print out all jobs that have been integrated into one branch but not the other.