As the docstring say it should return the changeset of checked out workdir but it now returns the last changeset
here's the fix for it:
marcink@/home/marcink/workspace-python/vcs # hg diff -c 5b344e89bd23 [21:21:40 on 27/04/2013]
diff --git a/vcs/backends/git/workdir.py b/vcs/backends/git/workdir.py
--- a/vcs/backends/git/workdir.py
+++ b/vcs/backends/git/workdir.py
@@ -15,17 +15,17 @@ class GitWorkdir(BaseWorkdir):
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'))
+ wk_dir_id = self.repository._repo.refs.as_dict().get('HEAD')
+ 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
self.repository.run_git_command(['checkout', branch])
diff --git a/vcs/backends/hg/workdir.py b/vcs/backends/hg/workdir.py
--- a/vcs/backends/hg/workdir.py
+++ b/vcs/backends/hg/workdir.py
@@ -5,17 +5,18 @@ from vcs.utils.hgcompat import hg_merge
class MercurialWorkdir(BaseWorkdir):
def get_branch(self):
return self.repository._repo.dirstate.branch()
def get_changeset(self):
- return self.repository.get_changeset()
+ wk_dir_id = 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
hg_merge.update(self.repository._repo, branch, False, False, None)
That breaks one test, that i really don't know how to fix...
As the docstring say it should return the changeset of checked out workdir but it now returns the last changeset
here's the fix for it:
That breaks one test, that i really don't know how to fix...