~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to baz_import.py

  • Committer: Aaron Bentley
  • Date: 2005-11-10 15:17:49 UTC
  • mfrom: (278 bzrtools)
  • mto: (147.4.24 trunk)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: aaron.bentley@utoronto.ca-20051110151749-1c7d988327059acb
Merged the bzrtools mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
272
272
        # the current version is
273
273
        branch = Branch.open(output_dir)
274
274
        last_patch = get_last_revision(branch)
 
275
        if last_patch is None:
 
276
            raise NotPreviousImport(branch.base)
275
277
        if version is None:
276
278
            version = last_patch.version
277
279
    elif version is None:
374
376
        ancestors, old_revno = get_remaining_revisions(output_dir, version,
375
377
                                                       reuse_history_from)
376
378
    except NotBranchError, e:
377
 
        raise UserError("%s exists, but is not a bzr branch." % output_dir)
 
379
        raise NotPreviousImport(e.path)
378
380
    if old_revno is None and len(ancestors) == 0:
379
381
        print 'Version %s has no revisions.' % version
380
382
        return
450
452
        """
451
453
        BzrCommandError.__init__(self, message)
452
454
 
 
455
class NotPreviousImport(UserError):
 
456
    def __init__(self, path):
 
457
        UserError.__init__(self, "%s is not the location of a previous import."
 
458
                           % path)
 
459
 
 
460
 
453
461
def revision_id(arch_revision):
454
462
    """
455
463
    Generate a Bzr revision id from an Arch revision id.  'x' in the id
588
596
                missing_ancestor = None
589
597
            for merged_rev in direct_merges:
590
598
                branch.add_pending_merge(revision_id(merged_rev))
591
 
            branch.set_inventory(baz_inv)
 
599
            branch.working_tree().set_inventory(baz_inv)
592
600
            commitobj = Commit(reporter=ImportCommitReporter(pb))
593
601
            commitobj.commit(branch, log_message.decode('ascii', 'replace'), 
594
602
                             verbose=False, committer=log_creator,
697
705
        if reuse_history_list is None:
698
706
            reuse_history_list = []
699
707
        import_version(to_location, from_branch, self.printer, 
700
 
                       max_count=max_count, reuse_history_from=reuse_history_list)
 
708
                       max_count=max_count, 
 
709
                       reuse_history_from=reuse_history_list)
 
710
 
 
711
 
 
712
class NotInABranch(Exception):
 
713
    def __init__(self, path):
 
714
        Exception.__init__(self, "%s is not in a branch." % path)
 
715
        self.path = path
701
716
 
702
717
 
703
718
class cmd_baz_import(Command):