~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-08-20 05:20:56 UTC
  • mfrom: (5380.3.3 doc)
  • Revision ID: pqm@pqm.ubuntu.com-20100820052056-gwad7dz2otckrjax
(mbp) Start whatsnew for 2.3; update ppa developer docs (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    errors,
24
24
    merge,
25
25
    merge3,
26
 
    osutils,
27
26
    pack,
28
27
    transform,
29
 
    ui,
30
 
    workingtree,
31
28
)
32
29
 
33
30
 
37
34
    def __init__(self, work_tree, target_tree, file_list=None):
38
35
        """Constructor.
39
36
 
40
 
        :param work_tree: The working tree to apply changes to
 
37
        :param work_tree: The working tree to apply changes to. This is not
 
38
            required to be locked - a tree_write lock will be taken out.
41
39
        :param target_tree: The tree to make the working tree more similar to.
 
40
            This is not required to be locked - a read_lock will be taken out.
42
41
        :param file_list: The files to make more similar to the target.
43
42
        """
44
43
        self.work_tree = work_tree
73
72
        """
74
73
        for (file_id, paths, changed, versioned, parents, names, kind,
75
74
             executable) in self.iter_changes:
 
75
            # don't shelve add of tree root.  Working tree should never
 
76
            # lack roots, and bzr misbehaves when they do.
 
77
            # FIXME ADHB (2009-08-09): should still shelve adds of tree roots
 
78
            # when a tree root was deleted / renamed.
 
79
            if kind[0] is None and names[1] == '':
 
80
                continue
76
81
            if kind[0] is None or versioned[0] == False:
77
82
                self.creation[file_id] = (kind[1], names[1], parents[1],
78
83
                                          versioned)
104
109
            self.shelve_deletion(change[1])
105
110
        elif change[0] == 'add file':
106
111
            self.shelve_creation(change[1])
107
 
        elif change[0] == 'change kind':
 
112
        elif change[0] in ('change kind', 'modify text'):
108
113
            self.shelve_content_change(change[1])
109
114
        elif change[0] == 'modify target':
110
115
            self.shelve_modify_target(change[1])
111
116
        else:
112
117
            raise ValueError('Unknown change kind: "%s"' % change[0])
113
118
 
 
119
    def shelve_all(self):
 
120
        """Shelve all changes."""
 
121
        for change in self.iter_shelvable():
 
122
            self.shelve_change(change)
 
123
 
114
124
    def shelve_rename(self, file_id):
115
125
        """Shelve a file rename.
116
126