##// END OF EJS Templates
fixes #652 switch to generator approach when doing file annotation to prevent huge memory consumption when executed on large files. Thanks to ALexey Larikov for patch....
fixes #652 switch to generator approach when doing file annotation to prevent huge memory consumption when executed on large files. Thanks to ALexey Larikov for patch. - added pure dulwich method for getting file history.

File last commit:

r2007:324ac367 beta
r3044:c57a3743 beta
Show More
workdir.py
31 lines | 1.1 KiB | text/x-python | PythonLexer
Added VCS into rhodecode core for faster and easier deployments of new versions
r2007 import re
from rhodecode.lib.vcs.backends.base import BaseWorkdir
from rhodecode.lib.vcs.exceptions import RepositoryError
from rhodecode.lib.vcs.exceptions import BranchDoesNotExistError
class GitWorkdir(BaseWorkdir):
def get_branch(self):
headpath = self.repository._repo.refs.refpath('HEAD')
try:
content = open(headpath).read()
match = re.match(r'^ref: refs/heads/(?P<branch>.+)\n$', content)
if match:
return match.groupdict()['branch']
else:
raise RepositoryError("Couldn't compute workdir's branch")
except IOError:
# Try naive way...
raise RepositoryError("Couldn't compute workdir's branch")
def get_changeset(self):
return self.repository.get_changeset(
self.repository._repo.refs.as_dict().get('HEAD'))
def checkout_branch(self, branch=None):
if branch is None:
branch = self.repository.DEFAULT_BRANCH_NAME
if branch not in self.repository.branches:
raise BranchDoesNotExistError
self.repository.run_git_command(['checkout', branch])