~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Ian Clatworthy
  • Date: 2009-07-17 01:06:24 UTC
  • mto: (5575.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5576.
  • Revision ID: ian.clatworthy@canonical.com-20090717010624-lbzng1crcu6smhno
for a repo, just do dependent branches (not lw checkouts) for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
 
179
179
    See smart_upgrade for parameter details.
180
180
    """
181
 
    # If the URL is a shared repository, find the dependent branches & trees
 
181
    # If the URL is a shared repository, find the dependent branches
182
182
    dependents = None
183
183
    try:
184
184
        repo = control_dir.open_repository()
187
187
        pass
188
188
    else:
189
189
        # The URL is a repository. If it successfully upgrades,
190
 
        # then upgrade the dependent branches and trees as well.
 
190
        # then upgrade the dependent branches as well.
191
191
        if repo.is_shared():
192
 
            dependents = _find_repo_dependents(repo)
 
192
            dependents = repo.find_branches()
193
193
 
194
194
    # Do the conversions
195
195
    attempted = [control_dir]
196
196
    succeeded, exceptions = _convert_items([control_dir], format, clean_up,
197
197
        pack, dry_run, verbose=dependents)
198
198
    if succeeded and dependents:
199
 
        branches, trees = dependents
200
 
        note("Found %d dependents: %d branches, %d trees - upgrading ...",
201
 
            len(dependents), len(branches), len(trees))
 
199
        note("Found %d dependent branches - upgrading ...", len(dependents))
202
200
 
203
201
        # Convert dependent branches
204
 
        branch_cdirs = [b.bzrdir for b in branches]
 
202
        branch_cdirs = [b.bzrdir for b in dependents]
205
203
        successes, problems = _convert_items(branch_cdirs, format, clean_up,
206
204
            pack, dry_run, label="branch")
207
205
        attempted.extend(branch_cdirs)
208
206
        succeeded.extend(successes)
209
207
        exceptions.extend(problems)
210
208
 
211
 
        # Convert dependent trees
212
 
        # TODO: Filter trees so that we don't attempt to convert trees
213
 
        # referring to branches that failed.
214
 
        tree_cdirs = [t.bzrdir for t in trees]
215
 
        successes, problems = _convert_items(tree_cdirs, format, clean_up,
216
 
            pack, dry_run, label="tree")
217
 
        attempted.extend(tree_cdirs)
218
 
        succeeded.extend(successes)
219
 
        exceptions.extend(problems)
220
 
 
221
209
    # Return the result
222
210
    return attempted, succeeded, exceptions
223
211
 
283
271
    mutter(msg)
284
272
    if verbose:
285
273
        warning(msg)
286
 
 
287
 
 
288
 
# TODO: move this helper method into repository.py once it supports trees ...
289
 
def _find_repo_dependents(repo):
290
 
    """Find the branches using a shared repository and trees using the branches.
291
 
 
292
 
    :return: (branches, trees) or None if none.
293
 
    """
294
 
    # TODO: find trees (lightweight checkouts), not just branches
295
 
    branches = repo.find_branches()
296
 
    if branches:
297
 
        return (branches, [])
298
 
    else:
299
 
        return None