~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-06-02 05:03:31 UTC
  • mto: This revision was merged to the branch mainline in revision 5279.
  • Revision ID: mbp@canonical.com-20100602050331-n2p1qt8hfsahspnv
Correct more sloppy use of the term 'Linux'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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,
28
29
    upgrade,
29
30
    urlutils,
30
31
    )
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):
 
32
from bzrlib.transport import memory
 
33
 
 
34
 
 
35
class TestInfo(tests.TestCaseWithTransport):
37
36
 
38
37
    def setUp(self):
39
 
        ExternalBase.setUp(self)
40
 
        self._repo_strings = (
41
 
            "1.6 or 1.6.1-rich-root "
42
 
            "or 1.9 or 1.9-rich-root "
43
 
            "or dirstate or dirstate-tags or "
44
 
            "pack-0.92 or rich-root or rich-root-pack")
 
38
        super(TestInfo, self).setUp()
 
39
        self._repo_strings = "2a"
45
40
 
46
41
    def test_info_non_existing(self):
47
 
        if sys.platform == "win32":
48
 
            location = "C:/i/do/not/exist/"
49
 
        else:
50
 
            location = "/i/do/not/exist/"
 
42
        self.vfs_transport_factory = memory.MemoryServer
 
43
        location = self.get_url()
51
44
        out, err = self.run_bzr('info '+location, retcode=3)
52
45
        self.assertEqual(out, '')
53
46
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
133
126
        self.assertEqual('', err)
134
127
        tree1.commit('commit one')
135
128
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
136
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
129
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
137
130
 
138
131
        # Branch standalone with push location
139
132
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
219
212
         0 added
220
213
         0 removed
221
214
         0 renamed
222
 
         1 unknown
223
 
         0 ignored
 
215
         0 unknown
 
216
         1 ignored
224
217
         0 versioned subdirectories
225
218
 
226
219
Branch history:
291
284
 
292
285
Format:
293
286
       control: Meta directory format 1
294
 
  working tree: Working tree format 4
 
287
  working tree: Working tree format 6
295
288
        branch: Branch format 4
296
289
    repository: Weave repository format 6
297
290
 
321
314
        tree1.add('b')
322
315
        tree1.commit('commit two')
323
316
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
324
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
317
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
325
318
 
326
319
        # Out of date branched standalone branch will not be detected
327
320
        out, err = self.run_bzr('info -v branch')
387
380
         0 added
388
381
         0 removed
389
382
         0 renamed
390
 
         1 unknown
391
 
         0 ignored
 
383
         0 unknown
 
384
         1 ignored
392
385
         0 versioned subdirectories
393
386
 
394
387
Branch history:
453
446
 
454
447
Format:
455
448
       control: Meta directory format 1
456
 
  working tree: Working tree format 4
 
449
  working tree: Working tree format 6
457
450
        branch: Branch format 4
458
451
    repository: Weave repository format 6
459
452
 
575
568
        tree2.add('a')
576
569
        tree2.commit('commit one')
577
570
        rev = repo.get_revision(branch2.revision_history()[0])
578
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
571
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
579
572
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
580
573
        self.assertEqualDiff(
581
574
"""Lightweight checkout (format: %s)
586
579
 
587
580
Format:
588
581
       control: Meta directory format 1
589
 
  working tree: Working tree format 4
 
582
  working tree: Working tree format 6
590
583
        branch: %s
591
584
    repository: %s
592
585
 
617
610
        # Out of date checkout
618
611
        out, err = self.run_bzr('info -v tree/checkout')
619
612
        self.assertEqualDiff(
620
 
"""Checkout (format: dirstate)
 
613
"""Checkout (format: unnamed)
621
614
Location:
622
615
       checkout root: tree/checkout
623
616
  checkout of branch: repo/branch
624
617
 
625
618
Format:
626
619
       control: Meta directory format 1
627
 
  working tree: Working tree format 4
 
620
  working tree: Working tree format 6
628
621
        branch: %s
629
622
    repository: %s
630
623
 
656
649
        tree3.add('b')
657
650
        out, err = self.run_bzr('info tree/checkout --verbose')
658
651
        self.assertEqualDiff(
659
 
"""Checkout (format: dirstate)
 
652
"""Checkout (format: unnamed)
660
653
Location:
661
654
       checkout root: tree/checkout
662
655
  checkout of branch: repo/branch
663
656
 
664
657
Format:
665
658
       control: Meta directory format 1
666
 
  working tree: Working tree format 4
 
659
  working tree: Working tree format 6
667
660
        branch: %s
668
661
    repository: %s
669
662
 
694
687
 
695
688
        # Out of date lightweight checkout
696
689
        rev = repo.get_revision(branch1.revision_history()[-1])
697
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
690
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
698
691
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
699
692
        self.assertEqualDiff(
700
693
"""Lightweight checkout (format: %s)
705
698
 
706
699
Format:
707
700
       control: Meta directory format 1
708
 
  working tree: Working tree format 4
 
701
  working tree: Working tree format 6
709
702
        branch: %s
710
703
    repository: %s
711
704
 
850
843
        tree1.add('a')
851
844
        tree1.commit('commit one')
852
845
        rev = repo.get_revision(branch1.revision_history()[0])
853
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
846
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
854
847
        out, err = self.run_bzr('info -v repo/branch1')
855
848
        self.assertEqualDiff(
856
849
"""Repository tree (format: knit)
1131
1124
            (False, False): 'Checkout',
1132
1125
            }[(shared_repo is not None, light_checkout)]
1133
1126
        format = {True: self._repo_strings,
1134
 
                  False: 'dirstate'}[light_checkout]
 
1127
                  False: 'unnamed'}[light_checkout]
1135
1128
        if repo_locked:
1136
1129
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1137
1130
        if repo_locked or branch_locked or tree_locked:
1235
1228
        # Do a light checkout of the heavy one
1236
1229
        transport.mkdir('tree/lightcheckout')
1237
1230
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1238
 
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1231
        branch.BranchReferenceFormat().initialize(lco_dir,
 
1232
            target_branch=co_branch)
1239
1233
        lco_dir.create_workingtree()
1240
1234
        lco_tree = lco_dir.open_workingtree()
1241
1235
 
1331
1325
 
1332
1326
    def test_info_locking_oslocks(self):
1333
1327
        if sys.platform == "win32":
1334
 
            raise TestSkipped("don't use oslocks on win32 in unix manner")
 
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.
 
1333
        self.thisFailsStrictLockCheck()
1335
1334
 
1336
1335
        tree = self.make_branch_and_tree('branch',
1337
1336
                                         format=bzrdir.BzrDirFormat6())