def __init__(self, revision_recorder, stats_keeper): self.revision_recorder = revision_recorder self._cvs_item_store = NewCVSItemStore( artifact_manager.get_temp_file(config.CVS_ITEMS_STORE)) self.metadata_db = MetadataDatabase( artifact_manager.get_temp_file(config.METADATA_STORE), artifact_manager.get_temp_file(config.METADATA_INDEX_TABLE), DB_OPEN_NEW, ) self.metadata_logger = MetadataLogger(self.metadata_db) self.fatal_errors = [] self.num_files = 0 self.symbol_stats = SymbolStatisticsCollector() self.stats_keeper = stats_keeper # Key generator for CVSFiles: self.file_key_generator = KeyGenerator() # Key generator for CVSItems: self.item_key_generator = KeyGenerator() # Key generator for Symbols: self.symbol_key_generator = KeyGenerator() self.revision_recorder.start()
def __init__(self): # The revision number to assign to the next new SVNCommit. self.revnum_generator = KeyGenerator() # A set containing the Projects that have already been # initialized: self._initialized_projects = set()
def __init__(self, metadata_db): self._metadata_db = metadata_db # A map { digest : id }: self._digest_to_id = {} # A key_generator to generate keys for metadata that haven't been # seen yet: self.key_generator = KeyGenerator()
def __init__( self, dump_filename, revision_writer, max_merges=None, author_transforms=None, ): """Constructor. DUMP_FILENAME is the name of the file to which the git-fast-import commands for defining revisions should be written. (Please note that depending on the style of revision writer, the actual file contents might not be written to this file.) REVISION_WRITER is a GitRevisionWriter that is used to output either the content of revisions or a mark that was previously used to label a blob. MAX_MERGES can be set to an integer telling the maximum number of parents that can be merged into a commit at once (aside from the natural parent). If it is set to None, then there is no limit. AUTHOR_TRANSFORMS is a map {cvsauthor : (fullname, email)} from CVS author names to git full name and email address. All of the contents should either be Unicode strings or 8-bit strings encoded as UTF-8. """ self.dump_filename = dump_filename self.revision_writer = revision_writer self.max_merges = max_merges def to_utf8(s): if isinstance(s, unicode): return s.encode('utf8') else: return s self.author_transforms = {} if author_transforms is not None: for (cvsauthor, ( name, email, )) in author_transforms.iteritems(): cvsauthor = to_utf8(cvsauthor) name = to_utf8(name) email = to_utf8(email) self.author_transforms[cvsauthor] = ( name, email, ) self._mirror = RepositoryMirror() self._mark_generator = KeyGenerator(GitOutputOption._first_commit_mark)
def start(self): self.revision_reader.start() if self.blob_filename is None: self.dump_file = open( artifact_manager.get_temp_file(config.GIT_BLOB_DATAFILE), 'wb', ) else: self.dump_file = open(self.blob_filename, 'wb') self._mark_generator = KeyGenerator()
def start(self): self._mark_generator = KeyGenerator() logger.normal('Starting generate_blobs.py...') self._popen = subprocess.Popen( [ sys.executable, os.path.join(os.path.dirname(__file__), 'generate_blobs.py'), self.blob_filename, ], stdin=subprocess.PIPE, )
def start(self): self._mark_generator = KeyGenerator() logger.normal('Starting generate_blobs.py...') if self.blob_filename is None: blob_filename = artifact_manager.get_temp_file(config.GIT_BLOB_DATAFILE) else: blob_filename = self.blob_filename self._pipe = subprocess.Popen( [ sys.executable, os.path.join(os.path.dirname(__file__), 'generate_blobs.py'), blob_filename, ], stdin=subprocess.PIPE, )
def open(self): """Set up the RepositoryMirror and prepare it for commits.""" self._key_generator = KeyGenerator() # A map from LOD to LODHistory instance for all LODs that have # been referenced so far: self._lod_histories = {} # This corresponds to the 'nodes' table in a Subversion fs. (We # don't need a 'representations' or 'strings' table because we # only track file existence, not file contents.) self._node_db = _NodeDatabase() # Start at revision 0 without a root node. self._youngest = 0
def __init__( self, revision_writer, dump_filename=None, author_transforms=None, tie_tag_fixup_branches=False, ): """Constructor. REVISION_WRITER is a GitRevisionWriter that is used to output either the content of revisions or a mark that was previously used to label a blob. DUMP_FILENAME is the name of the file to which the git-fast-import commands for defining revisions should be written. (Please note that depending on the style of revision writer, the actual file contents might not be written to this file.) If it is None, then the output is written to stdout. AUTHOR_TRANSFORMS is a map {cvsauthor : (fullname, email)} from CVS author names to git full name and email address. All of the contents should either be Unicode strings or 8-bit strings encoded as UTF-8. TIE_TAG_FIXUP_BRANCHES means whether after finishing with a tag fixup branch, it should be psuedo-merged (ancestry linked but no content changes) back into its source branch, to dispose of the open head. """ DVCSOutputOption.__init__(self) self.dump_filename = dump_filename self.revision_writer = revision_writer self.author_transforms = self.normalize_author_transforms( author_transforms ) self.tie_tag_fixup_branches = tie_tag_fixup_branches self._mark_generator = KeyGenerator(GitOutputOption._first_commit_mark)
def open(self): """Set up the SVNRepositoryMirror and prepare it for SVNCommits.""" self._key_generator = KeyGenerator() self._delegates = [] # A map from LOD to LODHistory instance for all LODs that have # been defines so far: self._lod_histories = {} # This corresponds to the 'nodes' table in a Subversion fs. (We # don't need a 'representations' or 'strings' table because we # only track metadata, not file contents.) self._nodes_db = IndexedDatabase( artifact_manager.get_temp_file(config.SVN_MIRROR_NODES_STORE), artifact_manager.get_temp_file( config.SVN_MIRROR_NODES_INDEX_TABLE), DB_OPEN_NEW, serializer=_NodeSerializer()) # Start at revision 0 without a root node. It will be created # by _open_writable_root_node. self._youngest = 0
***THE CVS REPOSITORY WILL BE DESTROYED*** CVSREPO is the path to a CVS repository. TEST_COMMAND is a command that runs successfully (i.e., with exit code '0') if the bug is still present, and fails if the bug is absent. """ verbose = 1 tmpdir = 'shrink_test_case-tmp' file_key_generator = KeyGenerator(1) def get_tmp_filename(): return os.path.join(tmpdir, 'f%07d.tmp' % file_key_generator.gen_id()) class CommandFailedException(Exception): pass def command(cmd, *args): if verbose >= 2: sys.stderr.write('Running: %s %s...' % (cmd, ' '.join(args),)) retval = os.spawnlp(os.P_WAIT, cmd, cmd, *args) if retval:
def __init__(self, template): self.template = template self.key_generator = KeyGenerator(1) # A map from old values to new ones. self.substitutions = {}
def start(self): self.dump_file = open(self.blob_filename, 'wb') self._mark_generator = KeyGenerator()
def start(self): self.revision_reader.start() self.dump_file = open(self.blob_filename, 'wb') self._mark_generator = KeyGenerator()