/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
197
197
        self.assertEqual('%s %s\n'
198
198
                         '%s\n%s\n'
199
199
                         'Will continue to try until %s, unless '
200
 
                         'you press Ctrl-C.\n'
201
 
                         'See "bzr help break-lock" for more.',
 
200
                         'you press Ctrl-C\n'
 
201
                         'If you\'re sure that it\'s not being '
 
202
                         'modified, use bzr break-lock %s',
202
203
                         self._logged_reports[0][0])
203
204
        args = self._logged_reports[0][1]
204
205
        self.assertEqual('Unable to obtain', args[0])
419
420
        self.assertEqual('%s %s\n'
420
421
                         '%s\n%s\n'
421
422
                         'Will continue to try until %s, unless '
422
 
                         'you press Ctrl-C.\n'
423
 
                         'See "bzr help break-lock" for more.',
 
423
                         'you press Ctrl-C\n'
 
424
                         'If you\'re sure that it\'s not being '
 
425
                         'modified, use bzr break-lock %s',
424
426
                         self._logged_reports[0][0])
425
427
        args = self._logged_reports[0][1]
426
428
        self.assertEqual('Unable to obtain', args[0])
433
435
        self.assertEqual('%s %s\n'
434
436
                         '%s\n%s\n'
435
437
                         'Will continue to try until %s, unless '
436
 
                         'you press Ctrl-C.\n'
437
 
                         'See "bzr help break-lock" for more.',
 
438
                         'you press Ctrl-C\n'
 
439
                         'If you\'re sure that it\'s not being '
 
440
                         'modified, use bzr break-lock %s',
438
441
                         self._logged_reports[1][0])
439
442
        args = self._logged_reports[1][1]
440
443
        self.assertEqual('Lock owner changed for', args[0])
558
561
        # do this without IO redirection to ensure it doesn't prompt.
559
562
        self.assertRaises(AssertionError, ld1.break_lock)
560
563
        orig_factory = bzrlib.ui.ui_factory
561
 
        bzrlib.ui.ui_factory = bzrlib.ui.CannedInputUIFactory([True])
 
564
        # silent ui - no need for stdout
 
565
        bzrlib.ui.ui_factory = bzrlib.ui.SilentUIFactory()
 
566
        bzrlib.ui.ui_factory.stdin = StringIO("y\n")
562
567
        try:
563
568
            ld2.break_lock()
564
569
            self.assertRaises(LockBroken, ld1.unlock)
666
671
        # no kibble
667
672
        check_dir(['held'])
668
673
 
669
 
    def test_no_lockdir_info(self):
670
 
        """We can cope with empty info files."""
671
 
        # This seems like a fairly common failure case - see
672
 
        # <https://bugs.edge.launchpad.net/bzr/+bug/185103> and all its dupes.
673
 
        # Processes are often interrupted after opening the file
674
 
        # before the actual contents are committed.
675
 
        t = self.get_transport()
676
 
        t.mkdir('test_lock')
677
 
        t.mkdir('test_lock/held')
678
 
        t.put_bytes('test_lock/held/info', '')
679
 
        lf = LockDir(t, 'test_lock')
680
 
        info = lf.peek()
681
 
        formatted_info = lf._format_lock_info(info)
682
 
        self.assertEquals(
683
 
            ['lock %s' % t.abspath('test_lock'),
684
 
             'held by <unknown> on host <unknown> [process #<unknown>]',
685
 
             'locked (unknown)'],
686
 
            formatted_info)
687
 
 
688
674
 
689
675
class TestLockDirHooks(TestCaseWithTransport):
690
676