~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-15 09:15:03 UTC
  • mfrom: (4595.7.4 409137-lsb-release)
  • Revision ID: pqm@pqm.ubuntu.com-20090815091503-qwbm6glvv31rnujw
(mbp) show platform in selftest, version and backtrace

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