]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: change two revision diff text of mercurial (#3724).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 11 Jan 2011 16:04:28 +0000 (16:04 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 11 Jan 2011 16:04:28 +0000 (16:04 +0000)
For example, "4:def6d2f1254a 2:400bb8672109".

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4699 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/mercurial.rb
test/functional/repositories_mercurial_controller_test.rb

index d9d0806d148a4ea252fdce5f1ec4792d058ab6e6..c38236fc8ddb65af68fc9b9150731adffc6d7a18 100644 (file)
@@ -42,6 +42,10 @@ class Repository::Mercurial < Repository
     changeset.scmid
   end
 
+  def diff_format_revisions(cs, cs_to, sep=':')
+    super(cs, cs_to, ' ')
+  end
+
   def entries(path=nil, identifier=nil)
     entries=scm.entries(path, identifier)
     if entries
index 0a9ad377914d572b88beca94ae033755bffdd10b..1afe42571b3fda5f3145993c507f13f56080fecb 100644 (file)
@@ -128,6 +128,9 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
     end
     
     def test_diff
+      @repository.fetch_changesets
+      @repository.reload
+
       [4, '4', 'def6d2f1254a'].each do |r1|
         # Full diff of changeset 4
         get :diff, :id => 3, :rev => 4
@@ -141,6 +144,25 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
                      :sibling => { :tag => 'td', 
                                    :attributes => { :class => /diff_out/ },
                                    :content => /def remove/ }
+          assert_tag :tag => 'h2', :content => /4:def6d2f1254a/
+        end
+      end
+    end
+
+    def test_diff_two_revs
+      @repository.fetch_changesets
+      @repository.reload
+
+      [2, '400bb8672109', '400', 400].each do |r1|
+        [4, 'def6d2f1254a'].each do |r2|
+          get :diff, :id => 3, :rev    => r1,
+                               :rev_to => r2
+          assert_response :success
+          assert_template 'diff'
+
+          diff = assigns(:diff)
+          assert_not_nil diff
+          assert_tag :tag => 'h2', :content => /4:def6d2f1254a 2:400bb8672109/
         end
       end
     end