1. Alessio Caiazza
  2. redmine-mq-issue4455

Commits

Yuya Nishihara  committed 62de627

fix timezone issue, Time.at() is counted from epoch in UTC (refs #3)

  • Participants
  • Parent commits 2333603
  • Branches default

Comments (0)

Files changed (3)

File hg/annotate-test.diff

View file
  • Ignore whitespace
+# HG changeset patch
+# Parent c0ee69151d7d16c79657cff9a5733735ee617e4e
+# User Toshi MARUYAMA <marutosijp2@gmail.com>
+diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
+--- a/test/functional/repositories_mercurial_controller_test.rb
++++ b/test/functional/repositories_mercurial_controller_test.rb
+@@ -125,12 +125,33 @@
+       get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb']
+       assert_response :success
+       assert_template 'annotate'
+-      # Line 23, revision 4
+-      assert_tag :tag => 'th', :content => /23/,
+-                 :sibling => { :tag => 'td', :child => { :tag => 'a', :content => /4/ } },
+-                 :sibling => { :tag => 'td', :content => /jsmith/ },
++      # Line 23, revision 4:def6d2f1254a
++      assert_tag :tag => 'th',
++                 :content => '23',
++                 :attributes => { :class => 'line-num' },
++                 :sibling =>
++                       {
++                         :tag => 'td',
++                         :attributes => { :class => 'revision' },
++                         :child => { :tag => 'a', :content => '4' }
++                         # :child => { :tag => 'a', :content => /4:def6d2f1/ }
++                       }
++      assert_tag :tag => 'th',
++                 :content => '23',
++                 :attributes => { :class => 'line-num' },
++                 :sibling =>
++                       {
++                          :tag     => 'td'    ,
++                          :content => 'jsmith' ,
++                          :attributes => { :class   => 'author' },
++                          
++                        }
++      assert_tag :tag => 'th',
++                 :content => '23',
++                 :attributes => { :class => 'line-num' },
+                  :sibling => { :tag => 'td', :content => /watcher =/ }
+     end
++
+   else
+     puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!"
+     def test_fake; assert true end

File hgext/helper-fix-entries-commit-date.diff

View file
  • Ignore whitespace
+# HG changeset patch
+# Parent 61817fe3ab02ee335a48b850a447abcf63f2a295
+# User Toshi MARUYAMA <marutosijp2@gmail.com>
+imported patch for-yuya/for-yuya.diff
+
+diff --git a/extra/mercurial/redminehelper.py b/extra/mercurial/redminehelper.py
+--- a/extra/mercurial/redminehelper.py
++++ b/extra/mercurial/redminehelper.py
+@@ -8,6 +8,11 @@
+ # This software may be used and distributed according to the terms of the
+ # GNU General Public License version 2 or any later version.
+ 
++# This is Mercurial extension for Redmine Mercurial adapter.
++# http://mercurial.selenic.com/wiki/WritingExtensions
++# You can run with following command.
++# $ hg --config extensions.redminehelper=redminehelper.py rhsummary
++
+ '''command to list revision of each file
+ '''
+ 
+@@ -68,8 +73,8 @@
+                 fctx = repo.filectx(f, fileid=mf[f])
+                 ctx = fctx.changectx()
+                 tm, tzoffset = ctx.date()
+-                localtime = int(tm) + tzoffset - time.timezone
+-                files[name] = (ctx.rev(), node.short(ctx.node()), localtime,
++                utctime = int(tm)
++                files[name] = (ctx.rev(), node.short(ctx.node()), utctime,
+                                fctx.size(), name)
+             except LookupError:  # TODO: when this occurs?
+                 pass
+diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb
+--- a/test/unit/repository_mercurial_test.rb
++++ b/test/unit/repository_mercurial_test.rb
+@@ -59,6 +59,17 @@
+       assert_equal 2, @repository.entries("sources", '400bb8672109').size
+       assert_equal 1, @repository.entries("sources", 3).size
+       assert_equal 1, @repository.entries("sources", 'b3a615152df8').size
++
++      # TODO file size
++      ent_src_rev2 = @repository.entries("sources", 2)
++      assert_equal ent_src_rev2[0].name, "watchers_controller.rb"
++       # 2007-12-14 10:25:20 +0100
++      assert_equal ent_src_rev2[0].lastrev.time, Time.gm(2007, 12, 14, 9, 25, 20)
++
++      ent_root_rev5 = @repository.entries("", 5)
++      assert_equal 3, ent_root_rev5.size
++      assert_equal ent_root_rev5[2].name, "README"
++      assert_equal ent_root_rev5[2].lastrev.time, Time.gm(1970, 1, 1, 0, 0, 0)
+     end
+ 
+     def test_locate_on_outdated_repository

File series

View file
  • Ignore whitespace
 fetch-changesets-catch-command-failed.diff
 hgext/helper-by-ale.diff
 hgext/helper-by-me.diff
+hgext/helper-fix-entries-commit-date.diff
 hg/cmd.diff
 hg/diff.diff
 hg/annotate.diff
+hg/annotate-test.diff
 hg/revisions.diff
 hg/summary.diff
 hg/fetch-changesets.diff