~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_info.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 16:38:10 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309163810-ujn8hcx08f75nlf1
Refined test to make use of locking hooks and also validate if lock is truly a checkout-lock.

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
25
25
    errors,
26
26
    info,
27
27
    osutils,
28
 
    tests,
29
28
    upgrade,
30
29
    urlutils,
31
30
    )
32
 
from bzrlib.transport import memory
33
 
 
34
 
 
35
 
class TestInfo(tests.TestCaseWithTransport):
 
31
from bzrlib.osutils import format_date
 
32
from bzrlib.tests import TestSkipped
 
33
from bzrlib.tests.blackbox import ExternalBase
 
34
 
 
35
 
 
36
class TestInfo(ExternalBase):
36
37
 
37
38
    def setUp(self):
38
 
        super(TestInfo, self).setUp()
39
 
        self._repo_strings = "2a"
 
39
        ExternalBase.setUp(self)
 
40
        self._repo_strings = "2a or development-subtree"
40
41
 
41
42
    def test_info_non_existing(self):
42
 
        self.vfs_transport_factory = memory.MemoryServer
43
 
        location = self.get_url()
 
43
        if sys.platform == "win32":
 
44
            location = "C:/i/do/not/exist/"
 
45
        else:
 
46
            location = "/i/do/not/exist/"
44
47
        out, err = self.run_bzr('info '+location, retcode=3)
45
48
        self.assertEqual(out, '')
46
49
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
126
129
        self.assertEqual('', err)
127
130
        tree1.commit('commit one')
128
131
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
129
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
132
        datestring_first = format_date(rev.timestamp, rev.timezone)
130
133
 
131
134
        # Branch standalone with push location
132
135
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
212
215
         0 added
213
216
         0 removed
214
217
         0 renamed
215
 
         0 unknown
216
 
         1 ignored
 
218
         1 unknown
 
219
         0 ignored
217
220
         0 versioned subdirectories
218
221
 
219
222
Branch history:
314
317
        tree1.add('b')
315
318
        tree1.commit('commit two')
316
319
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
317
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
320
        datestring_last = format_date(rev.timestamp, rev.timezone)
318
321
 
319
322
        # Out of date branched standalone branch will not be detected
320
323
        out, err = self.run_bzr('info -v branch')
380
383
         0 added
381
384
         0 removed
382
385
         0 renamed
383
 
         0 unknown
384
 
         1 ignored
 
386
         1 unknown
 
387
         0 ignored
385
388
         0 versioned subdirectories
386
389
 
387
390
Branch history:
568
571
        tree2.add('a')
569
572
        tree2.commit('commit one')
570
573
        rev = repo.get_revision(branch2.revision_history()[0])
571
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
574
        datestring_first = format_date(rev.timestamp, rev.timezone)
572
575
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
573
576
        self.assertEqualDiff(
574
577
"""Lightweight checkout (format: %s)
687
690
 
688
691
        # Out of date lightweight checkout
689
692
        rev = repo.get_revision(branch1.revision_history()[-1])
690
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
693
        datestring_last = format_date(rev.timestamp, rev.timezone)
691
694
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
695
        self.assertEqualDiff(
693
696
"""Lightweight checkout (format: %s)
843
846
        tree1.add('a')
844
847
        tree1.commit('commit one')
845
848
        rev = repo.get_revision(branch1.revision_history()[0])
846
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
849
        datestring_first = format_date(rev.timestamp, rev.timezone)
847
850
        out, err = self.run_bzr('info -v repo/branch1')
848
851
        self.assertEqualDiff(
849
852
"""Repository tree (format: knit)
1228
1231
        # Do a light checkout of the heavy one
1229
1232
        transport.mkdir('tree/lightcheckout')
1230
1233
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
 
        branch.BranchReferenceFormat().initialize(lco_dir,
1232
 
            target_branch=co_branch)
 
1234
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1233
1235
        lco_dir.create_workingtree()
1234
1236
        lco_tree = lco_dir.open_workingtree()
1235
1237
 
1325
1327
 
1326
1328
    def test_info_locking_oslocks(self):
1327
1329
        if sys.platform == "win32":
1328
 
            self.skip("don't use oslocks on win32 in unix manner")
1329
 
        # This test tests old (all-in-one, OS lock using) behaviour which
1330
 
        # simply cannot work on windows (and is indeed why we changed our
1331
 
        # design. As such, don't try to remove the thisFailsStrictLockCheck
1332
 
        # call here.
 
1330
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1333
1331
        self.thisFailsStrictLockCheck()
1334
1332
 
1335
1333
        tree = self.make_branch_and_tree('branch',