コード例 #1
0
def push(**kwargs):
    '''Push changed master files to server'''

    repo = Repository()

    files = repo.get_changed_files()

    if len(files) == 0:
        print "#"
        print "# Nothing to push"
        print "#"
        sys.exit(1)
    else:
        print "#\n# Changes not pushed:\n#"
        for file in files:
            print "#\tmodified: %s" % file
        print "#\n"

    username = kwargs.get('username')
    password = kwargs.get('password')

    if username == '' or password == '':
        username, password = prompt_userpw()

    error = False

    for file in files:
        platformId = autodetect_fileformat(repo.file_path(file))

        if platformId is None:
            print "# Couldn't detect file format for file %s, please define it manually" % file
            return

        mf = GLMasterFile(
            GLProject(repo.get_project_name(), username, password),
            repo.relative_to_root(file), file, platformId)

        try:
            mf.push()
            repo.touch_master(file)
        except GLException as e:
            error = True
            print e.message

    if not error:
        print "# Done"
    sys.exit(0)
コード例 #2
0
def status(**kwargs):
    '''Project status'''
    repo = Repository()

    trlist = repo.get_status()

    exit_code = 0

    if trlist is not None:
        not_mapped = []

        print "# Mapped files:\n#"
        for tr in trlist:
            local_file = repo.get_mapped_locale(tr.get('master_file'),
                                                tr.get('iana_code'))

            progress = str(int(round(float(tr.get('progress'))))) + "%"

            if local_file is None:
                not_mapped.append(tr)
            else:
                print "#\t%s [%s] => %s %s" % (tr.get('master_file'),
                                               tr.get('iana_code'), local_file,
                                               progress)

        print "#\n# Files not mapped:\n#"
        for tr in not_mapped:
            print "#\t%s [%s] %s" % (tr.get('master_file'),
                                     tr.get('iana_code'), progress)
    else:
        print "#"
        print "# Nothing to report. Pull first to get a proper status."
        print "#"
        exit_code = 1

    files = repo.get_changed_files()

    if len(files) > 0:
        print "#\n# Changes:\n#"
        for file in files:
            print "# \tmodified: %s" % file

    print "#"

    sys.exit(exit_code)
    pass
コード例 #3
0
def push(**kwargs):
    '''Push changed master files to server'''
    
    repo = Repository();
    
    files = repo.get_changed_files()
    
    if len(files) == 0:
        print "#"
        print "# Nothing to push"
        print "#"
        sys.exit(1)
    else:
        print "#\n# Changes not pushed:\n#"
        for file in files:
            print "#\tmodified: %s" % file
        print "#\n"
  
    username = kwargs.get('username')
    password = kwargs.get('password')
  
    if username == '' or password == '':
        username, password = prompt_userpw()
    
    error = False

    for file in files:
        platformId = autodetect_fileformat(repo.file_path(file))
        
        if platformId is None:
            print "# Couldn't detect file format for file %s, please define it manually" % file
            return
        
        mf = GLMasterFile(GLProject(repo.get_project_name(), username, password), repo.relative_to_root(file), file, platformId)

        try:
            mf.push()
            repo.touch_master(file)
        except GLException as e:
            error = True
            print e.message
        
    if not error:
        print "# Done"
    sys.exit(0)
コード例 #4
0
def status(**kwargs):
    '''Project status'''
    repo = Repository()
    
    trlist = repo.get_status()
    
    exit_code = 0
    
    if trlist is not None:
        not_mapped = []
        
        print "# Mapped files:\n#"
        for tr in trlist:
            local_file = repo.get_mapped_locale(tr.get('master_file'), tr.get('iana_code'))
            
            progress =  str(int(round(float(tr.get('progress'))))) + "%"
            
            if local_file is None:
                not_mapped.append(tr)
            else:
                print "#\t%s [%s] => %s %s" % (tr.get('master_file'), tr.get('iana_code'), local_file, progress)
        
        print "#\n# Files not mapped:\n#"
        for tr in not_mapped:
            print "#\t%s [%s] %s" % (tr.get('master_file'), tr.get('iana_code'), progress)
    else:
        print "#"
        print "# Nothing to report. Pull first to get a proper status."
        print "#"
        exit_code = 1
        
    files = repo.get_changed_files()
    
    if len(files) > 0:
        print "#\n# Changes:\n#"
        for file in files:
            print "# \tmodified: %s" % file
            
    print "#"
    
    sys.exit(exit_code)
    pass