/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/smart/repository.py

  • Committer: Robert Collins
  • Date: 2009-03-27 04:10:25 UTC
  • mfrom: (4208 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4216.
  • Revision ID: robertc@robertcollins.net-20090327041025-rgutx4q03xo4pq6l
Resolve NEWS conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Server-side repository related request implmentations."""
18
18
 
134
134
        from revision_ids is returned. The verb takes a body containing the
135
135
        current search state, see do_body for details.
136
136
 
 
137
        If 'include-missing:' is in revision_ids, ghosts encountered in the
 
138
        graph traversal for getting parent data are included in the result with
 
139
        a prefix of 'missing:'.
 
140
 
137
141
        :param repository: The repository to query in.
138
142
        :param revision_ids: The utf8 encoded revision_id to answer for.
139
143
        """
158
162
    def _do_repository_request(self, body_bytes):
159
163
        repository = self._repository
160
164
        revision_ids = set(self._revision_ids)
 
165
        include_missing = 'include-missing:' in revision_ids
 
166
        if include_missing:
 
167
            revision_ids.remove('include-missing:')
161
168
        body_lines = body_bytes.split('\n')
162
169
        search_result, error = self.recreate_search_from_recipe(
163
170
            repository, body_lines)
178
185
        while next_revs:
179
186
            queried_revs.update(next_revs)
180
187
            parent_map = repo_graph.get_parent_map(next_revs)
 
188
            current_revs = next_revs
181
189
            next_revs = set()
182
 
            for revision_id, parents in parent_map.iteritems():
183
 
                # adjust for the wire
184
 
                if parents == (_mod_revision.NULL_REVISION,):
185
 
                    parents = ()
186
 
                # prepare the next query
187
 
                next_revs.update(parents)
188
 
                if revision_id not in client_seen_revs:
 
190
            for revision_id in current_revs:
 
191
                missing_rev = False
 
192
                parents = parent_map.get(revision_id)
 
193
                if parents is not None:
 
194
                    # adjust for the wire
 
195
                    if parents == (_mod_revision.NULL_REVISION,):
 
196
                        parents = ()
 
197
                    # prepare the next query
 
198
                    next_revs.update(parents)
 
199
                    encoded_id = revision_id
 
200
                else:
 
201
                    missing_rev = True
 
202
                    encoded_id = "missing:" + revision_id
 
203
                    parents = []
 
204
                if (revision_id not in client_seen_revs and
 
205
                    (not missing_rev or include_missing)):
189
206
                    # Client does not have this revision, give it to it.
190
207
                    # add parents to the result
191
 
                    result[revision_id] = parents
 
208
                    result[encoded_id] = parents
192
209
                    # Approximate the serialized cost of this revision_id.
193
 
                    size_so_far += 2 + len(revision_id) + sum(map(len, parents))
 
210
                    size_so_far += 2 + len(encoded_id) + sum(map(len, parents))
194
211
            # get all the directly asked for parents, and then flesh out to
195
212
            # 64K (compressed) or so. We do one level of depth at a time to
196
213
            # stay in sync with the client. The 250000 magic number is