~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to baz_import.py

  • Committer: Robert Collins
  • Date: 2005-09-13 14:05:23 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050913140522-a4153d7e0034883e
make feedback be callback based

Show diffs side-by-side

added added

removed removed

Lines of Context:
578
578
    takes_args = ['to_root_dir', 'from_archive']
579
579
    takes_options = ['verbose']
580
580
 
 
581
    def printer(self, name):
 
582
        print name
 
583
 
581
584
    def run(self, to_root_dir, from_archive, verbose=False):
582
585
        to_root = os.path.realpath(to_root_dir)
583
586
        if not os.path.exists(to_root):
584
587
            os.mkdir(to_root)
585
 
        import_archive(to_root, from_archive, verbose)
 
588
        import_archive(to_root, from_archive, verbose, self.printer)
586
589
 
587
 
def import_archive(to_root, from_archive, verbose):
 
590
def import_archive(to_root, from_archive, verbose, printer):
588
591
    for version in pybaz.Archive(from_archive).iter_versions():
589
592
        target = os.path.join(to_root, map_namespace(version))
 
593
        printer("importing %s into %s" % (version, target))
590
594
        os.makedirs(os.path.dirname(target))
591
595
        import_version(target, version)
592
596