def repository(path): # build an example repository object and try some things out ignore_dirs = [ 'docs', 'tests', 'Data' ] r = Repository(path) # is it bare? print('\nRepo bare?') print(r.is_bare()) print('\n') # get the commit history ch = r.commit_history('HEAD', limit=None, extensions=['py'], ignore_dir=ignore_dirs) print(ch.head(5)) # get the list of committers print('\nCommiters:') print(''.join([str(x) + '\n' for x in set(ch['committer'].values)])) print('\n') # print out everyone's contributions attr = ch.reindex(columns=['committer', 'lines', 'insertions', 'deletions']).groupby(['committer']) attr = attr.agg({ 'lines': np.sum, 'insertions': np.sum, 'deletions': np.sum }) print(attr) # get the file change history fh = r.file_change_history('HEAD', limit=None, ignore_dir=ignore_dirs) fh['ext'] = fh['filename'].map(lambda x: x.split('.')[-1]) print(fh.head(50)) # print out unique extensions print('\nExtensions Found:') print(''.join([str(x) + '\n' for x in set(fh['ext'].values)])) print('\n') # agg by extension etns = fh.reindex(columns=['ext', 'insertions', 'deletions']).groupby(['ext']) etns = etns.agg({ 'insertions': np.sum, 'deletions': np.sum }) print(etns)
def __init__(self, working_dir=None, ignore_repos=None, verbose=True, tmp_dir=None, cache_backend=None): if working_dir is None: self.repo_dirs = set([ x[0].split('.git')[0] for x in os.walk(os.getcwd()) if '.git' in x[0] ]) elif isinstance(working_dir, list): self.repo_dirs = working_dir else: self.repo_dirs = set([ x[0].split('.git')[0] for x in os.walk(working_dir) if '.git' in x[0] ]) self.repos = [ Repository(r, verbose=verbose, tmp_dir=tmp_dir, cache_backend=cache_backend) for r in self.repo_dirs ] if ignore_repos is not None: self.repos = [ x for x in self.repos if x.repo_name not in ignore_repos ]
def repository(): # build an example repository object then check the attributes r = Repository('git://github.com/wdm0006/git-pandas.git') print('\nRepository Name') print(r._repo_name()) print('\nRepository Branches:') print(r.branches()) print('\nRepository Tags:') print(r.tags()) print('\nRepository Revisions:') print(r.revs()) print('\nRepository Blame:') print(r.blame(extensions=['py'])) print('\nRepository Is Bare:') print(r.is_bare())
import os from gitpandas.repository import Repository __author__ = 'willmcginnis' # get the path of this repo path = os.path.abspath('../../git-pandas') # build an example repository object and try some things out ignore_dirs = ['tests/*'] r = Repository(path, verbose=True) # get the hours estimate for this repository (using 30 mins per commit) he = r.hours_estimate(branch='master', grouping_window=0.5, single_commit_hours=0.75, limit=None, include_globs=['*.py'], ignore_globs=ignore_dirs) print(he)
import os from gitpandas.repository import Repository __author__ = 'willmcginnis' # get the path of this repo path = os.path.abspath('../../git-pandas') # build an example repository object and try some things out ignore_dirs = ['tests'] r = Repository(path, verbose=True) # get the hours estimate for this repository (using 30 mins per commit) he = r.hours_estimate( branch='master', grouping_window=0.5, single_commit_hours=0.5, limit=None, extensions=['py'], ignore_dir=ignore_dirs ) print(he)
import os from gitpandas.repository import Repository __author__ = 'willmcginnis' # get the path of this repo path = os.path.abspath('../../git-pandas') # build an example repository object and try some things out ignore_dirs = ['tests'] r = Repository(path, verbose=True) # get the hours estimate for this repository (using 30 mins per commit) he = r.hours_estimate(branch='master', grouping_window=0.5, single_commit_hours=0.5, limit=None, extensions=['py'], ignore_dir=ignore_dirs) print(he)
import os from gitpandas.repository import Repository __author__ = 'willmcginnis' # get the path of this repo path = os.path.abspath('../../git-pandas') # build an example repository object and try some things out ignore_dirs = ['tests/*'] r = Repository(path, verbose=True) # get the hours estimate for this repository (using 30 mins per commit) he = r.hours_estimate( branch='master', grouping_window=0.5, single_commit_hours=0.75, limit=None, include_globs=['*.py'], ignore_globs=ignore_dirs ) print(he)