Indefero

Indefero Commit Details


Date:2011-04-14 17:54:11 (13 years 8 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.2, release-1.3
Commit:df6ffdf42084bdf6fc163cc4fdb14dfa901f8ec7
Parents: b3368071ac07dc321f60cd0cc0c2a34c584a6927
Message:Three more test cases for the mtn interface added

- add tests for getTree(), getChanges() and isCommitLarge()
- anonymize the test data somewhat
- return false instead of null for unknown revisions given to getChanges()
Changes:

File differences

src/IDF/Scm/Monotone.php
599599
600600
601601
602
602
603603
604604
605605
{
$revs = $this->_resolveSelector($commit);
if (count($revs) == 0)
return null;
return false;
$revision = $revs[0];
$out = $this->stdio->exec(array('get_revision', $revision));
test/IDF/Scm/MonotoneTest.php
226226
227227
228228
229
230
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
231352
232353
233354
......
277398
278399
279400
280
401
281402
282403
283404
284405
285406
286
407
287408
288409
289410
290411
291412
292
293
413
294414
295415
296416
......
306426
307427
308428
309
310
311
429
430
431
312432
313433
314434
......
354474
355475
356476
357
477
358478
359479
360480
361481
362482
363
483
364484
365485
366486
......
386506
387507
388508
389
509
390510
391511
392512
......
397517
398518
399519
400
520
401521
402522
403523
404524
405525
406
526
407527
408528
409529
......
427547
428548
429549
430
550
431551
432552
433553
......
457577
458578
459579
460
461
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
462642
463643
464644
......
478658
479659
480660
481
661
482662
483663
484664
485665
486666
487
667
488668
489669
490670
......
526706
527707
528708
529
709
530710
531711
532712
......
548728
549729
550730
551
552
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
553779
554780
555781
public function testGetTree()
{
// test root and sub tree fetching
$this->markTestIncomplete();
$instance = $this->createMock();
//
// non-existing revision
//
$this->assertEquals(array(), $instance->getTree('789'));
$stdio = "7890123456789012345678901234567890123456\n";
$instance->getStdio()->setExpectedOutput(array('select', 't:789'), array(), $stdio);
$stdio =<<<END
dir ""
birth [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
path_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
file "NEWS"
content [bf51bb66d1c1ffde9ed2fffe2e8c00942deeaa03]
size "2104"
birth [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
path_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
content_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
dir "doc"
birth [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
path_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
file "doc/AUTHORS"
content [de9ed2fffe2e8c0094bf51bb66d1c1ff2deeaa03]
size "17024"
birth [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
path_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
content_mark [276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f]
END;
$instance->getStdio()->setExpectedOutput(array('get_extended_manifest_of', '7890123456789012345678901234567890123456'), array(), $stdio);
$stdio =<<<END
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "joe@user.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "some.branch"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "changelog"
value "initial revision"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "date"
value "2011-01-24T00:00:23"
trust "trusted"
END;
$instance->getStdio()->setExpectedOutput(array('certs', '276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f'), array(), $stdio);
//
// root directory
//
$entries = $instance->getTree('t:789');
$this->assertEquals(3, count($entries));
$file = $entries[0];
$this->assertEquals('', $file->fullpath);
$this->assertEquals('', $file->efullpath);
$this->assertEquals('', $file->file);
$this->assertEquals('tree', $file->type);
$this->assertEquals(0, $file->size);
$this->assertEquals('276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f', $file->rev);
$this->assertEquals('joe@user.com', $file->author);
$this->assertEquals('2011-01-24 00:00:23', $file->date);
$this->assertEquals('initial revision', $file->log);
$file = $entries[1];
$this->assertEquals('NEWS', $file->fullpath);
$this->assertEquals('NEWS', $file->efullpath);
$this->assertEquals('NEWS', $file->file);
$this->assertEquals('blob', $file->type);
$this->assertEquals(2104, $file->size);
$this->assertEquals('bf51bb66d1c1ffde9ed2fffe2e8c00942deeaa03', $file->hash);
$this->assertEquals('276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f', $file->rev);
$this->assertEquals('joe@user.com', $file->author);
$this->assertEquals('2011-01-24 00:00:23', $file->date);
$this->assertEquals('initial revision', $file->log);
$file = $entries[2];
$this->assertEquals('doc', $file->fullpath);
$this->assertEquals('doc', $file->efullpath);
$this->assertEquals('doc', $file->file);
$this->assertEquals('tree', $file->type);
$this->assertEquals(0, $file->size);
$this->assertEquals('276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f', $file->rev);
$this->assertEquals('joe@user.com', $file->author);
$this->assertEquals('2011-01-24 00:00:23', $file->date);
$this->assertEquals('initial revision', $file->log);
//
// sub directory
//
$entries = $instance->getTree('t:789', 'doc');
$this->assertEquals(1, count($entries));
$file = $entries[0];
$this->assertEquals('doc/AUTHORS', $file->fullpath);
$this->assertEquals('doc/AUTHORS', $file->efullpath);
$this->assertEquals('AUTHORS', $file->file);
$this->assertEquals('blob', $file->type);
$this->assertEquals(17024, $file->size);
$this->assertEquals('de9ed2fffe2e8c0094bf51bb66d1c1ff2deeaa03', $file->hash);
$this->assertEquals('276264b0b3f1e70fc1835a700e6e61bdbe4c3f2f', $file->rev);
$this->assertEquals('joe@user.com', $file->author);
$this->assertEquals('2011-01-24 00:00:23', $file->date);
$this->assertEquals('initial revision', $file->log);
//
// non-existing sub directory
//
$this->assertEquals(array(), $instance->getTree('t:789', 'foo'));
}
public function testFindAuthor()
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "me@thomaskeller.biz"
value "joe@user.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "net.venge.monotone"
value "main.branch"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "changelog"
value "* po/de.po: German translation updated
"
value "something changed"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
$this->assertEquals(1, count($ret));
$this->assertTrue($ret[0] instanceof stdClass);
$this->assertEquals('me@thomaskeller.biz', $ret[0]->author);
$this->assertEquals('net.venge.monotone', $ret[0]->branch);
$this->assertEquals('* po/de.po: German translation updated', $ret[0]->title);
$this->assertEquals('joe@user.com', $ret[0]->author);
$this->assertEquals('main.branch', $ret[0]->branch);
$this->assertEquals('something changed', $ret[0]->title);
$this->assertEquals('1234567890123456789012345678901234567890', $ret[0]->commit);
$this->assertEquals('2011-03-19 13:59:47', $ret[0]->date);
}
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "me@thomaskeller.biz"
value "joe@user.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "branch"
value "net.venge.monotone.source-tree-cleanup"
value "some.branch"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
$this->assertEquals('blob', $file->type);
$this->assertEquals(17024, $file->size);
$this->assertEquals('fdb579b6682d78fac24912e7a82a8209b9a54099', $file->rev);
$this->assertEquals('me@thomaskeller.biz', $file->author);
$this->assertEquals('joe@user.com', $file->author);
$this->assertEquals('2011-01-24 00:00:23', $file->date);
$this->assertEquals('update the source paths', $file->log);
key [10b5b36b4aadc46c0a946b6e76e087ccdddf8b86]
signature "ok"
name "author"
value "graydon@pobox.com"
value "mary@jane.com"
trust "trusted"
key [10b5b36b4aadc46c0a946b6e76e087ccdddf8b86]
signature "ok"
name "branch"
value "net.venge.monotone.visualc8"
value "feature.branch"
trust "trusted"
key [10b5b36b4aadc46c0a946b6e76e087ccdddf8b86]
$this->assertEquals('tree', $file->type);
$this->assertEquals(0, $file->size);
$this->assertEquals('a10037b1aa8a905018b72e6bd96fb8f8475f0f65', $file->rev);
$this->assertEquals('graydon@pobox.com', $file->author);
$this->assertEquals('mary@jane.com', $file->author);
$this->assertEquals('2006-03-13 08:06:22', $file->date);
$this->assertEquals('initial build working', $file->log);
}
public function testGetChanges()
{
// test retrieving the changes of a specific revision
$this->markTestIncomplete();
$instance = $this->createMock();
$this->assertFalse($instance->getChanges('t:234'));
$stdio = "2345678901234567890123456789012345678901\n";
$instance->getStdio()->setExpectedOutput(array('select', 't:234'), array(), $stdio);
$stdio =<<<END
format_version "1"
new_manifest [cd109f812792d6d3de50b2c6d3ba3dc230a5c309]
old_revision [3996c236cea1cde8e3be0b034b5d26a85378d718]
delete "old_dir"
delete "old_dir/old_file"
rename "dir_with_old_name"
to "new_dir/dir_with_new_name"
add_dir "new_dir"
add_file "new_dir/new_file"
content [da39a3ee5e6b4b0d3255bfef95601890afd80709]
patch "existing_file"
from [da39a3ee5e6b4b0d3255bfef95601890afd80709]
to [d53a205a336e07cf9eac45471b3870f9489288ec]
clear "new_dir/dir_with_new_name"
attr "some-key"
set "existing_file"
attr "multi
line
key"
value "
and another
multiline
value"
END;
$instance->getStdio()->setExpectedOutput(array('get_revision', '2345678901234567890123456789012345678901'), array(), $stdio);
$expected = (object) array(
'additions' => array('new_dir', 'new_dir/new_file'),
'deletions' => array('old_dir', 'old_dir/old_file'),
'renames' => array('dir_with_old_name' => 'new_dir/dir_with_new_name'),
'patches' => array('existing_file'),
'properties' => array(
'new_dir/dir_with_new_name' => array(
'some-key' => null,
),
'existing_file' => array(
"multi\nline\nkey" => "\nand another\nmultiline\nvalue",
),
),
);
$this->assertEquals($expected, $instance->getChanges('t:234'));
// FIXME: properly handle and test merge revisions (issue 581)
}
public function testGetCommit()
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "me@thomaskeller.biz"
value "joe@user.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
signature "ok"
name "author"
value "graydon@pobox.com"
value "mary@jane.com"
trust "trusted"
key [1aaecf3a7c227e5545b0504aea5d3716d3128117]
$this->assertEquals(array('1234567890123456789012345678901234567891',
'1234567890123456789012345678901234567892'),
$commit->parents);
$this->assertEquals('me@thomaskeller.biz, graydon@pobox.com', $commit->author);
$this->assertEquals('joe@user.com, mary@jane.com', $commit->author);
$this->assertEquals('2011-03-19 13:59:47', $commit->date);
$this->assertEquals('something changed', $commit->title);
$this->assertEquals("---\nsomething changed here as\nwell, unbelievable!", $commit->full_message);
public function testIsCommitLarge()
{
// test for true / false with commits with more than 100 changes
$this->markTestIncomplete();
$instance = $this->createMock();
// kind of misleading, I know
$this->assertFalse($instance->isCommitLarge('890'));
$stdio = "8901234567890123456789012345678901234567\n";
$instance->getStdio()->setExpectedOutput(array('select', 't:890'), array(), $stdio);
$stdio =<<<END
format_version "1"
new_manifest [e3f7896021ae38ea2b5c9766b9dc0e71cffbcbc3]
old_revision [e4b7bfab4dae09770cf1b293d68bef34523fdaf5]
add_dir "foo"
add_file "bar"
content [56635b977a83788bf17c8225e291feeb9342ef16]
END;
$instance->getStdio()->setExpectedOutput(array('get_revision', '8901234567890123456789012345678901234567'), array(), $stdio);
// easy case
$this->assertFalse($instance->isCommitLarge('t:890'));
// slightly more complex case
$stdio =<<<END
format_version "1"
new_manifest [e3f7896021ae38ea2b5c9766b9dc0e71cffbcbc3]
old_revision [e4b7bfab4dae09770cf1b293d68bef34523fdaf5]
END;
for ($i=0; $i<=100; ++$i) {
if ($i % 2 == 0)
$stdio .= 'add_file "foo'.$i.'"'."\n".
' content [ae09770cf1b293d68bef34523fdaf5e4b7bfab4d]'."\n\n";
else
$stdio .= 'patch "foo'.$i.'"'."\n".
' from [ae09770cf1b293d68bef34523fdaf5e4b7bfab4d]'."\n".
' to [ef34523fdaf5e4bae09770cf1b293bfab4dd68b7]'."\n\n";
}
$instance->getStdio()->setExpectedOutput(array('get_revision', '8901234567890123456789012345678901234567'), array(), $stdio);
$this->assertTrue($instance->isCommitLarge('t:890'));
}
public function testGetChangeLog()

Archive Download the corresponding diff file

Page rendered in 0.09188s using 13 queries.