/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

merge robert, debugging

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
            file_ids_from=None):
343
343
        import bzrlib.add
344
344
 
 
345
        base_tree = None
345
346
        if file_ids_from is not None:
346
347
            try:
347
348
                base_tree, base_path = WorkingTree.open_containing(
357
358
            action = bzrlib.add.AddAction(to_file=self.outf,
358
359
                should_print=(not is_quiet()))
359
360
 
360
 
        added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
361
 
                                              action=action, save=not dry_run)
 
361
        if base_tree:
 
362
            base_tree.lock_read()
 
363
        try:
 
364
            added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
 
365
                action=action, save=not dry_run)
 
366
        finally:
 
367
            if base_tree is not None:
 
368
                base_tree.unlock()
362
369
        if len(ignored) > 0:
363
370
            if verbose:
364
371
                for glob in sorted(ignored.keys()):
977
984
    @display_command
978
985
    def run(self, dir=u'.'):
979
986
        tree = WorkingTree.open_containing(dir)[0]
980
 
        old_inv = tree.basis_tree().inventory
981
 
        new_inv = tree.read_working_inventory()
982
 
        renames = list(_mod_tree.find_renames(old_inv, new_inv))
983
 
        renames.sort()
984
 
        for old_name, new_name in renames:
985
 
            self.outf.write("%s => %s\n" % (old_name, new_name))
 
987
        tree.lock_read()
 
988
        try:
 
989
            new_inv = tree.inventory
 
990
            old_tree = tree.basis_tree()
 
991
            old_tree.lock_read()
 
992
            try:
 
993
                old_inv = old_tree.inventory
 
994
                renames = list(_mod_tree.find_renames(old_inv, new_inv))
 
995
                renames.sort()
 
996
                for old_name, new_name in renames:
 
997
                    self.outf.write("%s => %s\n" % (old_name, new_name))
 
998
            finally:
 
999
                old_tree.unlock()
 
1000
        finally:
 
1001
            tree.unlock()
986
1002
 
987
1003
 
988
1004
class cmd_update(Command):
1467
1483
    @display_command
1468
1484
    def run(self):
1469
1485
        wt = WorkingTree.open_containing(u'.')[0]
1470
 
        basis_inv = wt.basis_tree().inventory
1471
 
        inv = wt.inventory
1472
 
        for file_id in inv:
1473
 
            if file_id in basis_inv:
1474
 
                continue
1475
 
            if inv.is_root(file_id) and len(basis_inv) == 0:
1476
 
                continue
1477
 
            path = inv.id2path(file_id)
1478
 
            if not os.access(osutils.abspath(path), os.F_OK):
1479
 
                continue
1480
 
            self.outf.write(path + '\n')
 
1486
        wt.lock_read()
 
1487
        try:
 
1488
            basis = wt.basis_tree()
 
1489
            basis.lock_read()
 
1490
            try:
 
1491
                basis_inv = basis.inventory
 
1492
                inv = wt.inventory
 
1493
                for file_id in inv:
 
1494
                    if file_id in basis_inv:
 
1495
                        continue
 
1496
                    if inv.is_root(file_id) and len(basis_inv) == 0:
 
1497
                        continue
 
1498
                    path = inv.id2path(file_id)
 
1499
                    if not os.access(osutils.abspath(path), os.F_OK):
 
1500
                        continue
 
1501
                    self.outf.write(path + '\n')
 
1502
            finally:
 
1503
                basis.unlock()
 
1504
        finally:
 
1505
            wt.unlock()
1481
1506
 
1482
1507
 
1483
1508
class cmd_root(Command):