Project

General

Profile

Defect #14361 » redmine_hg_long_ids_tests.diff

Claudio Bley, 2014-01-31 16:33

View differences:

redmine-2.4.2/lib/redmine/scm/adapters/mercurial_adapter.rb 2014-01-31 16:20:28.753985366 +0100
219 219
            end.sort { |a, b| a[:path] <=> b[:path] }
220 220
            parents_ary = []
221 221
            as_ary(le['parents']['parent']).map do |par|
222
              parents_ary << par['__content__'] if par['__content__'] != "000000000000"
222
              parents_ary << par['__content__'] if par['__content__'] != "0000000000000000000000000000000000000000"
223 223
            end
224 224
            yield Revision.new(:revision => le['revision'],
225 225
                               :scmid    => le['node'],
redmine-2.4.2/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb 2014-01-31 16:23:21.994340715 +0100
90 90
          repo_path =  adp.info.root_url.gsub(/\\/, "/")
91 91
          assert_equal REPOSITORY_PATH, repo_path
92 92
          assert_equal '31', adp.info.lastrev.revision
93
          assert_equal '31eeee7395c8',adp.info.lastrev.scmid
93
          assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355',adp.info.lastrev.scmid
94 94
        end
95 95
      end
96 96

  
......
98 98
        revisions = @adapter.revisions(nil, 2, 4)
99 99
        assert_equal 3, revisions.size
100 100
        assert_equal '2', revisions[0].revision
101
        assert_equal '400bb8672109', revisions[0].scmid
101
        assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
102 102
        assert_equal '4', revisions[2].revision
103
        assert_equal 'def6d2f1254a', revisions[2].scmid
103
        assert_equal 'def6d2f1254a56fb8fbe9ec3b5c0451674dbd8b8', revisions[2].scmid
104 104

  
105 105
        revisions = @adapter.revisions(nil, 2, 4, {:limit => 2})
106 106
        assert_equal 2, revisions.size
107 107
        assert_equal '2', revisions[0].revision
108
        assert_equal '400bb8672109', revisions[0].scmid
108
        assert_equal '400bb86721098697c7d17b3724c794c57636de70', revisions[0].scmid
109 109
      end
110 110

  
111 111
      def test_parents
......
115 115
        revs2 = @adapter.revisions(nil, 1, 1)
116 116
        assert_equal 1, revs2.size
117 117
        assert_equal 1, revs2[0].parents.size
118
        assert_equal "0885933ad4f6", revs2[0].parents[0]
118
        assert_equal "0885933ad4f68d77c2649cd11f8311276e7ef7ce", revs2[0].parents[0]
119 119
        revs3 = @adapter.revisions(nil, 30, 30)
120 120
        assert_equal 1, revs3.size
121 121
        assert_equal 2, revs3[0].parents.size
122
        assert_equal "a94b0528f24f", revs3[0].parents[0]
123
        assert_equal "3a330eb32958", revs3[0].parents[1]
122
        assert_equal "a94b0528f24fe05ebaef496ae0500bb050772e36", revs3[0].parents[0]
123
        assert_equal "3a330eb329586ea2adb3f83237c23310e744ebe9", revs3[0].parents[1]
124 124
      end
125 125

  
126 126
      def test_diff
......
213 213
          assert_equal 'file', readme.kind
214 214
          assert_equal 27, readme.size
215 215
          assert_equal '1', readme.lastrev.revision
216
          assert_equal '9d5b5b004199', readme.lastrev.identifier
216
          assert_equal '9d5b5b00419901478496242e0768deba1ce8c51e', readme.lastrev.identifier
217 217
          # 2007-12-14 10:24:01 +0100
218 218
          assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time
219 219

  
......
242 242
        assert_equal 'file', readme.kind
243 243
        assert_equal 21, readme.size
244 244
        assert_equal '0', readme.lastrev.revision
245
        assert_equal '0885933ad4f6', readme.lastrev.identifier
245
        assert_equal '0885933ad4f68d77c2649cd11f8311276e7ef7ce', readme.lastrev.identifier
246 246
        # 2007-12-14 10:22:52 +0100
247 247
        assert_equal Time.gm(2007, 12, 14, 9, 22, 52), readme.lastrev.time
248 248
      end
......
260 260
        assert_equal 'file', readme.kind
261 261
        assert_equal 365, readme.size
262 262
        assert_equal '8', readme.lastrev.revision
263
        assert_equal 'c51f5bb613cd', readme.lastrev.identifier
263
        assert_equal 'c51f5bb613cd60793c2a9fe9df29332e74bb949f', readme.lastrev.identifier
264 264
        # 2001-02-01 00:00:00 -0900
265 265
        assert_equal Time.gm(2001, 2, 1, 9, 0, 0), readme.lastrev.time
266 266
      end
......
288 288

  
289 289
      def test_tagmap
290 290
        tm = {
291
          @tag_char_1         => 'adf805632193',
292
          'tag_test.00'       => '6987191f453a',
293
          'tag-init-revision' => '0885933ad4f6',
291
          @tag_char_1         => 'adf805632193500ad3b615cd04f58f9b0769f576',
292
          'tag_test.00'       => '6987191f453a5f6557018d522feea2c450d5588d',
293
          'tag-init-revision' => '0885933ad4f68d77c2649cd11f8311276e7ef7ce',
294 294
          }
295 295
        assert_equal tm, @adapter.tagmap
296 296
      end
......
303 303
        assert_equal 7, brs.length
304 304
        assert_equal 'default', brs[0].to_s
305 305
        assert_equal '31', brs[0].revision
306
        assert_equal '31eeee7395c8', brs[0].scmid
306
        assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355', brs[0].scmid
307 307
        assert_equal 'test-branch-01', brs[1].to_s
308 308
        assert_equal '30', brs[1].revision
309
        assert_equal 'ad4dc4f80284', brs[1].scmid
309
        assert_equal 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7', brs[1].scmid
310 310
        assert_equal @branch_char_1, brs[2].to_s
311 311
        assert_equal '27', brs[2].revision
312
        assert_equal '7bbf4c738e71', brs[2].scmid
312
        assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', brs[2].scmid
313 313
        assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s
314 314
        assert_equal '25', brs[3].revision
315
        assert_equal 'afc61e85bde7', brs[3].scmid
315
        assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', brs[3].scmid
316 316
        assert_equal @branch_char_0, brs[4].to_s
317 317
        assert_equal '23', brs[4].revision
318
        assert_equal 'c8d3e4887474', brs[4].scmid
318
        assert_equal 'c8d3e4887474af6a589190140508037ebaa9d9c3', brs[4].scmid
319 319
        assert_equal 'test_branch.latin-1', brs[5].to_s
320 320
        assert_equal '22', brs[5].revision
321
        assert_equal 'c2ffe7da686a', brs[5].scmid
321
        assert_equal 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768', brs[5].scmid
322 322
        assert_equal 'test-branch-00', brs[6].to_s
323 323
        assert_equal '13', brs[6].revision
324
        assert_equal '3a330eb32958', brs[6].scmid
324
        assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', brs[6].scmid
325 325
      end
326 326

  
327 327
      def test_branchmap
328 328
        bm = {
329
           'default'               => '31eeee7395c8',
330
           'test_branch.latin-1'   => 'c2ffe7da686a',
331
           'branch (1)[2]&,%.-3_4' => 'afc61e85bde7',
332
           'test-branch-00'        => '3a330eb32958',
333
           "test-branch-01"        => 'ad4dc4f80284',
334
           @branch_char_0          => 'c8d3e4887474',
335
           @branch_char_1          => '7bbf4c738e71',
329
           'default'               => '31eeee7395c8c78e66dd54c50addd078d10b2355',
330
           'test_branch.latin-1'   => 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768',
331
           'branch (1)[2]&,%.-3_4' => 'afc61e85bde74de930e5846c8451bd55b5bafc9c',
332
           'test-branch-00'        => '3a330eb329586ea2adb3f83237c23310e744ebe9',
333
           "test-branch-01"        => 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7',
334
           @branch_char_0          => 'c8d3e4887474af6a589190140508037ebaa9d9c3',
335
           @branch_char_1          => '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914',
336 336
         }
337 337
        assert_equal bm, @adapter.branchmap
338 338
      end
......
378 378
            when 'branch (1)[2]&,%.-3_4'
379 379
              if @adapter.class.client_version_above?([1, 6])
380 380
                assert_equal 3, nib0.size
381
                assert_equal nib0[0], 'afc61e85bde7'
381
                assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', nib0[0]
382 382
                nib2 = @adapter.nodes_in_branch(bra, :limit => 2)
383 383
                assert_equal 2, nib2.size
384
                assert_equal nib2[1], '933ca60293d7'
384
                assert_equal '933ca60293d78f7c7979dd123cc0c02431683575', nib2[1]
385 385
              end
386 386
            when @branch_char_1
387 387
              if @adapter.class.client_version_above?([1, 6])
388 388
                assert_equal 2, nib0.size
389
                assert_equal nib0[1], '08ff3227303e'
389
                assert_equal '08ff3227303ec0dfcc818efa8e9cc652fe81859f', nib0[1]
390 390
                nib2 = @adapter.nodes_in_branch(bra, :limit => 1)
391 391
                assert_equal 1, nib2.size
392
                assert_equal nib2[0], '7bbf4c738e71'
392
                assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', nib2[0]
393 393
              end
394 394
          end
395 395
        end
redmine-2.4.2/test/unit/repository_mercurial_test.rb 2014-01-31 16:24:17.537019611 +0100
225 225
      assert_equal 'A', c1[0].action
226 226
      assert_equal '/sql_escape/percent%dir/percentfile1.txt',  c1[0].path
227 227
      assert_equal '/sql_escape/percent%dir/percent%file1.txt', c1[0].from_path
228
      assert_equal '3a330eb32958', c1[0].from_revision
228
      assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', c1[0].from_revision
229 229

  
230 230
      assert_equal 'A', c1[1].action
231 231
      assert_equal '/sql_escape/underscore_dir/understrike-file.txt', c1[1].path
......
238 238
      assert_equal 'A', c2[0].action
239 239
      assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
240 240
      assert_equal '/README', c2[0].from_path
241
      assert_equal '933ca60293d7', c2[0].from_revision
241
      assert_equal '933ca60293d78f7c7979dd123cc0c02431683575', c2[0].from_revision
242 242

  
243 243
      cs3 = @repository.changesets.find_by_revision('19')
244 244
      c3  = cs3.filechanges
......
246 246
      assert_equal 'A', c3[0].action
247 247
      assert_equal "/latin-1-dir/test-#{@char_1}-1.txt",  c3[0].path
248 248
      assert_equal "/latin-1-dir/test-#{@char_1}.txt",    c3[0].from_path
249
      assert_equal '5d9891a1b425', c3[0].from_revision
249
      assert_equal '5d9891a1b4258ea256552aa856e388f2da28256a', c3[0].from_revision
250 250
    end
251 251

  
252 252
    def test_find_changeset_by_name
......
304 304
      assert_equal [], r1.parents
305 305
      r2 = @repository.changesets.find_by_revision('1')
306 306
      assert_equal 1, r2.parents.length
307
      assert_equal "0885933ad4f6",
307
      assert_equal "0885933ad4f68d77c2649cd11f8311276e7ef7ce",
308 308
                   r2.parents[0].identifier
309 309
      r3 = @repository.changesets.find_by_revision('30')
310 310
      assert_equal 2, r3.parents.length
311 311
      r4 = [r3.parents[0].identifier, r3.parents[1].identifier].sort
312
      assert_equal "3a330eb32958", r4[0]
313
      assert_equal "a94b0528f24f", r4[1]
312
      assert_equal "3a330eb329586ea2adb3f83237c23310e744ebe9", r4[0]
313
      assert_equal "a94b0528f24fe05ebaef496ae0500bb050772e36", r4[1]
314 314
    end
315 315

  
316 316
    def test_activities
(3-3/3)