Beispiel #1
0
def gen_diff(action, path, version, cp_id, filename):
	if filter(filename):
		return

	if action == "A":
		if path[-1] <> "/":
			logging.info('code path: %s', path)
			df = GenDiffer(svn_url_prefix, path, version)
			code = df.get_code()

			db.execute("insert into svn_diffs(f_cp_id, diff) values(%s, %s)", cp_id, code)
			logging.debug('insert added record to db...')

	elif action == "M":
		# not directory
		if path[-1] <> "/":
			logging.info('code path: %s', path)
			df = GenDiffer(svn_url_prefix , path, version)
			df_html = df.gen_differ()
			if df_html <> None:
				db.execute("insert into svn_diffs(f_cp_id, diff) values(%s, %s)", cp_id, df_html)
				logging.debug('insert diff record to db...')
	elif action == "D":
		pass		
	elif action == 'R':
		pass
Beispiel #2
0
	def get(self):
		svn_url_prefix = self.get_argument("pre", "http://svn.sc4.paypal.com/svn/projects")
		path = self.get_argument("fp", None)
		version = self.get_argument("ver", None)

		# TODO prefix manage in table of database
		print svn_url_prefix
		print path
		print version

		if path[0] != '/':
			path = '/' + path

		df = GenDiffer(svn_url_prefix , path, version, 'f')
		df_html = df.gen_differ()
		if df_html == None:	
			raise tornado.web.HTTPError(500, "could not get code diff...")			
		else:
			self.write(df_html)