示例#1
0
def get_project_info(info_path):
    version = get_assembly_version(info_path)
    project_dir = get_project_directory(info_path)
    parent_dir, dir_name = os.path.split(project_dir)
    label = os.path.join(os.path.basename(parent_dir), dir_name)
    
    tf = TF(TF_PATH)
    changeset_number, date, comment_start = tf.get_most_recent_changeset_info(project_dir)
    return date, version, label
示例#2
0
class Processor(object):

    def __init__(self, tf_path):
        self.tf = TF(tf_path)

    def get_project_info(self, info_path):
        assembly_version = get_assembly_version(info_path)
        project_dir = get_project_directory(info_path)
        parent_dir, dir_name = os.path.split(project_dir)
        label = os.path.join(os.path.basename(parent_dir), dir_name)
        
        return project_dir, label, assembly_version

    def update_assembly_info(self, path, project_name, old_version, new_version):
        self.tf.checkout(path)
        text = read(path)
        updated_text = assemblyinfo.change_version(text, new_version)
        common.write(path, updated_text)

        comment = "[Versioning] Update %s from '%s' to '%s'." % (project_name, old_version, new_version)
        #self.tf.checkin(path, comment)

    def get_last_change(self, project_dir):
        """
        Return None if last change was versioning-related.
        
        """
        changeset_number, date, comment_start = self.tf.get_most_recent_changeset_info(project_dir)
        if comment_start.lower() == '[versioning]':
            return None

        return date, changeset_number
        
    def update_project(self, assembly_info_path):
        project_dir, project_label, assembly_version = self.get_project_info(assembly_info_path)
        last_change = self.get_last_change(project_dir)

        if last_change is None:
            _log.info("No changes: skipping: %s" % project_label)
            return
        
        date, changeset_number = last_change

        new_version = make_new_version_number(date, changeset_number)
        
        self.update_assembly_info(assembly_info_path, project_label, assembly_version, new_version)
示例#3
0
 def __init__(self, tf_path):
     self.tf = TF(tf_path)