<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -39,12 +39,7 @@ parser = HansardParser.new(people)
 # First check that there isn't already a patch file
 patch_file_path = &quot;#{File.dirname(__FILE__)}/data/patches/#{house}.#{date}.xml.patch&quot;
 
-if File.exists?(patch_file_path)
-  puts &quot;Patch file #{patch_file_path} already exists...&quot;
-  exit
-end
-
-File.open(&quot;original.xml&quot;, &quot;w&quot;) {|f| f &lt;&lt; parser.hansard_xml_source_data_on_date(date, house)}
-FileUtils.cp(&quot;original.xml&quot;, &quot;patched.xml&quot;)
+File.open(&quot;original.xml&quot;, &quot;w&quot;) {|f| f &lt;&lt; parser.unpatched_hansard_xml_source_data_on_date(date, house)}
+File.open(&quot;patched.xml&quot;, &quot;w&quot;) {|f| f &lt;&lt; parser.hansard_xml_source_data_on_date(date, house)}
 system(&quot;mate --wait patched.xml&quot;)
 system(&quot;diff -u original.xml patched.xml &gt; #{patch_file_path}&quot;)</diff>
      <filename>create_patch.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,8 +50,9 @@ class HansardParser
   end
   
   # Returns the XML file loaded from aph.gov.au as plain text which contains all the Hansard data
-  # Returns nil if it doesn't exist
-  def hansard_xml_source_data_on_date(date, house)
+  # Returns nil it it doesn't exist
+  # This is the original data without any patches applied at this end
+  def unpatched_hansard_xml_source_data_on_date(date, house)
     agent = MechanizeProxy.new
     agent.cache_subdirectory = cache_subdirectory(date, house)
 
@@ -67,15 +68,22 @@ class HansardParser
         @logger.error &quot;Link to XML download is missing&quot;
         nil
       else
-        text = agent.click(link).body
-        # Now check whether there is a patch for that day and if so apply it
-        patch_file_path = &quot;#{File.dirname(__FILE__)}/../data/patches/#{house}.#{date}.xml.patch&quot;
-        if File.exists?(patch_file_path)
-          puts &quot;Using patch file: #{patch_file_path}&quot;
-          Patch::patch(text, File.read(patch_file_path))
-        else
-          text
-        end
+        agent.click(link).body
+      end
+    end
+  end
+  
+  # Returns the XML file loaded from aph.gov.au as plain text which contains all the Hansard data
+  # Returns nil if it doesn't exist
+  def hansard_xml_source_data_on_date(date, house)
+    text = unpatched_hansard_xml_source_data_on_date(date, house)
+    if text
+      # Now check whether there is a patch for that day and if so apply it
+      patch_file_path = &quot;#{File.dirname(__FILE__)}/../data/patches/#{house}.#{date}.xml.patch&quot;
+      if File.exists?(patch_file_path)
+        Patch::patch(text, File.read(patch_file_path))
+      else
+        text
       end
     end
   end</diff>
      <filename>lib/hansard_parser.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>510cf8fd6c091e25d7a24710be6d5adb71dd675a</id>
    </parent>
  </parents>
  <author>
    <name>Matthew Landauer</name>
    <email>matthew@openaustralia.org</email>
  </author>
  <url>http://github.com/mlandauer/openaustralia-parser/commit/45c3356a06cacb4e78393879c2f45453fdc62ad1</url>
  <id>45c3356a06cacb4e78393879c2f45453fdc62ad1</id>
  <committed-date>2009-04-10T19:31:32-07:00</committed-date>
  <authored-date>2009-04-10T19:28:02-07:00</authored-date>
  <message>create_patch script will now take into account pre existing patch</message>
  <tree>549d2cb6020f7ac58bceabd807507d582edb31d7</tree>
  <committer>
    <name>Matthew Landauer</name>
    <email>matthew@openaustralia.org</email>
  </committer>
</commit>
