~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-22 00:37:17 UTC
  • Revision ID: mbp@sourcefrog.net-20050322003717-7b1d4a370c237846
lift out tracefile creation code

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    print Branch('.').revno()
166
166
    
167
167
 
168
 
    
169
168
def cmd_add(file_list, verbose=False):
170
 
    """Add specified files or directories.
171
 
 
172
 
    In non-recursive mode, all the named items are added, regardless
173
 
    of whether they were previously ignored.  A warning is given if
174
 
    any of the named files are already versioned.
175
 
 
176
 
    In recursive mode (the default), files are treated the same way
177
 
    but the behaviour for directories is different.  Directories that
178
 
    are already versioned do not give a warning.  All directories,
179
 
    whether already versioned or not, are searched for files or
180
 
    subdirectories that are neither versioned or ignored, and these
181
 
    are added.  This search proceeds recursively into versioned
182
 
    directories.
183
 
 
184
 
    Therefore simply saying 'bzr add .' will version all files that
185
 
    are currently unknown.
 
169
    """Add specified files.
 
170
    
 
171
    Fails if the files are already added.
186
172
    """
187
 
    if True:
188
 
        bzrlib.add.smart_add(file_list, verbose)
189
 
    else:
190
 
        # old way
191
 
        assert file_list
192
 
        b = Branch(file_list[0], find_root=True)
193
 
        b.add([b.relpath(f) for f in file_list], verbose=verbose)
194
 
 
195
 
    
196
 
 
197
 
def cmd_relpath(filename):
198
 
    print Branch(filename).relpath(filename)
 
173
    Branch('.').add(file_list, verbose=verbose)
199
174
 
200
175
 
201
176
def cmd_inventory(revision=None):
268
243
 
269
244
 
270
245
def cmd_remove(file_list, verbose=False):
271
 
    b = Branch(file_list[0])
272
 
    b.remove([b.relpath(f) for f in file_list], verbose=verbose)
 
246
    Branch('.').remove(file_list, verbose=verbose)
273
247
 
274
248
 
275
249
 
276
250
def cmd_file_id(filename):
277
 
    b = Branch(filename)
278
 
    i = b.inventory.path2id(b.relpath(filename))
 
251
    i = Branch('.').read_working_inventory().path2id(filename)
279
252
    if i is None:
280
253
        bailout("%s is not a versioned file" % filename)
281
254
    else:
395
368
 
396
369
 
397
370
 
398
 
def cmd_root(filename=None):
399
 
    """Print the branch root."""
400
 
    print bzrlib.branch.find_branch_root(filename)
401
 
    
402
 
 
403
371
def cmd_log(timezone='original'):
404
372
    """Show log of this branch.
405
373
 
466
434
 
467
435
def cmd_uuid():
468
436
    """Print a newly-generated UUID."""
469
 
    print bzrlib.osutils.uuid()
 
437
    print uuid()
470
438
 
471
439
 
472
440
 
527
495
    bzrlib.trace.verbose = False
528
496
 
529
497
    for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \
530
 
        bzrlib.tree, bzrlib.tests, bzrlib.commands, bzrlib.add:
 
498
        bzrlib.tree, bzrlib.tests, bzrlib.commands:
531
499
        mf, mt = doctest.testmod(m)
532
500
        failures += mf
533
501
        tests += mt
619
587
    'commit':                 [],
620
588
    'diff':                   [],
621
589
    'file-id':                ['filename'],
622
 
    'root':                   ['filename?'],
623
 
    'relpath':                ['filename'],
624
590
    'get-file-text':          ['text_id'],
625
591
    'get-inventory':          ['inventory_id'],
626
592
    'get-revision':           ['revision_id'],
715
681
    # TODO: Need a way to express 'cp SRC... DEST', where it matches
716
682
    # all but one.
717
683
 
718
 
    # step through args and argform, allowing appropriate 0-many matches
719
684
    for ap in argform:
720
685
        argname = ap[:-1]
721
686
        if ap[-1] == '?':
722
 
            if args:
723
 
                argdict[argname] = args.pop(0)
 
687
            assert 0
724
688
        elif ap[-1] == '*':
725
689
            assert 0
726
690
        elif ap[-1] == '+':