~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    directory is shown.  Otherwise, only the status of the specified
63
63
    files or directories is reported.  If a directory is given, status
64
64
    is reported for everything inside that directory.
 
65
 
 
66
    If a revision is specified, the changes since that revision are shown.
65
67
    """
66
 
    # XXX: FIXME: bzr status should accept a -r option to show changes
67
 
    # relative to a revision, or between revisions
68
 
 
69
68
    takes_args = ['file*']
70
 
    takes_options = ['all', 'show-ids']
 
69
    takes_options = ['all', 'show-ids', 'revision']
71
70
    aliases = ['st', 'stat']
72
71
    
73
72
    def run(self, all=False, show_ids=False, file_list=None):
146
145
    Therefore simply saying 'bzr add' will version all files that
147
146
    are currently unknown.
148
147
 
149
 
    Adding a file whose parent directory is not versioned will
150
 
    implicitly add the parent, and so on up to the root. This means
151
 
    you should never need to explictly add a directory, they'll just
152
 
    get added when you add a file in the directory.
 
148
    TODO: Perhaps adding a file whose directly is not versioned should
 
149
    recursively add that parent, rather than giving an error?
153
150
    """
154
151
    takes_args = ['file*']
155
152
    takes_options = ['verbose', 'no-recurse']
277
274
            if len(names_list) != 2:
278
275
                raise BzrCommandError('to mv multiple files the destination '
279
276
                                      'must be a versioned directory')
280
 
            b.rename_one(rel_names[0], rel_names[1])
281
 
            print "%s => %s" % (rel_names[0], rel_names[1])
 
277
            for pair in b.move(rel_names[0], rel_names[1]):
 
278
                print "%s => %s" % pair
282
279
            
283
280
    
284
281
 
304
301
        import tempfile
305
302
        from shutil import rmtree
306
303
        import errno
 
304
        from bzrlib.branch import pull_loc
307
305
        
308
306
        br_to = find_branch('.')
309
 
        stored_loc = br_to.get_parent()
 
307
        stored_loc = None
 
308
        try:
 
309
            stored_loc = br_to.controlfile("x-pull", "rb").read().rstrip('\n')
 
310
        except IOError, e:
 
311
            if e.errno != errno.ENOENT:
 
312
                raise
310
313
        if location is None:
311
314
            if stored_loc is None:
312
315
                raise BzrCommandError("No pull location known or specified.")
316
319
        cache_root = tempfile.mkdtemp()
317
320
        from bzrlib.branch import DivergedBranches
318
321
        br_from = find_branch(location)
319
 
        location = br_from.base
 
322
        location = pull_loc(br_from)
320
323
        old_revno = br_to.revno()
321
324
        try:
322
325
            from branch import find_cached_branch, DivergedBranches
323
326
            br_from = find_cached_branch(location, cache_root)
324
 
            location = br_from.base
 
327
            location = pull_loc(br_from)
325
328
            old_revno = br_to.revno()
326
329
            try:
327
330
                br_to.update_revisions(br_from)
331
334
                
332
335
            merge(('.', -1), ('.', old_revno), check_clean=False)
333
336
            if location != stored_loc:
334
 
                br_to.set_parent(location)
 
337
                br_to.controlfile("x-pull", "wb").write(location + "\n")
335
338
        finally:
336
339
            rmtree(cache_root)
337
340
 
533
536
    examples:
534
537
        bzr diff
535
538
        bzr diff -r1
536
 
        bzr diff -r1..2
 
539
        bzr diff -r1:2
537
540
    """
538
541
    
539
542
    takes_args = ['file*']
633
636
    def run(self, filename=None):
634
637
        """Print the branch root."""
635
638
        b = find_branch(filename)
636
 
        print b.base
 
639
        print getattr(b, 'base', None) or getattr(b, 'baseurl')
637
640
 
638
641
 
639
642
class cmd_log(Command):
987
990
 
988
991
    This command checks various invariants about the branch storage to
989
992
    detect data corruption or bzr bugs.
 
993
 
 
994
    If given the --update flag, it will update some optional fields
 
995
    to help ensure data consistency.
990
996
    """
991
997
    takes_args = ['dir?']
992
998
 
1293
1299
                    print "Using last location: %s" % parent
1294
1300
                remote = parent
1295
1301
        elif parent is None:
1296
 
            # We only update parent if it did not exist, missing should not change the parent
1297
 
            b.set_parent(remote)
 
1302
            # We only update x-pull if it did not exist, missing should not change the parent
 
1303
            b.controlfile('x-pull', 'wb').write(remote + '\n')
1298
1304
        br_remote = find_branch(remote)
1299
1305
 
1300
1306
        return show_missing(b, br_remote, verbose=verbose, quiet=quiet)