/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
1
# Copyright (C) 2006 by Canonical Ltd
2
# -*- coding: utf-8 -*-
3
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19
"""Tests for the info command of bzr."""
20
21
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
22
import bzrlib
23
24
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
25
from bzrlib.osutils import format_date
26
from bzrlib.tests import TestSkipped
27
from bzrlib.tests.blackbox import ExternalBase
28
29
30
class TestInfo(ExternalBase):
31
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
32
    def test_info_standalone(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
33
        transport = self.get_transport()
34
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
35
        # Create initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
36
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
37
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
38
        tree1 = self.make_branch_and_tree('standalone')
39
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
40
        self.build_tree(['standalone/a'])
41
        tree1.add('a')
42
        branch1 = tree1.branch
43
        out, err = self.runbzr('info standalone')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
44
        self.assertEqualDiff(
45
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
46
         branch root: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
47
48
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
49
       control: All-in-one format 6
50
  working tree: Working tree format 2
51
        branch: Branch format 4
52
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
53
54
In the working tree:
55
         0 unchanged
56
         0 modified
57
         1 added
58
         0 removed
59
         0 renamed
60
         0 unknown
61
         0 ignored
62
         0 versioned subdirectories
63
64
Branch history:
65
         0 revisions
66
67
Revision store:
68
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
69
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
70
""" % branch1.bzrdir.root_transport.base, out)
71
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
72
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
73
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
74
        datestring_first = format_date(rev.timestamp, rev.timezone)
75
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
76
        # Branch standalone with push location
77
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
78
        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
79
        out, err = self.runbzr('info branch --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
80
        self.assertEqualDiff(
81
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
82
         branch root: %s
83
       parent branch: %s
84
      push to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
85
86
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
87
       control: All-in-one format 6
88
  working tree: Working tree format 2
89
        branch: Branch format 4
90
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
91
92
In the working tree:
93
         1 unchanged
94
         0 modified
95
         0 added
96
         0 removed
97
         0 renamed
98
         0 unknown
99
         0 ignored
100
         0 versioned subdirectories
101
102
Branch history:
103
         1 revision
104
         1 committer
105
         0 days old
106
   first revision: %s
107
  latest revision: %s
108
109
Revision store:
110
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
111
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
112
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
113
       branch1.bzrdir.root_transport.base,
114
       datestring_first, datestring_first), out)
115
        self.assertEqual('', err)
116
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
117
        # Branch and bind to standalone, needs upgrade to metadir
118
        # (creates backup as unknown)
119
        # XXX: I can't get this to work through API
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
120
        self.runbzr('branch standalone bound')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
121
        #branch3 = branch1.bzrdir.sprout('bound').open_branch()
122
        self.runbzr('upgrade --format=metadir bound')
123
        #bzrlib.upgrade.upgrade('bound', 'metadir')
124
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
125
        branch3.bind(branch1)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
126
        out, err = self.runbzr('info bound')
127
        self.assertEqualDiff(
128
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
129
         branch root: %s
130
     bound to branch: %s
131
       parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
132
133
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
134
       control: Meta directory format 1
135
  working tree: Working tree format 3
136
        branch: Branch format 5
137
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
138
139
In the working tree:
140
         1 unchanged
141
         0 modified
142
         0 added
143
         0 removed
144
         0 renamed
145
         1 unknown
146
         0 ignored
147
         0 versioned subdirectories
148
149
Branch history:
150
         1 revision
151
         0 days old
152
   first revision: %s
153
  latest revision: %s
154
155
Revision store:
156
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
157
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
158
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
159
       branch1.bzrdir.root_transport.base,
160
       datestring_first, datestring_first), out)
161
        self.assertEqual('', err)
162
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
163
        # Checkout standalone (same as above, but does not have parent set)
164
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
165
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
166
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
167
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
168
        branch4.bind(branch1)
169
        branch4.bzrdir.open_workingtree().update()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
170
        out, err = self.runbzr('info checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
171
        self.assertEqualDiff(
172
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
173
         branch root: %s
174
     bound to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
175
176
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
177
       control: Meta directory format 1
178
  working tree: Working tree format 3
179
        branch: Branch format 5
180
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
181
182
In the working tree:
183
         1 unchanged
184
         0 modified
185
         0 added
186
         0 removed
187
         0 renamed
188
         0 unknown
189
         0 ignored
190
         0 versioned subdirectories
191
192
Branch history:
193
         1 revision
194
         1 committer
195
         0 days old
196
   first revision: %s
197
  latest revision: %s
198
199
Revision store:
200
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
201
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
202
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
203
       datestring_first, datestring_first), out)
204
        self.assertEqual('', err)
205
206
        # Lightweight checkout (same as above, different branch and repository)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
207
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
208
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
209
        transport.mkdir('lightcheckout')
210
        dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
211
        bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
212
        dir5.create_workingtree()
213
        tree5 = dir5.open_workingtree()
214
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
215
        branch5 = tree5.branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
216
        out, err = self.runbzr('info lightcheckout')
217
        self.assertEqualDiff(
218
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
219
       checkout root: %s
220
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
221
222
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
223
       control: Meta directory format 1
224
  working tree: Working tree format 3
225
        branch: Branch format 4
226
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
227
228
In the working tree:
229
         1 unchanged
230
         0 modified
231
         0 added
232
         0 removed
233
         0 renamed
234
         0 unknown
235
         0 ignored
236
         0 versioned subdirectories
237
238
Branch history:
239
         1 revision
240
         0 days old
241
   first revision: %s
242
  latest revision: %s
243
244
Revision store:
245
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
246
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
247
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
248
       datestring_first, datestring_first), out)
249
        self.assertEqual('', err)
250
251
        # Update initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
252
        self.build_tree(['standalone/b'])
253
        tree1.add('b')
254
        tree1.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
255
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
256
        datestring_last = format_date(rev.timestamp, rev.timezone)
257
258
        # Out of date branched standalone branch will not be detected
259
        out, err = self.runbzr('info branch')
260
        self.assertEqualDiff(
261
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
262
         branch root: %s
263
       parent branch: %s
264
      push to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
265
266
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
267
       control: All-in-one format 6
268
  working tree: Working tree format 2
269
        branch: Branch format 4
270
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
271
272
In the working tree:
273
         1 unchanged
274
         0 modified
275
         0 added
276
         0 removed
277
         0 renamed
278
         0 unknown
279
         0 ignored
280
         0 versioned subdirectories
281
282
Branch history:
283
         1 revision
284
         0 days old
285
   first revision: %s
286
  latest revision: %s
287
288
Revision store:
289
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
290
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
291
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
292
       branch1.bzrdir.root_transport.base,
293
       datestring_first, datestring_first), out)
294
        self.assertEqual('', err)
295
296
        # Out of date bound branch
297
        out, err = self.runbzr('info bound')
298
        self.assertEqualDiff(
299
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
300
         branch root: %s
301
     bound to branch: %s
302
       parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
303
304
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
305
       control: Meta directory format 1
306
  working tree: Working tree format 3
307
        branch: Branch format 5
308
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
309
310
Branch is out of date: missing 1 revision.
311
312
In the working tree:
313
         1 unchanged
314
         0 modified
315
         0 added
316
         0 removed
317
         0 renamed
318
         1 unknown
319
         0 ignored
320
         0 versioned subdirectories
321
322
Branch history:
323
         1 revision
324
         0 days old
325
   first revision: %s
326
  latest revision: %s
327
328
Revision store:
329
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
330
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
331
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
332
       branch1.bzrdir.root_transport.base,
333
       datestring_first, datestring_first), out)
334
        self.assertEqual('', err)
335
336
        # Out of date checkout
337
        out, err = self.runbzr('info checkout')
338
        self.assertEqualDiff(
339
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
340
         branch root: %s
341
     bound to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
342
343
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
344
       control: Meta directory format 1
345
  working tree: Working tree format 3
346
        branch: Branch format 5
347
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
348
349
Branch is out of date: missing 1 revision.
350
351
In the working tree:
352
         1 unchanged
353
         0 modified
354
         0 added
355
         0 removed
356
         0 renamed
357
         0 unknown
358
         0 ignored
359
         0 versioned subdirectories
360
361
Branch history:
362
         1 revision
363
         0 days old
364
   first revision: %s
365
  latest revision: %s
366
367
Revision store:
368
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
369
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
370
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
371
       datestring_first, datestring_first), out)
372
        self.assertEqual('', err)
373
374
        # Out of date lightweight checkout
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
375
        out, err = self.runbzr('info lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
376
        self.assertEqualDiff(
377
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
378
       checkout root: %s
379
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
380
381
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
382
       control: Meta directory format 1
383
  working tree: Working tree format 3
384
        branch: Branch format 4
385
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
386
387
Working tree is out of date: missing 1 revision.
388
389
In the working tree:
390
         1 unchanged
391
         0 modified
392
         0 added
393
         0 removed
394
         0 renamed
395
         0 unknown
396
         0 ignored
397
         0 versioned subdirectories
398
399
Branch history:
400
         2 revisions
401
         1 committer
402
         0 days old
403
   first revision: %s
404
  latest revision: %s
405
406
Revision store:
407
         2 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
408
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
409
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
410
       datestring_first, datestring_last), out)
411
        self.assertEqual('', err)
412
413
    def test_info_shared_repository(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
414
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
415
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
416
        transport = self.get_transport()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
417
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
418
        # Create shared repository
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
419
        repo = self.make_repository('repo', shared=True)
420
        repo.set_make_working_trees(False)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
421
        out, err = self.runbzr('info repo')
422
        self.assertEqualDiff(
423
"""Location:
424
   shared repository: %s
425
426
Format:
427
       control: Meta directory format 1
428
    repository: Weave repository format 7
429
430
Revision store:
431
         0 revisions
432
         0 KiB
433
""" % repo.bzrdir.root_transport.base, out)
434
        self.assertEqual('', err)
435
436
        # Create branch inside shared repository
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
437
        repo.bzrdir.root_transport.mkdir('branch')
438
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
439
        out, err = self.runbzr('info repo/branch')
440
        self.assertEqualDiff(
441
"""Location:
442
         branch root: %s
443
   shared repository: %s
444
445
Format:
446
       control: Meta directory format 1
447
        branch: Branch format 5
448
    repository: Weave repository format 7
449
450
Branch history:
451
         0 revisions
452
453
Revision store:
454
         0 revisions
455
         0 KiB
456
""" % (branch1.bzrdir.root_transport.base,
457
       repo.bzrdir.root_transport.base), out)
458
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
459
460
        # Create lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
461
        transport.mkdir('tree')
462
        transport.mkdir('tree/lightcheckout')
463
        dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
464
        bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
465
        dir2.create_workingtree()
466
        tree2 = dir2.open_workingtree()
467
        branch2 = tree2.branch
468
        out, err = self.runbzr('info tree/lightcheckout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
469
        self.assertEqualDiff(
470
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
471
       checkout root: %s
472
  checkout of branch: %s
473
   shared repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
474
475
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
476
       control: Meta directory format 1
477
  working tree: Working tree format 3
478
        branch: Branch format 5
479
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
480
481
In the working tree:
482
         0 unchanged
483
         0 modified
484
         0 added
485
         0 removed
486
         0 renamed
487
         0 unknown
488
         0 ignored
489
         0 versioned subdirectories
490
491
Branch history:
492
         0 revisions
493
494
Revision store:
495
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
496
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
497
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
498
       branch1.bzrdir.root_transport.base,
499
       repo.bzrdir.root_transport.base), out)
500
        self.assertEqual('', err)
501
502
        # Create normal checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
503
        branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
504
        branch3.bind(branch1)
505
        tree3 = branch3.bzrdir.open_workingtree()
506
        tree3.update()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
507
        out, err = self.runbzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
508
        self.assertEqualDiff(
509
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
510
         branch root: %s
511
     bound to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
512
513
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
514
       control: Meta directory format 1
515
  working tree: Working tree format 3
516
        branch: Branch format 5
517
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
518
519
In the working tree:
520
         0 unchanged
521
         0 modified
522
         0 added
523
         0 removed
524
         0 renamed
525
         0 unknown
526
         0 ignored
527
         0 versioned subdirectories
528
529
Branch history:
530
         0 revisions
531
         0 committers
532
533
Revision store:
534
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
535
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
536
""" % (branch3.bzrdir.root_transport.base,
537
       branch1.bzrdir.root_transport.base), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
538
        self.assertEqual('', err)
539
540
        # Update lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
541
        self.build_tree(['tree/lightcheckout/a'])
542
        tree2.add('a')
543
        tree2.commit('commit one')
544
        rev = repo.get_revision(branch2.revision_history()[0])
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
545
        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
546
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
547
        self.assertEqualDiff(
548
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
549
       checkout root: %s
550
  checkout of branch: %s
551
   shared repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
552
553
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
554
       control: Meta directory format 1
555
  working tree: Working tree format 3
556
        branch: Branch format 5
557
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
558
559
In the working tree:
560
         1 unchanged
561
         0 modified
562
         0 added
563
         0 removed
564
         0 renamed
565
         0 unknown
566
         0 ignored
567
         0 versioned subdirectories
568
569
Branch history:
570
         1 revision
571
         1 committer
572
         0 days old
573
   first revision: %s
574
  latest revision: %s
575
576
Revision store:
577
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
578
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
579
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
580
       branch1.bzrdir.root_transport.base,
581
       repo.bzrdir.root_transport.base,
582
       datestring_first, datestring_first), out)
583
        self.assertEqual('', err)
584
585
        # Out of date checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
586
        out, err = self.runbzr('info tree/checkout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
587
        self.assertEqualDiff(
588
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
589
         branch root: %s
590
     bound to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
591
592
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
593
       control: Meta directory format 1
594
  working tree: Working tree format 3
595
        branch: Branch format 5
596
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
597
598
Branch is out of date: missing 1 revision.
599
600
In the working tree:
601
         0 unchanged
602
         0 modified
603
         0 added
604
         0 removed
605
         0 renamed
606
         0 unknown
607
         0 ignored
608
         0 versioned subdirectories
609
610
Branch history:
611
         0 revisions
612
613
Revision store:
614
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
615
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
616
""" % (tree3.bzrdir.root_transport.base,
617
       branch1.bzrdir.root_transport.base), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
618
        self.assertEqual('', err)
619
620
        # Update checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
621
        tree3.update()
622
        self.build_tree(['tree/checkout/b'])
623
        tree3.add('b')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
624
        out, err = self.runbzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
625
        self.assertEqualDiff(
626
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
627
         branch root: %s
628
     bound to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
629
630
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
631
       control: Meta directory format 1
632
  working tree: Working tree format 3
633
        branch: Branch format 5
634
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
635
636
In the working tree:
637
         1 unchanged
638
         0 modified
639
         1 added
640
         0 removed
641
         0 renamed
642
         0 unknown
643
         0 ignored
644
         0 versioned subdirectories
645
646
Branch history:
647
         1 revision
648
         1 committer
649
         0 days old
650
   first revision: %s
651
  latest revision: %s
652
653
Revision store:
654
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
655
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
656
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
657
       datestring_first, datestring_first), out)
658
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
659
        tree3.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
660
661
        # Out of date lightweight checkout
1624.3.12 by Olaf Conradi
Fixed bug in test case where datestring_last returned the first.
662
        rev = repo.get_revision(branch1.revision_history()[-1])
663
        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
664
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
665
        self.assertEqualDiff(
666
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
667
       checkout root: %s
668
  checkout of branch: %s
669
   shared repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
670
671
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
672
       control: Meta directory format 1
673
  working tree: Working tree format 3
674
        branch: Branch format 5
675
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
676
677
Working tree is out of date: missing 1 revision.
678
679
In the working tree:
680
         1 unchanged
681
         0 modified
682
         0 added
683
         0 removed
684
         0 renamed
685
         0 unknown
686
         0 ignored
687
         0 versioned subdirectories
688
689
Branch history:
690
         2 revisions
691
         1 committer
692
         0 days old
693
   first revision: %s
694
  latest revision: %s
695
696
Revision store:
697
         2 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
698
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
699
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
700
       branch1.bzrdir.root_transport.base,
701
       repo.bzrdir.root_transport.base,
702
       datestring_first, datestring_last), out)
703
        self.assertEqual('', err)
704
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
705
        # Show info about shared branch
706
        out, err = self.runbzr('info repo/branch --verbose')
707
        self.assertEqualDiff(
708
"""Location:
709
         branch root: %s
710
   shared repository: %s
711
712
Format:
713
       control: Meta directory format 1
714
        branch: Branch format 5
715
    repository: Weave repository format 7
716
717
Branch history:
718
         2 revisions
719
         1 committer
720
         0 days old
721
   first revision: %s
722
  latest revision: %s
723
724
Revision store:
725
         2 revisions
726
         0 KiB
727
""" % (branch1.bzrdir.root_transport.base,
728
       repo.bzrdir.root_transport.base,
729
       datestring_first, datestring_last), out)
730
        self.assertEqual('', err)
731
732
        # Show info about repository with revisions
733
        out, err = self.runbzr('info repo')
734
        self.assertEqualDiff(
735
"""Location:
736
   shared repository: %s
737
738
Format:
739
       control: Meta directory format 1
740
    repository: Weave repository format 7
741
742
Revision store:
743
         2 revisions
744
         0 KiB
745
""" % repo.bzrdir.root_transport.base, out)
746
        self.assertEqual('', err)
747
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
748
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
749
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
750
    def test_info_shared_repository_with_trees(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
751
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
752
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
753
        transport = self.get_transport()
754
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
755
        # Create shared repository with working trees
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
756
        repo = self.make_repository('repo', shared=True)
757
        repo.set_make_working_trees(True)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
758
        out, err = self.runbzr('info repo')
759
        self.assertEqualDiff(
760
"""Location:
761
   shared repository: %s
762
763
Format:
764
       control: Meta directory format 1
765
    repository: Weave repository format 7
766
767
Create working tree for new branches inside the repository.
768
769
Revision store:
770
         0 revisions
771
         0 KiB
772
""" % repo.bzrdir.root_transport.base, out)
773
        self.assertEqual('', err)
774
775
        # Create two branches
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
776
        repo.bzrdir.root_transport.mkdir('branch1')
777
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
778
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
779
780
        # Empty first branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
781
        out, err = self.runbzr('info repo/branch1 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
782
        self.assertEqualDiff(
783
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
784
         branch root: %s
785
   shared repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
786
787
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
788
       control: Meta directory format 1
789
  working tree: Working tree format 3
790
        branch: Branch format 5
791
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
792
793
In the working tree:
794
         0 unchanged
795
         0 modified
796
         0 added
797
         0 removed
798
         0 renamed
799
         0 unknown
800
         0 ignored
801
         0 versioned subdirectories
802
803
Branch history:
804
         0 revisions
805
         0 committers
806
807
Revision store:
808
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
809
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
810
""" % (branch1.bzrdir.root_transport.base,
811
       repo.bzrdir.root_transport.base), out)
812
        self.assertEqual('', err)
813
814
        # Update first branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
815
        self.build_tree(['repo/branch1/a'])
816
        tree1 = branch1.bzrdir.open_workingtree()
817
        tree1.add('a')
818
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
819
        rev = repo.get_revision(branch1.revision_history()[0])
820
        datestring_first = format_date(rev.timestamp, rev.timezone)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
821
        out, err = self.runbzr('info repo/branch1')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
822
        self.assertEqualDiff(
823
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
824
         branch root: %s
825
   shared repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
826
827
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
828
       control: Meta directory format 1
829
  working tree: Working tree format 3
830
        branch: Branch format 5
831
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
832
833
In the working tree:
834
         1 unchanged
835
         0 modified
836
         0 added
837
         0 removed
838
         0 renamed
839
         0 unknown
840
         0 ignored
841
         0 versioned subdirectories
842
843
Branch history:
844
         1 revision
845
         0 days old
846
   first revision: %s
847
  latest revision: %s
848
849
Revision store:
850
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
851
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
852
""" % (branch1.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
853
       datestring_first, datestring_first), out)
854
        self.assertEqual('', err)
855
856
        # Out of date second branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
857
        out, err = self.runbzr('info repo/branch2 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
858
        self.assertEqualDiff(
859
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
860
         branch root: %s
861
   shared repository: %s
862
       parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
863
864
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
865
       control: Meta directory format 1
866
  working tree: Working tree format 3
867
        branch: Branch format 5
868
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
869
870
In the working tree:
871
         0 unchanged
872
         0 modified
873
         0 added
874
         0 removed
875
         0 renamed
876
         0 unknown
877
         0 ignored
878
         0 versioned subdirectories
879
880
Branch history:
881
         0 revisions
882
         0 committers
883
884
Revision store:
885
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
886
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
887
""" % (branch2.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
888
       branch1.bzrdir.root_transport.base), out)
889
        self.assertEqual('', err)
890
891
        # Update second branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
892
        tree2 = branch2.bzrdir.open_workingtree()
893
        tree2.pull(branch1)
894
        out, err = self.runbzr('info repo/branch2')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
895
        self.assertEqualDiff(
896
"""Location:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
897
         branch root: %s
898
   shared repository: %s
899
       parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
900
901
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
902
       control: Meta directory format 1
903
  working tree: Working tree format 3
904
        branch: Branch format 5
905
    repository: Weave repository format 7
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
906
907
In the working tree:
908
         1 unchanged
909
         0 modified
910
         0 added
911
         0 removed
912
         0 renamed
913
         0 unknown
914
         0 ignored
915
         0 versioned subdirectories
916
917
Branch history:
918
         1 revision
919
         0 days old
920
   first revision: %s
921
  latest revision: %s
922
923
Revision store:
924
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
925
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
926
""" % (branch2.bzrdir.root_transport.base,
927
       repo.bzrdir.root_transport.base,
928
       branch1.bzrdir.root_transport.base,
929
       datestring_first, datestring_first), out)
930
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
931
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
932
        # Show info about repository with revisions
933
        out, err = self.runbzr('info repo')
934
        self.assertEqualDiff(
935
"""Location:
936
   shared repository: %s
937
938
Format:
939
       control: Meta directory format 1
940
    repository: Weave repository format 7
941
942
Create working tree for new branches inside the repository.
943
944
Revision store:
945
         1 revision
946
         0 KiB
947
""" % repo.bzrdir.root_transport.base, out)
948
        self.assertEqual('', err)
949
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
950
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)