vendor/bundle/ruby/1.8/gems/io-reactor-1.0.4/rake/svn.rb
def make_svn_changelog( dir='.' )
	require 'xml/libxml'

	changelog = ''
	path_prefix = '/' + get_svn_path( dir ) + '/'

	xmllog = make_xml_svn_log( dir, 0 )

	parser = XML::Parser.string( xmllog )
	root = parser.parse.root
	root.find( '//log/logentry' ).to_a.reverse.each do |entry|
		trace "Making a changelog entry for r%s" % [ entry['revision'] ]

		added   = []
		deleted = []
		changed = []

		entry.find( 'paths/path').each do |path|
			pathname = path.content
			pathname.sub!( path_prefix , '' ) if pathname.count('/') > 1

			case path['action']
			when 'A', 'R'
				if path['copyfrom-path']
					verb = path['action'] == 'A' ? 'renamed' : 'copied'
					added << "%s\n#{FILE_INDENT}-> #{verb} from %s@r%s" % [
						pathname,
						path['copyfrom-path'],
						path['copyfrom-rev'],
					]
				else
					added << "%s (new)" % [ pathname ]
				end
			
			when 'M'
				changed << pathname
			
			when 'D'
				deleted << pathname
			
			else
				log "Unknown action %p in rev %d" % [ path['action'], entry['revision'] ]
			end
		
		end

		date = Time.parse( entry.find_first('date').content )

		# cvs2svn doesn't set 'author'
		author = 'unknown'
		if entry.find_first( 'author' )
			author = entry.find_first( 'author' ).content
		end
		              
		msg = entry.find_first( 'msg' ).content
		rev = entry['revision']

		changelog << "-- #{date.rfc2822} by #{author} (r#{rev}) -----\n"
		changelog << "   Added:   " << humanize_file_list(added)   << "\n" unless added.empty?
		changelog << "   Changed: " << humanize_file_list(changed) << "\n" unless changed.empty?
		changelog << "   Deleted: " << humanize_file_list(deleted) << "\n" unless deleted.empty?
		changelog << "\n"
		
		indent = msg[/^(\s*)/] + LOG_INDENT
		
		changelog << indent << msg.strip.gsub(/\n\s*/m, "\n#{indent}")
		changelog << "\n\n\n"
	end
	
	return changelog
end
### Create a changelog from the subversion log of the specified +dir+ and return it.
Create a changelog from the subversion log of the specified +dir+ and return it.
Create a changelog from the subversion log of the specified + dir + and return it .
def make_svn_changelog( dir='.' )
	require 'xml/libxml'
	changelog = ''
	path_prefix = '/' + get_svn_path( dir ) + '/'
	xmllog = make_xml_svn_log( dir, 0 )
	parser = XML::Parser.string( xmllog )
	root = parser.parse.root
	root.find( '//log/logentry' ).to_a.reverse.each do |entry|
		trace "Making a changelog entry for r%s" % [ entry['revision'] ]
		added   = []
		deleted = []
		changed = []
		entry.find( 'paths/path').each do |path|
			pathname = path.content
			pathname.sub!( path_prefix , '' ) if pathname.count('/') > 1
			case path['action']
			when 'A', 'R'
				if path['copyfrom-path']
					verb = path['action'] == 'A' ? 'renamed' : 'copied'
					added << "%s\n#{FILE_INDENT}-> #{verb} from %s@r%s" % [
						pathname,
						path['copyfrom-path'],
						path['copyfrom-rev'],
					]
				else
					added << "%s (new)" % [ pathname ]
				end
			when 'M'
				changed << pathname
			when 'D'
				deleted << pathname
			else
				log "Unknown action %p in rev %d" % [ path['action'], entry['revision'] ]
			end
		end
		date = Time.parse( entry.find_first('date').content )
		author = 'unknown'
		if entry.find_first( 'author' )
			author = entry.find_first( 'author' ).content
		end
		msg = entry.find_first( 'msg' ).content
		rev = entry['revision']
		changelog << "-- #{date.rfc2822} by #{author} (r#{rev}) -----\n"
		changelog << "   Added:   " << humanize_file_list(added)   << "\n" unless added.empty?
		changelog << "   Changed: " << humanize_file_list(changed) << "\n" unless changed.empty?
		changelog << "   Deleted: " << humanize_file_list(deleted) << "\n" unless deleted.empty?
		changelog << "\n"
		indent = msg[/^(\s*)/] + LOG_INDENT
		changelog << indent << msg.strip.gsub(/\n\s*/m, "\n#{indent}")
		changelog << "\n\n\n"
	end
	return changelog
end
def make_svn_changelog ( dir = '.' ) require 'xml/libxml' changelog = '' path_prefix = '/' + get_svn_path ( dir ) + '/' xmllog = make_xml_svn_log ( dir , 0 ) parser = XML :: Parser . string ( xmllog ) root = parser . parse . root root . find ( '//log/logentry' ) . to_a . reverse . each do | entry | trace "Making a changelog entry for r%s" % [ entry [ 'revision' ] ] added = [ ] deleted = [ ] changed = [ ] entry . find ( 'paths/path' ) . each do | path | pathname = path . content pathname . sub! ( path_prefix , '' ) if pathname . count ( '/' ) > 1 case path [ 'action' ] when 'A' , 'R' if path [ 'copyfrom-path' ] verb = path [ 'action' ] == 'A' ? 'renamed' : 'copied' added << "%s\n#{FILE_INDENT}-> #{verb} from %s@r%s" % [ pathname , path [ 'copyfrom-path' ] , path [ 'copyfrom-rev' ] , ] else added << "%s (new)" % [ pathname ] end when 'M' changed << pathname when 'D' deleted << pathname else log "Unknown action %p in rev %d" % [ path [ 'action' ] , entry [ 'revision' ] ] end end date = Time . parse ( entry . find_first ( 'date' ) . content ) author = 'unknown' if entry . find_first ( 'author' ) author = entry . find_first ( 'author' ) . content end msg = entry . find_first ( 'msg' ) . content rev = entry [ 'revision' ] changelog << "-- #{date.rfc2822} by #{author} (r#{rev}) -----\n" changelog << "   Added:   " << humanize_file_list ( added ) << "\n" unless added . empty? changelog << "   Changed: " << humanize_file_list ( changed ) << "\n" unless changed . empty? changelog << "   Deleted: " << humanize_file_list ( deleted ) << "\n" unless deleted . empty? changelog << "\n" indent = msg [ / ^( \s *) / ] + LOG_INDENT changelog << indent << msg . strip . gsub ( / \n \s * /m , "\n#{indent}" ) changelog << "\n\n\n" end return changelog end
Create a changelog from the subversion log of the specified +dir+ and return it.
Create a changelog from the subversion log of the specified + dir + and return it .
# cvs2svn doesn't set 'author'
dir