예제 #1
0
def displayFiles():
    if (not datastorage.repoIsStored()):
        print 'No repository is currently loaded.  Please load one and try again.'
        print 'Type ./repostats --help for more information'
        sys.exit()
    space = "   "
    for dirpath, dirs, files in os.walk(os.getcwd() + '/.data/repo'):
        if '.git' in dirpath: continue
        current = dirpath[dirpath.rfind('/'):len(dirpath)]
        depth = getDepth(dirpath)
        print depth * space + current
        for filename in files:
            print space * (depth + 1) + filename
예제 #2
0
def displayFiles():
	if (not datastorage.repoIsStored()):
		print 'No repository is currently loaded.  Please load one and try again.'  
		print 'Type ./repostats --help for more information'
		sys.exit()
	space = "   "
	for dirpath, dirs, files in os.walk(os.getcwd() + '/.data/repo'):
		if '.git' in dirpath: continue
		current = dirpath[dirpath.rfind('/'):len(dirpath)]
		depth = getDepth(dirpath)
		print depth*space + current
		for filename in files:
			print space*(depth+1) + filename
예제 #3
0
def getLanguageFrequencies():
    if (not datastorage.repoIsStored()):
        print 'No repository is currently loaded.  Please load one and try again.'  
        print 'Type ./repostats --help for more information'
        sys.exit()

    frequencyMap = {}
    for root, dirs, files in os.walk(os.getcwd() + '/.data/repo'):
        if '.git' in root: continue
        for filename in files:
            index = filename.rfind('.')
            language = getFileType(filename[index:len(filename)])
            if(language): 
                if language in frequencyMap: frequencyMap[language]+=1
                else: frequencyMap[language] = 1
    return frequencyMap
예제 #4
0
def getLanguageFrequencies():
    if (not datastorage.repoIsStored()):
        print 'No repository is currently loaded.  Please load one and try again.'
        print 'Type ./repostats --help for more information'
        sys.exit()

    frequencyMap = {}
    for root, dirs, files in os.walk(os.getcwd() + '/.data/repo'):
        if '.git' in root: continue
        for filename in files:
            index = filename.rfind('.')
            language = getFileType(filename[index:len(filename)])
            if (language):
                if language in frequencyMap: frequencyMap[language] += 1
                else: frequencyMap[language] = 1
    return frequencyMap
예제 #5
0
def countLines():
    if (not datastorage.repoIsStored()):
        print 'No repository is currently loaded.  Please load one and try again.'
        print 'Type ./repostats --help for more information'
        sys.exit()
    os.chdir('.data/repo')

    total = 0

    for (path, dirs, files) in os.walk(os.getcwd()):
        if ('.git' in path):
            continue
        for filename in files:
            mime = mimetypes.guess_type(path + filename, False)
            if (mime[0] != None and mime[0].find('text') == 0):
                with open(path + '/' + filename) as f:
                    for i, l in enumerate(f):
                        pass
                total += i + 1

    print 'Number of lines in git repository: ' + str(total)
    os.chdir('../../')
    sys.exit()
예제 #6
0
def countLines():
    if (not datastorage.repoIsStored()):
        print 'No repository is currently loaded.  Please load one and try again.'  
        print 'Type ./repostats --help for more information'
        sys.exit()
    os.chdir('.data/repo')

    total = 0

    for (path, dirs, files) in os.walk(os.getcwd()):
        if ('.git' in path):
            continue
        for filename in files:
            mime = mimetypes.guess_type(path+filename, False)
            if (mime[0] != None and mime[0].find('text') == 0):
                with open(path + '/' + filename) as f:
                    for i, l in enumerate(f):
                        pass
                total += i + 1
                
    print 'Number of lines in git repository: ' + str(total)
    os.chdir('../../')
    sys.exit()