<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 = Integration tests to verify
 
-* Handles conflicts (currently when there is a conflict doesn't update from git repositories, update from svn repositories but ignores the conflict)
+* Port conflicts in temporary checkout directory to working copy:
+It detects and marks conflicts with changes after last update. But when some changes, which were made before last update, conflict when merging in temporary directory, file is merged correctly but conflicts are not marked
+In Piston 1.x old changes were lost, even without conflicts
 * Force addition of Git repositories, because the files might be ignored in .gitignore</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -54,8 +54,7 @@ module Piston
           begin
             pid, stdin, stdout, stderr = Open4::popen4(cmd)
             _, cmdstatus = Process.waitpid2(pid)
-            return stdout.read if cmd =~ /status/ &amp;&amp; cmdstatus.exitstatus == 1
-            raise CommandError, &quot;#{cmd.inspect} exited with status: #{cmdstatus.exitstatus}\n#{stderr.read}&quot; unless cmdstatus.success?
+            raise CommandError, &quot;#{cmd.inspect} exited with status: #{cmdstatus.exitstatus}\n#{stderr.read}&quot; unless cmdstatus.success? || cmdstatus.exitstatus == 1
             return stdout.read
           rescue Errno::ENOENT
             raise BadCommand, cmd.inspect
@@ -68,7 +67,7 @@ module Piston
         def run_real(cmd)
           out = `#{cmd}`
           raise BadCommand, cmd.inspect if $?.exitstatus == 127
-          raise Failed, &quot;#{cmd.inspect} exited with status: #{$?.exitstatus}&quot; unless $?.success? || (cmd =~ /status/ &amp;&amp; $?.exitstatus == 1)
+          raise Failed, &quot;#{cmd.inspect} exited with status: #{$?.exitstatus}&quot; unless $?.success? || $?.exitstatus == 1
           out
         end
       end</diff>
      <filename>lib/piston/git/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,6 @@ module Piston
         super
         git(:clone, repository.url, @dir)
         Dir.chdir(@dir) do
-          logger.debug {&quot;in dir #{@dir}&quot;}
           git(:checkout, &quot;-b&quot;, branch_name, commit)
           response = git(:log, &quot;-n&quot;, &quot;1&quot;)
           @sha1 = $1 if response =~ /commit\s+([a-f\d]{40})/i
@@ -60,10 +59,10 @@ module Piston
         raise ArgumentError, &quot;Commit #{self.commit} of #{repository.url} was never checked out -- can't update&quot; unless @dir
         
         Dir.chdir(@dir) do
-          logger.debug {&quot;in dir #{@dir}&quot;}
-          git(:commit, '-a', '-m', 'local changes') unless git(:status) =~ /nothing to commit/
+          logger.debug {&quot;Saving old changes before updating&quot;}
+          git(:commit, '-a', '-m', 'old changes')
+          logger.debug {&quot;Merging old changes with #{commit}&quot;}
           git(:merge, '--squash', commit)
-
           output = git(:status)
           added = output.scan(/new file:\s+(.*)$/).flatten
           deleted = output.scan(/deleted:\s+(.*)$/).flatten</diff>
      <filename>lib/piston/git/commit.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,11 +62,6 @@ module Piston
         Dir.chdir(path) { git(:add, &quot;.&quot;) }
       end
 
-      def copy_from(revision)
-        super
-        Dir.chdir(path) { git(:add, &quot;-u&quot;) }
-      end
-
       def add(added)
         Dir.chdir(path) do
           added.each { |item| git(:add, item) }
@@ -84,12 +79,36 @@ module Piston
           renamed.each { |from, to| git(:mv, from, to) }
         end
       end
+
+      def downgrade_to(revision)
+        logger.debug {&quot;Creating a branch to copy changes from remote repository&quot;}
+        Dir.chdir(path) { git(:checkout, '-b', &quot;my-#{revision}&quot;, revision) }
+      end
       
+      def merge_local_changes(revision)
+        from_revision = current_revision
+        Dir.chdir(path) do
+          begin
+            logger.debug {&quot;Saving changes in temporary branch&quot;}
+            git(:commit, '-a', '-m', 'merging')
+            logger.debug {&quot;Return to previous branch&quot;}
+            git(:checkout, revision)
+            logger.debug {&quot;Merge changes from temporary branch&quot;}
+            git(:merge, '--squash', from_revision)
+          rescue Piston::Git::Client::CommandError
+            git(:checkout, revision)
+          ensure
+            logger.debug {&quot;Deleting temporary branch&quot;}
+            git(:branch, '-D', from_revision)
+          end
+        end
+      end
+
       def update(revision, to, lock)
         tmpdir = temp_dir_name
         begin
-          logger.info {&quot;Checking out the repository at #{to.revision}&quot;}
-          to.checkout_to(tmpdir)
+          logger.debug {&quot;Checking out the repository at #{to.revision}&quot;}
+          to.checkout_to(tmpdir) # is needed to remember new remote revision
         ensure
           logger.debug {&quot;Removing temporary directory: #{tmpdir}&quot;}
           tmpdir.rmtree rescue nil
@@ -100,13 +119,23 @@ module Piston
       def locally_modified
         Dir.chdir(path) do
           # get latest commit for .piston.yml
-          data = git(:log, '-n', '1', yaml_path.relative_path_from(path))
-          initial_revision = data.match(/commit\s+(.*)$/)[1]
+          initial_revision = last_changed_revision(yaml_path)
           # get latest revisions for this working copy since last update
           log = git(:log, '-n', '1', &quot;#{initial_revision}..&quot;)
           not log.empty?
         end
       end
+
+      protected
+      def current_revision
+        Dir.chdir(path) { git(:branch).match(/^\*\s+(.+)$/)[1] }
+      end
+
+      def last_changed_revision(path)
+        path = Pathname.new(path) unless path.is_a? Pathname
+        path = path.relative_path_from(self.path) unless path.relative?
+        Dir.chdir(self.path) { git(:log, '-n', '1', path).match(/commit\s+(.*)$/)[1] }
+      end
     end
   end
 end</diff>
      <filename>lib/piston/git/working_copy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,7 @@ module Piston
 
     # Update a copy of this repository to revision +to+.
     def update_to(to, lock)
+      raise SubclassResponsibilityError, &quot;Piston::Revision#update_to should be implemented by a subclass.&quot;
     end
 
     # What values does this revision want to remember for the future ?</diff>
      <filename>lib/piston/revision.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,7 +37,7 @@ module Piston
       def update_to(revision)
         raise ArgumentError, &quot;Revision #{self.revision} of #{repository.url} was never checked out -- can't update&quot; unless @dir
         
-        answer = svn(:update, &quot;--revision&quot;, revision, @dir)
+        answer = svn(:update, &quot;--non-interactive&quot;, &quot;--revision&quot;, revision, @dir)
         if answer =~ /(Updated to|At) revision (\d+)[.]/ then
           if revision == &quot;HEAD&quot; then
             @revision = $1.to_i</diff>
      <filename>lib/piston/svn/revision.rb</filename>
    </modified>
    <modified>
      <diff>@@ -85,6 +85,16 @@ module Piston
         end
       end
 
+      def downgrade_to(revision)
+        logger.debug {&quot;Downgrading to revision when last update was made&quot;}
+        svn(:update, '--revision', revision, path)
+      end
+
+      def merge_local_changes(revision)
+        logger.debug {&quot;Update to #{revision} in order to merge local changes&quot;}
+        svn(:update, &quot;--non-interactive&quot;, path)
+      end
+
       # Returns all defined externals (recursively) of this WC.
       # Returns a Hash:
       #   {&quot;vendor/rails&quot; =&gt; {:revision =&gt; :head, :url =&gt; &quot;http://dev.rubyonrails.org/svn/rails/trunk&quot;},
@@ -119,9 +129,7 @@ module Piston
 
       def locally_modified
         # get latest revision for .piston.yml
-        data = svn(:info, yaml_path)
-        info = YAML.load(data)
-        initial_revision = info[&quot;Last Changed Rev&quot;].to_i
+        initial_revision = last_changed_revision(yaml_path)
         # get latest revisions for this working copy since last update
         log = svn(:log, '--revision', &quot;#{initial_revision}:HEAD&quot;, '--quiet', '--limit', '2', path)
         log.count(&quot;\n&quot;) &gt; 3
@@ -137,6 +145,17 @@ module Piston
         end
         remember({:repository_url =&gt; props[Piston::Svn::ROOT], :lock =&gt; props[Piston::Svn::LOCKED], :repository_class =&gt; Piston::Svn::Repository.name}, {Piston::Svn::REMOTE_REV =&gt; props[Piston::Svn::REMOTE_REV], Piston::Svn::UUID =&gt; props[Piston::Svn::UUID]})
       end
+
+      protected
+      def current_revision
+        data = svn(:info, path)
+        YAML.load(data)[&quot;Revision&quot;].to_i
+      end
+
+      def last_changed_revision(path)
+        data = svn(:info, yaml_path)
+        YAML.load(data)[&quot;Last Changed Rev&quot;].to_i
+      end
     end
   end
 end</diff>
      <filename>lib/piston/svn/working_copy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,14 +114,27 @@ module Piston
 
     # add some files to working copy
     def add(added)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
     end
 
     # delete some files from working copy
     def delete(deleted)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
     end
 
     # rename some files in working copy
     def rename(renamed)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
+    end
+
+    # Downgrade this working copy to +revision+.
+    def downgrade_to(revision)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
+    end
+
+    # Merge remote changes with local changes in +revision+.
+    def merge_local_changes(revision)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
     end
 
     # Stores a Hash of values that can be retrieved later.
@@ -197,18 +210,31 @@ module Piston
         logger.info {&quot;Checking out the repository at #{revision.revision}&quot;}
         revision.checkout_to(tmpdir)
 
-        logger.info {&quot;Copying local changes to temporary directory&quot;}
+        revision_to_return = current_revision
+        revision_to_downgrade = last_changed_revision(yaml_path)
+        logger.debug {&quot;Downgrading to #{revision_to_downgrade}&quot;}
+        downgrade_to(revision_to_downgrade)
+
+        logger.debug {&quot;Copying old changes to temporary directory in order to keep them&quot;}
         copy_to(revision)
 
-        logger.info {&quot;Updating to #{to.revision}&quot;}
+        logger.info {&quot;Looking changes from #{revision.revision} to #{to.revision}&quot;}
         added, deleted, renamed = revision.update_to(to.revision)
 
+        logger.info {&quot;Updating working copy&quot;}
+        logger.debug {&quot;Renaming files&quot;}
+        # rename before copy because copy_from will copy these files
+        rename(renamed)
         logger.debug {&quot;Copying files from temporary directory&quot;}
-        rename(renamed) # rename before copy because copy_from will copy these files
         copy_from(revision)
+        logger.debug {&quot;Adding new files to version control&quot;}
         add(added)
+        logger.debug {&quot;Deleting files from version control&quot;}
         delete(deleted)
-        
+        logger.debug {&quot;Merging local changes&quot;}
+        # merge local changes updating to revision before downgrade was made
+        merge_local_changes(revision_to_return)
+
         remember(recall.merge(:lock =&gt; lock), to.remember_values)
       ensure
         logger.debug {&quot;Removing temporary directory: #{tmpdir}&quot;}
@@ -233,5 +259,15 @@ module Piston
     def yaml_path
       path + &quot;.piston.yml&quot;
     end
+
+    # The current revision of this working copy.
+    def current_revision
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
+    end
+
+    # The last revision which +path+ was changed in
+    def last_changed_revision(path)
+      raise SubclassResponsibilityError, &quot;Piston::WorkingCopy#locally_modified should be implemented by a subclass.&quot;
+    end
   end
 end</diff>
      <filename>lib/piston/working_copy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,6 +19,7 @@ class TestGitGit &lt; Piston::TestCase
       File.open(&quot;file_in_first_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_first_commit&quot;}
       File.open(&quot;file_to_rename&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_rename&quot;}
       File.open(&quot;file_to_copy&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_copy&quot;}
+      File.open(&quot;conflicting_file&quot;, &quot;wb&quot;) {|f| f.write &quot;conflicting_file\n&quot;}
       git(:add, &quot;.&quot;)
       git(:commit, &quot;-m&quot;, &quot;'first commit'&quot;)
     end
@@ -61,18 +62,22 @@ class TestGitGit &lt; Piston::TestCase
 #\tnew file:   vendor/parent/file_in_first_commit
 #\tnew file:   vendor/parent/file_to_rename
 #\tnew file:   vendor/parent/file_to_copy
+#\tnew file:   vendor/parent/conflicting_file
 #
 )
 
   def test_update
     Dir.chdir(wc_path) do
       piston(:import, parent_path, &quot;vendor/parent&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'import'&quot;)
     end
-    # change mode to &quot;ab&quot; to get a conflict when it's implemented
+
     File.open(wc_path + &quot;vendor/parent/README&quot;, &quot;wb&quot;) do |f|
       f.write &quot;Readme - modified after imported\nReadme - first commit\n&quot;
     end
-
+    File.open(wc_path + &quot;vendor/parent/conflicting_file&quot;, &quot;ab&quot;) do |f|
+      f.write &quot;working copy\n&quot;
+    end
     Dir.chdir(wc_path) do
       git(:add, &quot;.&quot;)
       git(:commit, &quot;-m&quot;, &quot;'next commit'&quot;)
@@ -80,6 +85,7 @@ class TestGitGit &lt; Piston::TestCase
 
     Dir.chdir(parent_path) do
       File.open(&quot;README&quot;, &quot;ab&quot;) {|f| f.write &quot;Readme - second commit\n&quot;}
+      File.open(&quot;conflicting_file&quot;, &quot;ab&quot;) {|f| f.write &quot;parent repository\n&quot;}
       git(:rm, &quot;file_in_first_commit&quot;)
       File.open(&quot;file_in_second_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_second_commit&quot;}
       FileUtils.cp(&quot;file_to_copy&quot;, &quot;copied_file&quot;)
@@ -93,25 +99,112 @@ class TestGitGit &lt; Piston::TestCase
     end
 
     Dir.chdir(wc_path) do
-      assert_equal CHANGE_STATUS.split(&quot;\n&quot;).sort, git(:status).split(&quot;\n&quot;).sort
+      assert_equal CHANGE_STATUS.split(&quot;\n&quot;), git(:status).split(&quot;\n&quot;)
     end
-    assert_equal README, File.readlines(wc_path + &quot;vendor/parent/README&quot;).join
+    assert_equal README, File.read(wc_path + &quot;vendor/parent/README&quot;)
+    assert_match CONFLICT, File.read(wc_path + &quot;vendor/parent/conflicting_file&quot;)
   end
 
-  CHANGE_STATUS = %Q(# On branch master
+  CHANGE_STATUS = %Q(vendor/parent/conflicting_file: needs merge
+# On branch master
 # Changes to be committed:
 #   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)
 #
 #\tmodified:   vendor/parent/.piston.yml
 #\tmodified:   vendor/parent/README
+#\tnew file:   vendor/parent/copied_file
 #\tdeleted:    vendor/parent/file_in_first_commit
 #\tnew file:   vendor/parent/file_in_second_commit
-#\tnew file:   vendor/parent/copied_file
 #\trenamed:    vendor/parent/file_to_rename -&gt; vendor/parent/renamed_file
 #
+# Changed but not updated:
+#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)
+#
+#\tunmerged:   vendor/parent/conflicting_file
+#\tmodified:   vendor/parent/conflicting_file
+#
 )
   README = %Q(Readme - modified after imported
 Readme - first commit
 Readme - second commit
 )
+  CONFLICT = /conflicting_file
+&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD:#{Regexp.quote('vendor/parent/conflicting_file')}
+working copy
+=======
+parent repository
+&gt;&gt;&gt;&gt;&gt;&gt;&gt; my-[0-9a-f]{40}:#{Regexp.quote('vendor/parent/conflicting_file')}
+/
+
+  def test_double_update
+    Dir.chdir(wc_path) do
+      piston(:import, parent_path, &quot;vendor/parent&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'import'&quot;)
+    end
+
+    File.open(wc_path + &quot;vendor/parent/conflicting_file&quot;, &quot;wb&quot;) do |f|
+      f.write &quot;modified after imported\n&quot;
+    end
+    Dir.chdir(wc_path) do
+      git(:add, &quot;.&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'next commit'&quot;)
+    end
+
+    Dir.chdir(parent_path) do
+      File.open(&quot;file_in_first_commit&quot;, &quot;ab&quot;) {|f| f.write &quot;\nmodified in parent repository\n&quot;}
+      git(:add, &quot;.&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'second commit'&quot;)
+    end
+
+    Dir.chdir(wc_path) do
+      piston(:update, &quot;vendor/parent&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'updated'&quot;)
+    end
+
+    Dir.chdir(parent_path) do
+      File.open(&quot;conflicting_file&quot;, &quot;ab&quot;) {|f| f.write &quot;modified in parent repository\n&quot;}
+      git(:add, &quot;.&quot;)
+      git(:commit, &quot;-m&quot;, &quot;'third commit'&quot;)
+    end
+    Dir.chdir(wc_path) do
+      piston(:update, &quot;vendor/parent&quot;)
+    end
+
+    Dir.chdir(wc_path) do
+      # It isn't implemented, unmerge status should be copied from temp dir to working copy
+      #assert_equal DOUBLE_CHANGE_STATUS.split(&quot;\n&quot;), git(:status).split(&quot;\n&quot;)
+      # Use this assert so test doesn't fail while port conflicts is not implemented
+      assert_equal DOUBLE_CHANGE_STATUS_NO_UNMERGED.split(&quot;\n&quot;), git(:status).split(&quot;\n&quot;)
+    end
+    assert_equal DOUBLE_CONFLICT, File.read(wc_path + &quot;vendor/parent/conflicting_file&quot;)
+  end
+  DOUBLE_CHANGE_STATUS = %Q(vendor/parent/conflicting_file: needs merge
+# On branch master
+# Changes to be committed:
+#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)
+#
+#\tmodified:   vendor/parent/.piston.yml
+#
+# Changed but not updated:
+#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)
+#
+#\tunmerged:   vendor/parent/conflicting_file
+#\tmodified:   vendor/parent/conflicting_file
+#
+)
+  DOUBLE_CHANGE_STATUS_NO_UNMERGED = %Q(# On branch master
+# Changes to be committed:
+#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)
+#
+#\tmodified:   vendor/parent/.piston.yml
+#\tmodified:   vendor/parent/conflicting_file
+#
+)
+  DOUBLE_CONFLICT = %Q(&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD:conflicting_file
+modified after imported
+=======
+conflicting_file
+modified in parent repository
+&gt;&gt;&gt;&gt;&gt;&gt;&gt; master:conflicting_file
+)
 end</diff>
      <filename>test/integration/test_git_git.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,10 +17,11 @@ class TestGitSvn &lt; Piston::TestCase
 
     Dir.chdir(parent_path) do
       git(:init)
-      File.open(parent_path + &quot;README&quot;, &quot;wb&quot;) {|f| f.write &quot;Readme - first commit\n&quot;}
-      File.open(parent_path + &quot;file_in_first_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_first_commit&quot;}
+      File.open(&quot;README&quot;, &quot;wb&quot;) {|f| f.write &quot;Readme - first commit\n&quot;}
+      File.open(&quot;file_in_first_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_first_commit&quot;}
       File.open(&quot;file_to_rename&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_rename&quot;}
       File.open(&quot;file_to_copy&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_copy&quot;}
+      File.open(&quot;conflicting_file&quot;, &quot;wb&quot;) {|f| f.write &quot;conflicting_file\n&quot;}
       git(:add, &quot;.&quot;)
       git(:commit, &quot;-m&quot;, &quot;'first commit'&quot;)
     end
@@ -96,21 +97,25 @@ A      vendor/parent/README
 A      vendor/parent/file_in_first_commit
 A      vendor/parent/file_to_rename
 A      vendor/parent/file_to_copy
+A      vendor/parent/conflicting_file
 )
 
   def test_update
     piston(:import, parent_path, wc_path + &quot;trunk/vendor/parent&quot;)
+    svn(:commit, &quot;-m&quot;, &quot;'import'&quot;, wc_path)
+
     # change mode to &quot;ab&quot; to get a conflict when it's implemented
     File.open(wc_path + &quot;trunk/vendor/parent/README&quot;, &quot;wb&quot;) do |f|
       f.write &quot;Readme - modified after imported\nReadme - first commit\n&quot;
     end
-
-    Dir.chdir(wc_path) do
-      svn(:commit, &quot;-m&quot;, &quot;'next commit'&quot;)
+    File.open(wc_path + &quot;trunk/vendor/parent/conflicting_file&quot;, &quot;ab&quot;) do |f|
+      f.write &quot;working copy\n&quot;
     end
+    svn(:commit, &quot;-m&quot;, &quot;'next commit'&quot;, wc_path)
 
     Dir.chdir(parent_path) do
       File.open(&quot;README&quot;, &quot;ab&quot;) {|f| f.write &quot;Readme - second commit\n&quot;}
+      File.open(&quot;conflicting_file&quot;, &quot;ab&quot;) {|f| f.write &quot;parent repository\n&quot;}
       git(:rm, &quot;file_in_first_commit&quot;)
       File.open(&quot;file_in_second_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_second_commit&quot;}
       FileUtils.cp(&quot;file_to_copy&quot;, &quot;copied_file&quot;)
@@ -119,10 +124,11 @@ A      vendor/parent/file_to_copy
       git(:commit, &quot;-m&quot;, &quot;'second commit'&quot;)
     end
 
-    piston(:update, wc_path + &quot;trunk/vendor/parent&quot;, '-v', '2')
+    piston(:update, wc_path + &quot;trunk/vendor/parent&quot;)
     
     assert_equal CHANGE_STATUS.split(&quot;\n&quot;).sort, svn(:status, wc_path + &quot;trunk/vendor&quot;).gsub((wc_path + &quot;trunk/&quot;).to_s, &quot;&quot;).split(&quot;\n&quot;).sort
-    assert_equal README, File.readlines(wc_path + &quot;trunk/vendor/parent/README&quot;).join
+    assert_equal README, File.read(wc_path + &quot;trunk/vendor/parent/README&quot;)
+    assert_equal CONFLICT, File.read(wc_path + &quot;trunk/vendor/parent/conflicting_file&quot;)
   end
 
   CHANGE_STATUS = %Q(M      vendor/parent/.piston.yml
@@ -132,9 +138,20 @@ D      vendor/parent/file_in_first_commit
 A      vendor/parent/copied_file
 D      vendor/parent/file_to_rename
 A  +   vendor/parent/renamed_file
+C      vendor/parent/conflicting_file
+?      vendor/parent/conflicting_file.mine
+?      vendor/parent/conflicting_file.r2
+?      vendor/parent/conflicting_file.r3
 )
   README = %Q(Readme - modified after imported
 Readme - first commit
 Readme - second commit
 )
+  CONFLICT = %Q(conflicting_file
+&lt;&lt;&lt;&lt;&lt;&lt;&lt; .mine
+parent repository
+=======
+working copy
+&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r3
+)
 end</diff>
      <filename>test/integration/test_git_svn.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,7 @@ class TestSvnSvn &lt; Piston::TestCase
       File.open(&quot;parent/file_in_first_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_first_commit&quot;}
       File.open(&quot;parent/file_to_rename&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_rename&quot;}
       File.open(&quot;parent/file_to_copy&quot;, &quot;wb&quot;) {|f| f.write &quot;file_to_copy&quot;}
+      File.open(&quot;parent/conflicting_file&quot;, &quot;wb&quot;) {|f| f.write &quot;conflicting_file\n&quot;}
       svn :add, &quot;parent/*&quot;
     end
     svn :commit, wc_path, &quot;--message&quot;, &quot;'first commit'&quot;
@@ -52,15 +53,19 @@ A      vendor/ssl_requirement/README
     Dir.chdir(wc_path) do
       piston(:import, &quot;file://#{repos_path}/parent&quot;, &quot;trunk/vendor/parent&quot;)
     end
-    # change mode to &quot;ab&quot; to get a conflict when it's implemented
+    svn(:commit, &quot;-m&quot;, &quot;'import'&quot;, wc_path)
+
     File.open(wc_path + &quot;trunk/vendor/parent/README&quot;, &quot;wb&quot;) do |f|
       f.write &quot;Readme - modified after imported\nReadme - first commit\n&quot;
     end
-
+    File.open(wc_path + &quot;trunk/vendor/parent/conflicting_file&quot;, &quot;ab&quot;) do |f|
+      f.write &quot;working copy\n&quot;
+    end
     svn(:commit, wc_path, &quot;-m&quot;, &quot;'next commit'&quot;)
 
     Dir.chdir(parent_path) do
       File.open(&quot;README&quot;, &quot;ab&quot;) {|f| f.write &quot;Readme - second commit\n&quot;}
+      File.open(&quot;conflicting_file&quot;, &quot;ab&quot;) {|f| f.write &quot;parent repository\n&quot;}
       svn(:rm, &quot;file_in_first_commit&quot;)
       File.open(&quot;file_in_second_commit&quot;, &quot;wb&quot;) {|f| f.write &quot;file_in_second_commit&quot;}
       svn(:add, &quot;file_in_second_commit&quot;)
@@ -76,7 +81,8 @@ A      vendor/ssl_requirement/README
     Dir.chdir(wc_path) do
       assert_equal CHANGE_STATUS.split(&quot;\n&quot;).sort, svn(:status).gsub(&quot;trunk/&quot;, &quot;&quot;).split(&quot;\n&quot;).sort
     end
-    assert_equal README, File.readlines(wc_path + &quot;trunk/vendor/parent/README&quot;).join
+    assert_equal README, File.read(wc_path + &quot;trunk/vendor/parent/README&quot;)
+    assert_equal CONFLICT, File.read(wc_path + &quot;trunk/vendor/parent/conflicting_file&quot;)
   end
 
   CHANGE_STATUS = %Q(M      vendor/parent/.piston.yml
@@ -86,9 +92,20 @@ A      vendor/parent/file_in_second_commit
 A      vendor/parent/copied_file
 D      vendor/parent/file_to_rename
 A      vendor/parent/renamed_file
+C      vendor/parent/conflicting_file
+?      vendor/parent/conflicting_file.mine
+?      vendor/parent/conflicting_file.r2
+?      vendor/parent/conflicting_file.r4
 )
   README = %Q(Readme - modified after imported
 Readme - first commit
 Readme - second commit
 )
+  CONFLICT = %Q(conflicting_file
+&lt;&lt;&lt;&lt;&lt;&lt;&lt; .mine
+parent repository
+=======
+working copy
+&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r4
+)
 end</diff>
      <filename>test/integration/test_svn_svn.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6bfbf69b06df390e5cee49d39abfa91f2783184d</id>
    </parent>
  </parents>
  <author>
    <name>Sergio Cambra</name>
    <email>sergio@entrecables.com</email>
  </author>
  <url>http://github.com/francois/piston/commit/d7e8ccc2b06f3cb53fb72991ee7522980dd35100</url>
  <id>d7e8ccc2b06f3cb53fb72991ee7522980dd35100</id>
  <committed-date>2008-10-15T10:10:30-07:00</committed-date>
  <authored-date>2008-10-10T13:16:32-07:00</authored-date>
  <message>Use a different strategy to update so we get handling conflicts
Test handles conflicts</message>
  <tree>9f5a0d03085abccbc6dd137abcf19472f81cc63b</tree>
  <committer>
    <name>Fran&#231;ois Beausoleil</name>
    <email>francois@teksol.info</email>
  </committer>
</commit>
