##// END OF EJS Templates
vcs: drop the superfluous and leaky hgcompat "layer"...
vcs: drop the superfluous and leaky hgcompat "layer" Explicit is better. And gives less pyflakes noise.

File last commit:

r7977:f713a375 default
r7977:f713a375 default
Show More
workdir.py
24 lines | 857 B | text/x-python | PythonLexer
import mercurial.merge
from kallithea.lib.vcs.backends.base import BaseWorkdir
from kallithea.lib.vcs.exceptions import BranchDoesNotExistError
from kallithea.lib.vcs.utils import ascii_bytes, ascii_str
class MercurialWorkdir(BaseWorkdir):
def get_branch(self):
return self.repository._repo.dirstate.branch()
def get_changeset(self):
wk_dir_id = ascii_str(self.repository._repo[None].parents()[0].hex())
return self.repository.get_changeset(wk_dir_id)
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
raw_id = self.repository.branches[branch]
mercurial.merge.update(self.repository._repo, ascii_bytes(raw_id), False, False, None)