/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2241.1.4 by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo.
1
# Copyright (C) 2006, 2007 Canonical Ltd
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
2
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
7
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
12
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
18
"""Tests for the info command of bzr."""
19
1769.2.1 by Alexander Belchenko
win32 fix for blackbox.test_info.TestInfo.test_info_non_existing
20
import sys
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
21
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
22
import bzrlib
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
23
from bzrlib import (
24
    bzrdir,
25
    repository,
26
    )
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
27
from bzrlib.osutils import format_date
28
from bzrlib.tests import TestSkipped
29
from bzrlib.tests.blackbox import ExternalBase
30
31
32
class TestInfo(ExternalBase):
33
1694.2.6 by Martin Pool
[merge] bzr.dev
34
    def test_info_non_existing(self):
1769.2.1 by Alexander Belchenko
win32 fix for blackbox.test_info.TestInfo.test_info_non_existing
35
        if sys.platform == "win32":
36
            location = "C:/i/do/not/exist/"
37
        else:
38
            location = "/i/do/not/exist/"
39
        out, err = self.runbzr('info '+location, retcode=3)
1694.2.6 by Martin Pool
[merge] bzr.dev
40
        self.assertEqual(out, '')
1769.2.1 by Alexander Belchenko
win32 fix for blackbox.test_info.TestInfo.test_info_non_existing
41
        self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
1694.2.6 by Martin Pool
[merge] bzr.dev
42
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
43
    def test_info_standalone(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
44
        transport = self.get_transport()
45
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
46
        # Create initial standalone branch
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
47
        tree1 = self.make_branch_and_tree('standalone', 'weave')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
48
        self.build_tree(['standalone/a'])
49
        tree1.add('a')
50
        branch1 = tree1.branch
51
        out, err = self.runbzr('info standalone')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
52
        self.assertEqualDiff(
53
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
54
  branch root: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
55
56
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
57
       control: All-in-one format 6
58
  working tree: Working tree format 2
59
        branch: Branch format 4
60
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
61
62
In the working tree:
63
         0 unchanged
64
         0 modified
65
         1 added
66
         0 removed
67
         0 renamed
68
         0 unknown
69
         0 ignored
70
         0 versioned subdirectories
71
72
Branch history:
73
         0 revisions
74
75
Revision store:
76
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
77
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
78
""" % branch1.bzrdir.root_transport.base, out)
79
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
80
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
81
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
82
        datestring_first = format_date(rev.timestamp, rev.timezone)
83
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
84
        # Branch standalone with push location
85
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
86
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
87
        out, err = self.runbzr('info branch --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
88
        self.assertEqualDiff(
89
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
90
  branch root: %s
91
92
Related branches:
93
      parent branch: %s
94
  publish to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
95
96
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
97
       control: All-in-one format 6
98
  working tree: Working tree format 2
99
        branch: Branch format 4
100
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
101
102
In the working tree:
103
         1 unchanged
104
         0 modified
105
         0 added
106
         0 removed
107
         0 renamed
108
         0 unknown
109
         0 ignored
110
         0 versioned subdirectories
111
112
Branch history:
113
         1 revision
114
         1 committer
115
         0 days old
116
   first revision: %s
117
  latest revision: %s
118
119
Revision store:
120
         1 revision
1694.2.6 by Martin Pool
[merge] bzr.dev
121
         %d KiB
122
""" % (branch2.bzrdir.root_transport.base,
123
       branch1.bzrdir.root_transport.base,
124
       branch1.bzrdir.root_transport.base,
125
       datestring_first, datestring_first,
126
       # poking at _revision_store isn't all that clean, but neither is
127
       # having the ui test dependent on the exact overhead of a given store.
128
       branch2.repository._revision_store.total_size(
129
        branch2.repository.get_transaction())[1] / 1024,
130
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
131
        self.assertEqual('', err)
132
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
133
        # Branch and bind to standalone, needs upgrade to metadir
134
        # (creates backup as unknown)
1624.3.47 by Olaf Conradi
Fix test case for bzr info in upgrading a standalone branch to metadir,
135
        branch1.bzrdir.sprout('bound')
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
136
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
1910.2.38 by Aaron Bentley
Fix info test to use knit1 for bound branches
137
        bzrlib.upgrade.upgrade('bound', knit1_format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
138
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
139
        branch3.bind(branch1)
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
140
        bound_tree = branch3.bzrdir.open_workingtree()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
141
        out, err = self.runbzr('info bound')
142
        self.assertEqualDiff(
143
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
144
       checkout root: %s
145
  checkout of branch: %s
146
147
Related branches:
148
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
149
150
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
151
       control: Meta directory format 1
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
152
  working tree: %s
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
153
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
154
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
155
156
In the working tree:
157
         1 unchanged
158
         0 modified
159
         0 added
160
         0 removed
161
         0 renamed
162
         1 unknown
163
         0 ignored
164
         0 versioned subdirectories
165
166
Branch history:
167
         1 revision
168
         0 days old
169
   first revision: %s
170
  latest revision: %s
171
172
Revision store:
173
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
174
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
175
""" % (branch3.bzrdir.root_transport.base,
176
       branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
177
       branch1.bzrdir.root_transport.base,
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
178
       bound_tree._format.get_format_description(),      
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
179
       branch3._format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
180
       branch3.repository._format.get_format_description(),
181
       datestring_first, datestring_first,
182
       # poking at _revision_store isn't all that clean, but neither is
183
       # having the ui test dependent on the exact overhead of a given store.
184
       branch3.repository._revision_store.total_size(
185
        branch3.repository.get_transaction())[1] / 1024,
186
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
187
        self.assertEqual('', err)
188
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
189
        # Checkout standalone (same as above, but does not have parent set)
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
190
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
191
            format=knit1_format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
192
        branch4.bind(branch1)
193
        branch4.bzrdir.open_workingtree().update()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
194
        out, err = self.runbzr('info checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
195
        self.assertEqualDiff(
196
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
197
       checkout root: %s
198
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
199
200
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
201
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
202
  working tree: Working tree format 3
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
203
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
204
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
205
206
In the working tree:
207
         1 unchanged
208
         0 modified
209
         0 added
210
         0 removed
211
         0 renamed
212
         0 unknown
213
         0 ignored
214
         0 versioned subdirectories
215
216
Branch history:
217
         1 revision
218
         1 committer
219
         0 days old
220
   first revision: %s
221
  latest revision: %s
222
223
Revision store:
224
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
225
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
226
""" % (branch4.bzrdir.root_transport.base,
227
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
228
       branch4.repository._format.get_format_description(),
229
       datestring_first, datestring_first,
230
       # poking at _revision_store isn't all that clean, but neither is
231
       # having the ui test dependent on the exact overhead of a given store.
232
       branch4.repository._revision_store.total_size(
233
        branch4.repository.get_transaction())[1] / 1024,
234
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
235
        self.assertEqual('', err)
236
237
        # Lightweight checkout (same as above, different branch and repository)
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
238
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
239
        branch5 = tree5.branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
240
        out, err = self.runbzr('info lightcheckout')
241
        self.assertEqualDiff(
242
"""Location:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
243
 light checkout root: %s
244
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
245
246
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
247
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
248
  working tree: Working tree format 4
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
249
        branch: Branch format 4
250
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
251
252
In the working tree:
253
         1 unchanged
254
         0 modified
255
         0 added
256
         0 removed
257
         0 renamed
258
         0 unknown
259
         0 ignored
260
         0 versioned subdirectories
261
262
Branch history:
263
         1 revision
264
         0 days old
265
   first revision: %s
266
  latest revision: %s
267
268
Revision store:
269
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
270
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
271
""" % (tree5.bzrdir.root_transport.base,
272
       branch1.bzrdir.root_transport.base,
273
       datestring_first, datestring_first,
274
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
275
        self.assertEqual('', err)
276
277
        # Update initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
278
        self.build_tree(['standalone/b'])
279
        tree1.add('b')
280
        tree1.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
281
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
282
        datestring_last = format_date(rev.timestamp, rev.timezone)
283
284
        # Out of date branched standalone branch will not be detected
285
        out, err = self.runbzr('info branch')
286
        self.assertEqualDiff(
287
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
288
  branch root: %s
289
290
Related branches:
291
      parent branch: %s
292
  publish to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
293
294
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
295
       control: All-in-one format 6
296
  working tree: Working tree format 2
297
        branch: Branch format 4
298
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
299
300
In the working tree:
301
         1 unchanged
302
         0 modified
303
         0 added
304
         0 removed
305
         0 renamed
306
         0 unknown
307
         0 ignored
308
         0 versioned subdirectories
309
310
Branch history:
311
         1 revision
312
         0 days old
313
   first revision: %s
314
  latest revision: %s
315
316
Revision store:
317
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
318
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
319
""" % (branch2.bzrdir.root_transport.base,
320
       branch1.bzrdir.root_transport.base,
321
       branch1.bzrdir.root_transport.base,
322
       datestring_first, datestring_first,
323
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
324
        self.assertEqual('', err)
325
326
        # Out of date bound branch
327
        out, err = self.runbzr('info bound')
328
        self.assertEqualDiff(
329
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
330
       checkout root: %s
331
  checkout of branch: %s
332
333
Related branches:
334
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
335
336
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
337
       control: Meta directory format 1
338
  working tree: Working tree format 3
339
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
340
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
341
342
Branch is out of date: missing 1 revision.
343
344
In the working tree:
345
         1 unchanged
346
         0 modified
347
         0 added
348
         0 removed
349
         0 renamed
350
         1 unknown
351
         0 ignored
352
         0 versioned subdirectories
353
354
Branch history:
355
         1 revision
356
         0 days old
357
   first revision: %s
358
  latest revision: %s
359
360
Revision store:
361
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
362
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
363
""" % (branch3.bzrdir.root_transport.base,
364
       branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
365
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
366
       branch3.repository._format.get_format_description(),
367
       datestring_first, datestring_first,
368
       # poking at _revision_store isn't all that clean, but neither is
369
       # having the ui test dependent on the exact overhead of a given store.
370
       branch3.repository._revision_store.total_size(
371
        branch3.repository.get_transaction())[1] / 1024,
372
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
373
        self.assertEqual('', err)
374
375
        # Out of date checkout
376
        out, err = self.runbzr('info checkout')
377
        self.assertEqualDiff(
378
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
379
       checkout root: %s
380
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
381
382
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
383
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
384
  working tree: Working tree format 3
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
385
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
386
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
387
388
Branch is out of date: missing 1 revision.
389
390
In the working tree:
391
         1 unchanged
392
         0 modified
393
         0 added
394
         0 removed
395
         0 renamed
396
         0 unknown
397
         0 ignored
398
         0 versioned subdirectories
399
400
Branch history:
401
         1 revision
402
         0 days old
403
   first revision: %s
404
  latest revision: %s
405
406
Revision store:
407
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
408
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
409
""" % (branch4.bzrdir.root_transport.base,
410
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
411
       branch4.repository._format.get_format_description(),
412
       datestring_first, datestring_first,
413
       # poking at _revision_store isn't all that clean, but neither is
414
       # having the ui test dependent on the exact overhead of a given store.
415
       branch4.repository._revision_store.total_size(
416
        branch4.repository.get_transaction())[1] / 1024,
417
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
418
        self.assertEqual('', err)
419
420
        # Out of date lightweight checkout
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
421
        out, err = self.runbzr('info lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
422
        self.assertEqualDiff(
423
"""Location:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
424
 light checkout root: %s
425
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
426
427
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
428
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
429
  working tree: Working tree format 4
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
430
        branch: Branch format 4
431
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
432
433
Working tree is out of date: missing 1 revision.
434
435
In the working tree:
436
         1 unchanged
437
         0 modified
438
         0 added
439
         0 removed
440
         0 renamed
441
         0 unknown
442
         0 ignored
443
         0 versioned subdirectories
444
445
Branch history:
446
         2 revisions
447
         1 committer
448
         0 days old
449
   first revision: %s
450
  latest revision: %s
451
452
Revision store:
453
         2 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
454
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
455
""" % (tree5.bzrdir.root_transport.base,
456
       branch1.bzrdir.root_transport.base,
457
       datestring_first, datestring_last,
458
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
459
        self.assertEqual('', err)
460
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
461
    def test_info_standalone_no_tree(self):
462
        # create standalone branch without a working tree
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
463
        format = bzrdir.format_registry.make_bzrdir('default')
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
464
        branch = self.make_branch('branch')
465
        repo = branch.repository
466
        out, err = self.runbzr('info branch')
467
        self.assertEqualDiff(
468
"""Location:
469
  branch root: %s
470
471
Format:
472
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
473
        branch: %s
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
474
    repository: %s
475
476
Branch history:
477
         0 revisions
478
479
Revision store:
480
         0 revisions
481
         0 KiB
482
""" % (branch.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
483
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
484
       format.repository_format.get_format_description(),
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
485
       ), out)
486
        self.assertEqual('', err)
487
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
488
    def test_info_shared_repository(self):
2241.1.4 by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo.
489
        format = bzrdir.format_registry.make_bzrdir('knit')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
490
        transport = self.get_transport()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
491
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
492
        # Create shared repository
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
493
        repo = self.make_repository('repo', shared=True, format=format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
494
        repo.set_make_working_trees(False)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
495
        out, err = self.runbzr('info repo')
496
        self.assertEqualDiff(
497
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
498
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
499
500
Format:
501
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
502
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
503
504
Revision store:
505
         0 revisions
506
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
507
""" % (repo.bzrdir.root_transport.base,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
508
       format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
509
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
510
        self.assertEqual('', err)
511
512
        # Create branch inside shared repository
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
513
        repo.bzrdir.root_transport.mkdir('branch')
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
514
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
515
            format=format)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
516
        out, err = self.runbzr('info repo/branch')
517
        self.assertEqualDiff(
518
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
519
  shared repository: %s
520
  repository branch: branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
521
522
Format:
523
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
524
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
525
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
526
527
Branch history:
528
         0 revisions
529
530
Revision store:
531
         0 revisions
532
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
533
""" % (repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
534
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
535
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
536
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
537
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
538
539
        # Create lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
540
        transport.mkdir('tree')
541
        transport.mkdir('tree/lightcheckout')
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
542
        tree2 = branch1.create_checkout('tree/lightcheckout', 
543
            lightweight=True)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
544
        branch2 = tree2.branch
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
545
        self.assertCheckoutStatusOutput('tree/lightcheckout', tree2, 
546
                   shared_repo=repo)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
547
548
        # Create normal checkout
1551.8.5 by Aaron Bentley
Change name to create_checkout
549
        tree3 = branch1.create_checkout('tree/checkout')
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
550
        self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
551
            verbose=True,
552
            light_checkout=False, repo_branch=branch1)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
553
        # Update lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
554
        self.build_tree(['tree/lightcheckout/a'])
555
        tree2.add('a')
556
        tree2.commit('commit one')
557
        rev = repo.get_revision(branch2.revision_history()[0])
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
558
        datestring_first = format_date(rev.timestamp, rev.timezone)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
559
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
560
        self.assertEqualDiff(
561
"""Location:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
562
 light checkout root: %s
563
   shared repository: %s
564
   repository branch: branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
565
566
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
567
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
568
  working tree: Working tree format 4
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
569
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
570
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
571
572
In the working tree:
573
         1 unchanged
574
         0 modified
575
         0 added
576
         0 removed
577
         0 renamed
578
         0 unknown
579
         0 ignored
580
         0 versioned subdirectories
581
582
Branch history:
583
         1 revision
584
         1 committer
585
         0 days old
586
   first revision: %s
587
  latest revision: %s
588
589
Revision store:
590
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
591
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
592
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
593
       repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
594
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
595
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
596
       datestring_first, datestring_first,
597
       # poking at _revision_store isn't all that clean, but neither is
598
       # having the ui test dependent on the exact overhead of a given store.
599
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
600
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
601
        self.assertEqual('', err)
602
603
        # Out of date checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
604
        out, err = self.runbzr('info tree/checkout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
605
        self.assertEqualDiff(
606
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
607
       checkout root: %s
608
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
609
610
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
611
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
612
  working tree: Working tree format 4
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
613
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
614
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
615
616
Branch is out of date: missing 1 revision.
617
618
In the working tree:
619
         0 unchanged
620
         0 modified
621
         0 added
622
         0 removed
623
         0 renamed
624
         0 unknown
625
         0 ignored
626
         0 versioned subdirectories
627
628
Branch history:
629
         0 revisions
630
631
Revision store:
632
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
633
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
634
""" % (tree3.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
635
       branch1.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
636
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
637
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
638
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
639
        self.assertEqual('', err)
640
641
        # Update checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
642
        tree3.update()
643
        self.build_tree(['tree/checkout/b'])
644
        tree3.add('b')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
645
        out, err = self.runbzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
646
        self.assertEqualDiff(
647
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
648
       checkout root: %s
649
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
650
651
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
652
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
653
  working tree: Working tree format 4
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
654
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
655
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
656
657
In the working tree:
658
         1 unchanged
659
         0 modified
660
         1 added
661
         0 removed
662
         0 renamed
663
         0 unknown
664
         0 ignored
665
         0 versioned subdirectories
666
667
Branch history:
668
         1 revision
669
         1 committer
670
         0 days old
671
   first revision: %s
672
  latest revision: %s
673
674
Revision store:
675
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
676
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
677
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
678
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
679
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
680
       datestring_first, datestring_first,
681
       # poking at _revision_store isn't all that clean, but neither is
682
       # having the ui test dependent on the exact overhead of a given store.
683
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
684
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
685
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
686
        tree3.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
687
688
        # Out of date lightweight checkout
1624.3.12 by Olaf Conradi
Fixed bug in test case where datestring_last returned the first.
689
        rev = repo.get_revision(branch1.revision_history()[-1])
690
        datestring_last = format_date(rev.timestamp, rev.timezone)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
691
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
692
        self.assertEqualDiff(
693
"""Location:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
694
 light checkout root: %s
695
   shared repository: %s
696
   repository branch: branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
697
698
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
699
       control: Meta directory format 1
2255.7.73 by Robert Collins
Fix info for the new default format - these tests really need refactoring.
700
  working tree: Working tree format 4
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
701
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
702
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
703
704
Working tree is out of date: missing 1 revision.
705
706
In the working tree:
707
         1 unchanged
708
         0 modified
709
         0 added
710
         0 removed
711
         0 renamed
712
         0 unknown
713
         0 ignored
714
         0 versioned subdirectories
715
716
Branch history:
717
         2 revisions
718
         1 committer
719
         0 days old
720
   first revision: %s
721
  latest revision: %s
722
723
Revision store:
724
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
725
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
726
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
727
       repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
728
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
729
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
730
       datestring_first, datestring_last,
731
       # poking at _revision_store isn't all that clean, but neither is
732
       # having the ui test dependent on the exact overhead of a given store.
733
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
734
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
735
        self.assertEqual('', err)
736
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
737
        # Show info about shared branch
738
        out, err = self.runbzr('info repo/branch --verbose')
739
        self.assertEqualDiff(
740
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
741
  shared repository: %s
742
  repository branch: branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
743
744
Format:
745
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
746
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
747
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
748
749
Branch history:
750
         2 revisions
751
         1 committer
752
         0 days old
753
   first revision: %s
754
  latest revision: %s
755
756
Revision store:
757
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
758
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
759
""" % (repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
760
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
761
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
762
       datestring_first, datestring_last,
763
       # poking at _revision_store isn't all that clean, but neither is
764
       # having the ui test dependent on the exact overhead of a given store.
765
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
766
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
767
        self.assertEqual('', err)
768
769
        # Show info about repository with revisions
770
        out, err = self.runbzr('info repo')
771
        self.assertEqualDiff(
772
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
773
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
774
775
Format:
776
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
777
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
778
779
Revision store:
780
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
781
         %d KiB
782
""" % (repo.bzrdir.root_transport.base,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
783
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
784
       # poking at _revision_store isn't all that clean, but neither is
785
       # having the ui test dependent on the exact overhead of a given store.
786
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1694.2.6 by Martin Pool
[merge] bzr.dev
787
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
788
        self.assertEqual('', err)
789
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
790
    def test_info_shared_repository_with_trees(self):
2241.1.4 by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo.
791
        format = bzrdir.format_registry.make_bzrdir('knit')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
792
        transport = self.get_transport()
793
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
794
        # Create shared repository with working trees
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
795
        repo = self.make_repository('repo', shared=True, format=format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
796
        repo.set_make_working_trees(True)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
797
        out, err = self.runbzr('info repo')
798
        self.assertEqualDiff(
799
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
800
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
801
802
Format:
803
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
804
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
805
806
Create working tree for new branches inside the repository.
807
808
Revision store:
809
         0 revisions
810
         0 KiB
1666.1.6 by Robert Collins
Make knit the default format.
811
""" % (repo.bzrdir.root_transport.base,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
812
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
813
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
814
        self.assertEqual('', err)
815
816
        # Create two branches
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
817
        repo.bzrdir.root_transport.mkdir('branch1')
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
818
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
819
            format=format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
820
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
821
822
        # Empty first branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
823
        out, err = self.runbzr('info repo/branch1 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
824
        self.assertEqualDiff(
825
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
826
    shared repository: %s
827
  repository checkout: branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
828
829
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
830
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
831
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
832
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
833
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
834
835
In the working tree:
836
         0 unchanged
837
         0 modified
838
         0 added
839
         0 removed
840
         0 renamed
841
         0 unknown
842
         0 ignored
843
         0 versioned subdirectories
844
845
Branch history:
846
         0 revisions
847
         0 committers
848
849
Revision store:
850
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
851
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
852
""" % (repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
853
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
854
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
855
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
856
        self.assertEqual('', err)
857
858
        # Update first branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
859
        self.build_tree(['repo/branch1/a'])
860
        tree1 = branch1.bzrdir.open_workingtree()
861
        tree1.add('a')
862
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
863
        rev = repo.get_revision(branch1.revision_history()[0])
864
        datestring_first = format_date(rev.timestamp, rev.timezone)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
865
        out, err = self.runbzr('info repo/branch1')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
866
        self.assertEqualDiff(
867
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
868
    shared repository: %s
869
  repository checkout: branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
870
871
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
872
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
873
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
874
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
875
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
876
877
In the working tree:
878
         1 unchanged
879
         0 modified
880
         0 added
881
         0 removed
882
         0 renamed
883
         0 unknown
884
         0 ignored
885
         0 versioned subdirectories
886
887
Branch history:
888
         1 revision
889
         0 days old
890
   first revision: %s
891
  latest revision: %s
892
893
Revision store:
894
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
895
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
896
""" % (repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
897
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
898
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
899
       datestring_first, datestring_first,
900
       # poking at _revision_store isn't all that clean, but neither is
901
       # having the ui test dependent on the exact overhead of a given store.
902
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
903
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
904
        self.assertEqual('', err)
905
906
        # Out of date second branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
907
        out, err = self.runbzr('info repo/branch2 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
908
        self.assertEqualDiff(
909
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
910
    shared repository: %s
911
  repository checkout: branch2
912
913
Related branches:
914
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
915
916
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
917
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
918
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
919
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
920
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
921
922
In the working tree:
923
         0 unchanged
924
         0 modified
925
         0 added
926
         0 removed
927
         0 renamed
928
         0 unknown
929
         0 ignored
930
         0 versioned subdirectories
931
932
Branch history:
933
         0 revisions
934
         0 committers
935
936
Revision store:
937
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
938
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
939
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
940
       branch1.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
941
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
942
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
943
       # poking at _revision_store isn't all that clean, but neither is
944
       # having the ui test dependent on the exact overhead of a given store.
945
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
946
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
947
        self.assertEqual('', err)
948
949
        # Update second branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
950
        tree2 = branch2.bzrdir.open_workingtree()
951
        tree2.pull(branch1)
952
        out, err = self.runbzr('info repo/branch2')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
953
        self.assertEqualDiff(
954
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
955
    shared repository: %s
956
  repository checkout: branch2
957
958
Related branches:
959
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
960
961
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
962
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
963
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
964
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
965
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
966
967
In the working tree:
968
         1 unchanged
969
         0 modified
970
         0 added
971
         0 removed
972
         0 renamed
973
         0 unknown
974
         0 ignored
975
         0 versioned subdirectories
976
977
Branch history:
978
         1 revision
979
         0 days old
980
   first revision: %s
981
  latest revision: %s
982
983
Revision store:
984
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
985
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
986
""" % (repo.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
987
       branch1.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
988
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
989
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
990
       datestring_first, datestring_first,
991
       # poking at _revision_store isn't all that clean, but neither is
992
       # having the ui test dependent on the exact overhead of a given store.
993
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
994
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
995
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
996
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
997
        # Show info about repository with revisions
998
        out, err = self.runbzr('info repo')
999
        self.assertEqualDiff(
1000
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
1001
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1002
1003
Format:
1004
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
1005
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1006
1007
Create working tree for new branches inside the repository.
1008
1009
Revision store:
1010
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
1011
         %d KiB
1012
""" % (repo.bzrdir.root_transport.base,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
1013
       format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
1014
       # poking at _revision_store isn't all that clean, but neither is
1015
       # having the ui test dependent on the exact overhead of a given store.
1016
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1017
       ),
1018
       out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1019
        self.assertEqual('', err)
1694.2.6 by Martin Pool
[merge] bzr.dev
1020
    
1021
    def test_info_shared_repository_with_tree_in_root(self):
2241.1.4 by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo.
1022
        format = bzrdir.format_registry.make_bzrdir('knit')
1694.2.6 by Martin Pool
[merge] bzr.dev
1023
        transport = self.get_transport()
1024
1025
        # Create shared repository with working trees
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
1026
        repo = self.make_repository('repo', shared=True, format=format)
1694.2.6 by Martin Pool
[merge] bzr.dev
1027
        repo.set_make_working_trees(True)
1028
        out, err = self.runbzr('info repo')
1029
        self.assertEqualDiff(
1030
"""Location:
1031
  shared repository: %s
1032
1033
Format:
1034
       control: Meta directory format 1
1035
    repository: %s
1036
1037
Create working tree for new branches inside the repository.
1038
1039
Revision store:
1040
         0 revisions
1041
         0 KiB
1042
""" % (repo.bzrdir.root_transport.base,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
1043
       format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
1044
       ), out)
1045
        self.assertEqual('', err)
1046
1047
        # Create branch in root of repository
1048
        control = repo.bzrdir
1049
        branch = control.create_branch()
1050
        control.create_workingtree()
1051
        out, err = self.runbzr('info repo')
1052
        self.assertEqualDiff(
1053
"""Location:
1054
    shared repository: %s
1055
  repository checkout: .
1056
1057
Format:
1058
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
1059
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1060
        branch: %s
1694.2.6 by Martin Pool
[merge] bzr.dev
1061
    repository: %s
1062
1063
In the working tree:
1064
         0 unchanged
1065
         0 modified
1066
         0 added
1067
         0 removed
1068
         0 renamed
1069
         0 unknown
1070
         0 ignored
1071
         0 versioned subdirectories
1072
1073
Branch history:
1074
         0 revisions
1075
1076
Revision store:
1077
         0 revisions
1078
         0 KiB
1079
""" % (repo.bzrdir.root_transport.base,
2230.3.55 by Aaron Bentley
Updates from review
1080
       format.get_branch_format().get_format_description(),
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
1081
       format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
1082
       ), out)
1083
        self.assertEqual('', err)
1084
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1085
    def assertCheckoutStatusOutput(self, 
1086
        command_string, lco_tree, shared_repo=None,
1087
        repo_branch=None,
1088
        tree_locked=False,
1089
        branch_locked=False, repo_locked=False,
1090
        verbose=False,
1091
        light_checkout=True):
1092
        """Check the output of info in a light checkout tree.
1093
1094
        This is not quite a mirror of the info code: rather than using the
1095
        tree being examined to predict output, it uses a bunch of flags which
1096
        allow us, the test writers, to document what *should* be present in
1097
        the output. Removing this separation would remove the value of the
1098
        tests.
1099
        
1100
        :param path: the path to the light checkout.
1101
        :param lco_tree: the tree object for the light checkout.
1102
        :param shared_repo: A shared repository is in use, expect that in
1103
            the output.
1104
        :param repo_branch: A branch in a shared repository for non light
1105
            checkouts.
1106
        :param tree_locked: If true, expect the tree to be locked.
1107
        :param branch_locked: If true, expect the branch to be locked.
1108
        :param repo_locked: If true, expect the repository to be locked.
1109
        :param verbose: If true, expect verbose output
1110
        """
1111
        out, err = self.runbzr('info %s' % command_string)
1112
        if repo_locked or branch_locked or tree_locked:
1113
            def locked_message(a_bool):
1114
                if a_bool:
1115
                    return 'locked'
1116
                else:
1117
                    return 'unlocked'
1118
            expected_lock_output = (
1119
                "\n"
1120
                "Lock status:\n"
1121
                "  working tree: %s\n"
1122
                "        branch: %s\n"
1123
                "    repository: %s\n" % (
1124
                    locked_message(tree_locked),
1125
                    locked_message(branch_locked),
1126
                    locked_message(repo_locked)))
1127
        else:
1128
            expected_lock_output = ''
1129
        if light_checkout:
1130
            tree_data = (" light checkout root: %s" %
1131
                lco_tree.bzrdir.root_transport.base)
1132
        else:
1133
            tree_data = ("       checkout root: %s" %
1134
                lco_tree.bzrdir.root_transport.base)
1135
        if shared_repo is not None:
1136
            branch_data = (
1137
                "   shared repository: %s\n"
1138
                "   repository branch: branch\n" %
1139
                shared_repo.bzrdir.root_transport.base)
1140
        elif repo_branch is not None:
1141
            branch_data = (
1142
                "  checkout of branch: %s\n" % 
1143
                repo_branch.bzrdir.root_transport.base)
1144
        else:
1145
            branch_data = ("  checkout of branch: %s\n" % 
1146
                lco_tree.branch.bzrdir.root_transport.base)
1147
        
1148
        if verbose:
1149
            verbose_info = '         0 committers\n'
1150
        else:
1151
            verbose_info = ''
1152
            
1153
        self.assertEqualDiff(
1154
"""Location:
1155
%s
1156
%s
1157
Format:
1158
       control: Meta directory format 1
1159
  working tree: %s
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1160
        branch: %s
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1161
    repository: %s
1162
%s
1163
In the working tree:
1164
         0 unchanged
1165
         0 modified
1166
         0 added
1167
         0 removed
1168
         0 renamed
1169
         0 unknown
1170
         0 ignored
1171
         0 versioned subdirectories
1172
1173
Branch history:
1174
         0 revisions
1175
%s
1176
Revision store:
1177
         0 revisions
1178
         0 KiB
1179
""" %  (tree_data,
1180
        branch_data,
1181
        lco_tree._format.get_format_description(),
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1182
        lco_tree.branch._format.get_format_description(),
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1183
        lco_tree.branch.repository._format.get_format_description(),
1184
        expected_lock_output,
1185
        verbose_info,
1186
        ), out)
1187
        self.assertEqual('', err)
1188
1694.2.6 by Martin Pool
[merge] bzr.dev
1189
    def test_info_locking(self):
1190
        transport = self.get_transport()
1191
        # Create shared repository with a branch
1192
        repo = self.make_repository('repo', shared=True,
1193
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1194
        repo.set_make_working_trees(False)
1195
        repo.bzrdir.root_transport.mkdir('branch')
1196
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1197
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1198
        # Do a heavy checkout
1199
        transport.mkdir('tree')
1200
        transport.mkdir('tree/checkout')
1201
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
1202
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
1694.2.6 by Martin Pool
[merge] bzr.dev
1203
        co_branch.bind(repo_branch)
1204
        # Do a light checkout of the heavy one
1205
        transport.mkdir('tree/lightcheckout')
1206
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1207
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1208
        lco_dir.create_workingtree()
1209
        lco_tree = lco_dir.open_workingtree()
1210
1211
        # Test all permutations of locking the working tree, branch and repository
1212
        # W B R
1213
1214
        # U U U
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1215
        self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1694.2.6 by Martin Pool
[merge] bzr.dev
1216
        # U U L
1217
        lco_tree.branch.repository.lock_write()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1218
        try:
1219
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1220
            lco_tree,
1221
            repo_locked=True)
1222
        finally:
1223
            lco_tree.branch.repository.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1224
        # U L L
1225
        lco_tree.branch.lock_write()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1226
        try:
1227
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1228
            lco_tree,
1229
            branch_locked=True,
1230
            repo_locked=True)
1231
        finally:
1232
            lco_tree.branch.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1233
        # L L L
1234
        lco_tree.lock_write()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1235
        try:
1236
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1237
            lco_tree,
1238
            tree_locked=True,
1239
            branch_locked=True,
1240
            repo_locked=True)
1241
        finally:
1242
            lco_tree.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1243
        # L L U
1244
        lco_tree.lock_write()
1245
        lco_tree.branch.repository.unlock()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1246
        try:
1247
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1248
            lco_tree,
1249
            tree_locked=True,
1250
            branch_locked=True)
1251
        finally:
1252
            lco_tree.branch.repository.lock_write()
1253
            lco_tree.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1254
        # L U U
1255
        lco_tree.lock_write()
1256
        lco_tree.branch.unlock()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1257
        try:
1258
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1259
            lco_tree,
1260
            tree_locked=True)
1261
        finally:
1262
            lco_tree.branch.lock_write()
1263
            lco_tree.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1264
        # L U L
1265
        lco_tree.lock_write()
1266
        lco_tree.branch.unlock()
1267
        lco_tree.branch.repository.lock_write()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1268
        try:
1269
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1270
            lco_tree,
1271
            tree_locked=True,
1272
            repo_locked=True)
1273
        finally:
1274
            lco_tree.branch.repository.unlock()
1275
            lco_tree.branch.lock_write()
1276
            lco_tree.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1277
        # U L U
1278
        lco_tree.branch.lock_write()
1279
        lco_tree.branch.repository.unlock()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1280
        try:
1281
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1282
            lco_tree,
1283
            branch_locked=True)
1284
        finally:
1285
            lco_tree.branch.repository.lock_write()
1286
            lco_tree.branch.unlock()
1694.2.6 by Martin Pool
[merge] bzr.dev
1287
1288
    def test_info_locking_oslocks(self):
1769.2.2 by Alexander Belchenko
Test blackbox.test_info.TestInfo.test_info_locking_oslocks skipped on win32
1289
        if sys.platform == "win32":
1290
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1291
1694.2.6 by Martin Pool
[merge] bzr.dev
1292
        tree = self.make_branch_and_tree('branch',
1293
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1294
1295
        # Test all permutations of locking the working tree, branch and repository
1296
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1297
        # implemented by raising NotImplementedError and get_physical_lock_status()
1298
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
1299
        # W B R
1300
1301
        # U U U
1302
        out, err = self.runbzr('info branch')
1303
        self.assertEqualDiff(
1304
"""Location:
1305
  branch root: %s
1306
1307
Format:
1308
       control: All-in-one format 6
1309
  working tree: Working tree format 2
1310
        branch: Branch format 4
1311
    repository: %s
1312
1313
In the working tree:
1314
         0 unchanged
1315
         0 modified
1316
         0 added
1317
         0 removed
1318
         0 renamed
1319
         0 unknown
1320
         0 ignored
1321
         0 versioned subdirectories
1322
1323
Branch history:
1324
         0 revisions
1325
1326
Revision store:
1327
         0 revisions
1328
         0 KiB
1329
""" % (tree.bzrdir.root_transport.base,
1330
       tree.branch.repository._format.get_format_description(),
1331
       ), out)
1332
        self.assertEqual('', err)
1333
        # L L L
1334
        tree.lock_write()
1335
        out, err = self.runbzr('info branch')
1336
        self.assertEqualDiff(
1337
"""Location:
1338
  branch root: %s
1339
1340
Format:
1341
       control: All-in-one format 6
1342
  working tree: Working tree format 2
1343
        branch: Branch format 4
1344
    repository: %s
1345
1346
In the working tree:
1347
         0 unchanged
1348
         0 modified
1349
         0 added
1350
         0 removed
1351
         0 renamed
1352
         0 unknown
1353
         0 ignored
1354
         0 versioned subdirectories
1355
1356
Branch history:
1357
         0 revisions
1358
1359
Revision store:
1360
         0 revisions
1361
         0 KiB
1362
""" % (tree.bzrdir.root_transport.base,
1363
       tree.branch.repository._format.get_format_description(),
1364
       ), out)
1365
        self.assertEqual('', err)
1366
        tree.unlock()