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

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    errors,
24
24
    merge,
25
25
    merge3,
 
26
    osutils,
26
27
    pack,
27
28
    transform,
 
29
    ui,
 
30
    workingtree,
28
31
)
29
32
 
30
33
 
34
37
    def __init__(self, work_tree, target_tree, file_list=None):
35
38
        """Constructor.
36
39
 
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.
 
40
        :param work_tree: The working tree to apply changes to
39
41
        :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.
41
42
        :param file_list: The files to make more similar to the target.
42
43
        """
43
44
        self.work_tree = work_tree
72
73
        """
73
74
        for (file_id, paths, changed, versioned, parents, names, kind,
74
75
             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
81
76
            if kind[0] is None or versioned[0] == False:
82
77
                self.creation[file_id] = (kind[1], names[1], parents[1],
83
78
                                          versioned)
101
96
                elif changed:
102
97
                    yield ('modify text', file_id)
103
98
 
104
 
    def shelve_change(self, change):
105
 
        """Shelve a change in the iter_shelvable format."""
106
 
        if change[0] == 'rename':
107
 
            self.shelve_rename(change[1])
108
 
        elif change[0] == 'delete file':
109
 
            self.shelve_deletion(change[1])
110
 
        elif change[0] == 'add file':
111
 
            self.shelve_creation(change[1])
112
 
        elif change[0] in ('change kind', 'modify text'):
113
 
            self.shelve_content_change(change[1])
114
 
        elif change[0] == 'modify target':
115
 
            self.shelve_modify_target(change[1])
116
 
        else:
117
 
            raise ValueError('Unknown change kind: "%s"' % change[0])
118
 
 
119
 
    def shelve_all(self):
120
 
        """Shelve all changes."""
121
 
        for change in self.iter_shelvable():
122
 
            self.shelve_change(change)
123
 
 
124
99
    def shelve_rename(self, file_id):
125
100
        """Shelve a file rename.
126
101