/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/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-02 11:37:38 UTC
  • mfrom: (4496.3.16 pyflakes-nits)
  • Revision ID: pqm@pqm.ubuntu.com-20090702113738-5qda6d3y80z4l3o5
(andrew) Fix some trivial bugs and unused/redundant imports reported
        by pyflakes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
import itertools
49
49
import operator
50
50
import stat
51
 
from time import time
52
 
import warnings
53
51
import re
54
52
 
55
53
import bzrlib
57
55
    branch,
58
56
    bzrdir,
59
57
    conflicts as _mod_conflicts,
60
 
    dirstate,
61
58
    errors,
62
59
    generate_ids,
63
60
    globbing,
64
61
    hashcache,
65
62
    ignores,
 
63
    inventory,
66
64
    merge,
67
65
    revision as _mod_revision,
68
66
    revisiontree,
69
 
    repository,
70
67
    textui,
71
68
    trace,
72
69
    transform,
73
70
    ui,
74
 
    urlutils,
75
71
    views,
76
72
    xml5,
77
 
    xml6,
78
73
    xml7,
79
74
    )
80
75
import bzrlib.branch
81
76
from bzrlib.transport import get_transport
82
 
import bzrlib.ui
83
77
from bzrlib.workingtree_4 import (
84
78
    WorkingTreeFormat4,
85
79
    WorkingTreeFormat5,
89
83
 
90
84
from bzrlib import symbol_versioning
91
85
from bzrlib.decorators import needs_read_lock, needs_write_lock
92
 
from bzrlib.inventory import InventoryEntry, Inventory, ROOT_ID, TreeReference
93
86
from bzrlib.lockable_files import LockableFiles
94
87
from bzrlib.lockdir import LockDir
95
88
import bzrlib.mutabletree
96
89
from bzrlib.mutabletree import needs_tree_write_lock
97
90
from bzrlib import osutils
98
91
from bzrlib.osutils import (
99
 
    compact_date,
100
92
    file_kind,
101
93
    isdir,
102
94
    normpath,
103
95
    pathjoin,
104
 
    rand_chars,
105
96
    realpath,
106
97
    safe_unicode,
107
98
    splitpath,
111
102
from bzrlib.trace import mutter, note
112
103
from bzrlib.transport.local import LocalTransport
113
104
from bzrlib.progress import DummyProgress, ProgressPhase
114
 
from bzrlib.revision import NULL_REVISION, CURRENT_REVISION
 
105
from bzrlib.revision import CURRENT_REVISION
115
106
from bzrlib.rio import RioReader, rio_file, Stanza
116
 
from bzrlib.symbol_versioning import (deprecated_passed,
117
 
        deprecated_method,
118
 
        deprecated_function,
119
 
        DEPRECATED_PARAMETER,
120
 
        )
 
107
from bzrlib.symbol_versioning import (
 
108
    deprecated_passed,
 
109
    DEPRECATED_PARAMETER,
 
110
    )
121
111
 
122
112
 
123
113
MERGE_MODIFIED_HEADER_1 = "BZR merge-modified list format 1"
889
879
            branch.last_revision().
890
880
        """
891
881
        from bzrlib.merge import Merger, Merge3Merger
892
 
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
882
        pb = ui.ui_factory.nested_progress_bar()
893
883
        try:
894
884
            merger = Merger(self.branch, this_tree=self, pb=pb)
895
885
            merger.pp = ProgressPhase("Merge phase", 5, pb)
1081
1071
            branch.BranchReferenceFormat().initialize(tree_bzrdir, new_branch)
1082
1072
        else:
1083
1073
            tree_bzrdir = branch_bzrdir
1084
 
        wt = tree_bzrdir.create_workingtree(NULL_REVISION)
 
1074
        wt = tree_bzrdir.create_workingtree(_mod_revision.NULL_REVISION)
1085
1075
        wt.set_parent_ids(self.get_parent_ids())
1086
1076
        my_inv = self.inventory
1087
 
        child_inv = Inventory(root_id=None)
 
1077
        child_inv = inventory.Inventory(root_id=None)
1088
1078
        new_root = my_inv[file_id]
1089
1079
        my_inv.remove_recursive_id(file_id)
1090
1080
        new_root.parent_id = None
1416
1406
        inv = self.inventory
1417
1407
        for entry in moved:
1418
1408
            try:
1419
 
                self._move_entry(_RenameEntry(entry.to_rel, entry.from_id,
 
1409
                self._move_entry(WorkingTree._RenameEntry(
 
1410
                    entry.to_rel, entry.from_id,
1420
1411
                    entry.to_tail, entry.to_parent_id, entry.from_rel,
1421
1412
                    entry.from_tail, entry.from_parent_id,
1422
1413
                    entry.only_change_inv))
1573
1564
    @needs_write_lock
1574
1565
    def pull(self, source, overwrite=False, stop_revision=None,
1575
1566
             change_reporter=None, possible_transports=None, local=False):
1576
 
        top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1567
        top_pb = ui.ui_factory.nested_progress_bar()
1577
1568
        source.lock_read()
1578
1569
        try:
1579
1570
            pp = ProgressPhase("Pull phase", 2, top_pb)
1587
1578
            if new_revision_info != old_revision_info:
1588
1579
                pp.next_phase()
1589
1580
                repository = self.branch.repository
1590
 
                pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1581
                pb = ui.ui_factory.nested_progress_bar()
1591
1582
                basis_tree.lock_read()
1592
1583
                try:
1593
1584
                    new_basis_tree = self.branch.basis_tree()
2042
2033
            if filenames is None and len(self.get_parent_ids()) > 1:
2043
2034
                parent_trees = []
2044
2035
                last_revision = self.last_revision()
2045
 
                if last_revision != NULL_REVISION:
 
2036
                if last_revision != _mod_revision.NULL_REVISION:
2046
2037
                    if basis_tree is None:
2047
2038
                        basis_tree = self.basis_tree()
2048
2039
                        basis_tree.lock_read()
2086
2077
    def set_inventory(self, new_inventory_list):
2087
2078
        from bzrlib.inventory import (Inventory,
2088
2079
                                      InventoryDirectory,
2089
 
                                      InventoryEntry,
2090
2080
                                      InventoryFile,
2091
2081
                                      InventoryLink)
2092
2082
        inv = Inventory(self.get_root_id())
2634
2624
 
2635
2625
    def _change_last_revision(self, revision_id):
2636
2626
        """See WorkingTree._change_last_revision."""
2637
 
        if revision_id is None or revision_id == NULL_REVISION:
 
2627
        if revision_id is None or revision_id == _mod_revision.NULL_REVISION:
2638
2628
            try:
2639
2629
                self._transport.delete('last-revision')
2640
2630
            except errors.NoSuchFile:
2804
2794
        no working tree.  (See bug #43064).
2805
2795
        """
2806
2796
        sio = StringIO()
2807
 
        inv = Inventory()
 
2797
        inv = inventory.Inventory()
2808
2798
        xml5.serializer_v5.write_inventory(inv, sio, working=True)
2809
2799
        sio.seek(0)
2810
2800
        transport.put_file('inventory', sio, file_mode)
2826
2816
            branch.generate_revision_history(revision_id)
2827
2817
        finally:
2828
2818
            branch.unlock()
2829
 
        inv = Inventory()
 
2819
        inv = inventory.Inventory()
2830
2820
        wt = WorkingTree2(a_bzrdir.root_transport.local_abspath('.'),
2831
2821
                         branch,
2832
2822
                         inv,
2949
2939
            # only set an explicit root id if there is one to set.
2950
2940
            if basis_tree.inventory.root is not None:
2951
2941
                wt.set_root_id(basis_tree.get_root_id())
2952
 
            if revision_id == NULL_REVISION:
 
2942
            if revision_id == _mod_revision.NULL_REVISION:
2953
2943
                wt.set_parent_trees([])
2954
2944
            else:
2955
2945
                wt.set_parent_trees([(revision_id, basis_tree)])
2962
2952
        return wt
2963
2953
 
2964
2954
    def _initial_inventory(self):
2965
 
        return Inventory()
 
2955
        return inventory.Inventory()
2966
2956
 
2967
2957
    def __init__(self):
2968
2958
        super(WorkingTreeFormat3, self).__init__()