Exemplo n.º 1
0
def getCommits(repo, startdate, enddate):
	end_rev = pysvn.Revision(pysvn.opt_revision_kind.date, enddate)
	start_rev = pysvn.Revision(pysvn.opt_revision_kind.date, startdate)
	
	c = pysvn.Client()

	commits = []
	msgs = c.log(repo.url, revision_start=start_rev, revision_end=end_rev, discover_changed_paths=True)
	msgs.reverse() 
	for m in msgs:
		date = m.data['revprops']['svn:date']
		message = m.data['message']
		paths = [p.path for p in m.data['changed_paths']]

		c = Commit()
		c.loadFromSource(repo, message, date, paths, m.data['revision'].number)
		commits.append(c)
	return commits
Exemplo n.º 2
0
def getCommits(repo, startdate, enddate):
    localfolder = urlToFolder(repo.url)
    differ = gdiff.diff_match_patch()

    repoloc = "git-repos/" + localfolder + "/"
    if os.path.exists(repoloc):
        c = pygit.Repo(repoloc)
    else:
        os.makedirs(repoloc)
        c = pygit.Repo.init(repoloc)
        c.create_remote("origin", repo.url)

    c.remotes.origin.fetch()
    c.remotes.origin.pull("master")

    commits = []
    msgs = c.iter_commits(since=unixToGitDateFormat(startdate))
    for m in msgs:
        if m.committed_date > enddate:
            continue

        alldiffs = []
        for d in m.diff("HEAD~1").iter_change_type("M"):  # Changed
            left = d.a_blob.data_stream.read()
            right = d.b_blob.data_stream.read()
            diffs = differ.diff_main(left, right)
            if diffs:
                differ.diff_cleanupSemantic(diffs)

            for d in diffs:
                if d[0] != 0 and d[1].strip():
                    alldiffs.append(d)

        for d in m.diff().iter_change_type("A"):  # Added
            pass
        for d in m.diff().iter_change_type("D"):  # Deleted
            pass
        for d in m.diff().iter_change_type("R"):  # Renamed
            pass

        c = Commit()
        c.loadFromSource(repo, m.message, m.committed_date, m.stats.files.keys(), m.__str__(), alldiffs)
        commits.append(c)
    return commits
Exemplo n.º 3
0
def getCommits(repo, startdate, enddate):
    localfolder = urlToFolder(repo.url)
    differ = gdiff.diff_match_patch()

    repoloc = 'git-repos/' + localfolder + '/'
    if os.path.exists(repoloc):
        c = pygit.Repo(repoloc)
    else:
        os.makedirs(repoloc)
        c = pygit.Repo.init(repoloc)
        c.create_remote('origin', repo.url)

    c.remotes.origin.fetch()
    c.remotes.origin.pull('master')

    commits = []
    msgs = c.iter_commits(since=unixToGitDateFormat(startdate))
    for m in msgs:
        if m.committed_date > enddate: continue

        alldiffs = []
        for d in m.diff('HEAD~1').iter_change_type('M'):  #Changed
            left = d.a_blob.data_stream.read()
            right = d.b_blob.data_stream.read()
            diffs = differ.diff_main(left, right)
            if diffs: differ.diff_cleanupSemantic(diffs)

            for d in diffs:
                if d[0] != 0 and d[1].strip():
                    alldiffs.append(d)

        for d in m.diff().iter_change_type('A'):  #Added
            pass
        for d in m.diff().iter_change_type('D'):  #Deleted
            pass
        for d in m.diff().iter_change_type('R'):  #Renamed
            pass

        c = Commit()
        c.loadFromSource(repo, m.message, m.committed_date,
                         m.stats.files.keys(), m.__str__(), alldiffs)
        commits.append(c)
    return commits
Exemplo n.º 4
0
def getCommits(repo, startdate, enddate):
    end_rev = pysvn.Revision(pysvn.opt_revision_kind.date, enddate)
    start_rev = pysvn.Revision(pysvn.opt_revision_kind.date, startdate)

    c = pysvn.Client()

    commits = []
    msgs = c.log(repo.url,
                 revision_start=start_rev,
                 revision_end=end_rev,
                 discover_changed_paths=True)
    msgs.reverse()
    for m in msgs:
        date = m.data['revprops']['svn:date']
        message = m.data['message']
        paths = [p.path for p in m.data['changed_paths']]

        c = Commit()
        c.loadFromSource(repo, message, date, paths, m.data['revision'].number,
                         [])
        commits.append(c)
    return commits
Exemplo n.º 5
0
def getCommits(repo, startdate, enddate):
	localfolder = urlToFolder(repo.url)

	repoloc = 'git-repos/' + localfolder + '/'
	if os.path.exists(repoloc):
		c = pygit.Repo(repoloc)
	else:
		os.makedirs(repoloc)
		c = pygit.Repo.init(repoloc)
		c.create_remote('origin', repo.url)

	c.remotes.origin.fetch()
	c.remotes.origin.pull('master')

	commits = []
	msgs = c.iter_commits(since=unixToGitDateFormat(startdate))
	for m in msgs:
		if m.committed_date > enddate: continue
		c = Commit()
		c.loadFromSource(repo, m.message, m.committed_date, m.stats.files.keys(), m.__str__())
		commits.append(c)
	return commits