tmp
This commit is contained in:
parent
2a214ff0ba
commit
021ce2b078
@ -57,25 +57,38 @@ class BenchmarkRepository:
|
|||||||
remote.fetch(callbacks = callbacks)
|
remote.fetch(callbacks = callbacks)
|
||||||
printProgressBar("Updating the repository", 1, 1, overwrite = True)
|
printProgressBar("Updating the repository", 1, 1, overwrite = True)
|
||||||
|
|
||||||
|
self.forceUpdateBranch("master", self.repository)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pass
|
for branchName in ["results", "config", "status"]:
|
||||||
#self.repository.lookup_worktree("results")
|
print("Updating branch {}".format(branchName))
|
||||||
#self.repository.lookup_worktree("config")
|
worktree = self.repository.lookup_worktree(branchName)
|
||||||
#self.repository.lookup_worktree("status")
|
worktree = pygit2.Repository(worktree.path)
|
||||||
|
self.forceUpdateBranch(branchName, worktree)
|
||||||
except pygit2.GitError:
|
except pygit2.GitError:
|
||||||
raise Exception("Worktrees are not properly set up")
|
raise Exception("Worktrees are not properly set up")
|
||||||
|
|
||||||
|
print(list(self.repository.branches))
|
||||||
else:
|
else:
|
||||||
callbacks.transfer_progress = printCloneProgress
|
callbacks.transfer_progress = printCloneProgress
|
||||||
|
|
||||||
printProgressBar("Cloning the repository", 0, 1)
|
printProgressBar("Cloning the repository", 0, 1)
|
||||||
self.repository = pygit2.clone_repository(self.remote, self.branchDir("master"), callbacks = callbacks, checkout_branch = self.branches["master"])
|
self.repository = pygit2.clone_repository(self.remote, self.branchDir("master"), callbacks = callbacks, checkout_branch = self.branches["master"])
|
||||||
|
self.repository = pygit2.Repository(self.repository.path)
|
||||||
printProgressBar("Cloning the repository", 1, 1, overwrite = True)
|
printProgressBar("Cloning the repository", 1, 1, overwrite = True)
|
||||||
|
|
||||||
for branchName in ["results", "config", "status"]:
|
for branchName in ["results", "config", "status"]:
|
||||||
worktree = self.repository.add_worktree(branchName, self.branchDir(branchName))
|
print("Preparing branch {}".format(branchName))
|
||||||
worktree = pygit2.Repository(worktree.path)
|
worktree = self.repository.add_worktree(branchName, self.branchDir(branchName))
|
||||||
branch = worktree.branches.local.create(branchName)
|
worktree = pygit2.Repository(worktree.path)
|
||||||
#worktree.checkout(self.branches["results"])
|
remoteReference = worktree.lookup_reference("refs/remotes/origin/{}".format(self.branches[branchName]))
|
||||||
|
localReference = worktree.create_reference("refs/heads/{}".format(branchName), remoteReference.resolve().target)
|
||||||
|
self.forceUpdateBranch(branchName, worktree)
|
||||||
|
|
||||||
def branchDir(self, branchName):
|
def branchDir(self, branchName):
|
||||||
return os.path.join(self.basePath, branchName)
|
return os.path.join(self.basePath, branchName)
|
||||||
|
|
||||||
|
def forceUpdateBranch(self, branchName, worktree):
|
||||||
|
worktree.checkout("refs/heads/{}".format(branchName), strategy = pygit2.GIT_CHECKOUT_FORCE | pygit2.GIT_CHECKOUT_RECREATE_MISSING)
|
||||||
|
#remoteReference = worktree.lookup_reference("refs/remotes/origin/{}".format(self.branches[branchName]))
|
||||||
|
#worktree.reset(remoteReference.target, pygit2.GIT_RESET_HARD)
|
||||||
|
Loading…
Reference in New Issue
Block a user