Skip to content

Commit

Permalink
Never lock a dirty version
Browse files Browse the repository at this point in the history
Fixes #104
  • Loading branch information
jacebrowning committed Jan 6, 2017
1 parent c94e4be commit b5b10d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gitman/models/source.py
Expand Up @@ -131,6 +131,6 @@ def identify(self, allow_dirty=True, allow_missing=True):

def lock(self):
"""Return a locked version of the current source."""
_, _, revision = self.identify(allow_missing=False)
_, _, revision = self.identify(allow_dirty=False, allow_missing=False)
source = self.__class__(self.repo, self.name, revision, self.link)
return source
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -79,6 +79,6 @@ def read_descriptions():
],

install_requires=[
'YORM==1.2b4',
'YORM==1.2b5',
],
)
9 changes: 8 additions & 1 deletion tests/test_api.py
Expand Up @@ -11,7 +11,7 @@

import gitman
from gitman.models import Config
from gitman.exceptions import InvalidRepository
from gitman.exceptions import UncommittedChanges, InvalidRepository

from .utilities import strip

Expand Down Expand Up @@ -329,6 +329,13 @@ def it_records_specified_dependencies(config):
rev: 9bf18e16b956041f0267c21baad555a23237b52e
""") == config.__mapper__.text

def it_should_fail_on_dirty_repositories(config):
expect(gitman.update(depth=1, lock=False)) == True
os.remove("deps/gitman_1/.project")

with pytest.raises(UncommittedChanges):
gitman.lock()

def it_should_fail_on_invalid_repositories(config):
os.system("mkdir deps && touch deps/gitman_1")

Expand Down

0 comments on commit b5b10d2

Please sign in to comment.