Skip to content

Commit

Permalink
Merge pull request pypa#108 from RonnyPfannschmidt/git-distance-initial
Browse files Browse the repository at this point in the history
fix pypa#107 - dont use node if it is none
  • Loading branch information
RonnyPfannschmidt authored Oct 12, 2016
2 parents 5ef809f + 388bd58 commit 7961046
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v1.14.0
=======

* publish bdist_egg for python 2.6, 2.7 and 3.3-3.5
* fix issue #107 - dont use node if it is None

v1.13.1
=======
Expand Down
2 changes: 1 addition & 1 deletion setuptools_scm/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def guess_next_dev_version(version):


def get_local_node_and_date(version):
if version.exact:
if version.exact or version.node is None:
return version.format_choice("", "+d{time:%Y%m%d}")
else:
return version.format_choice("+n{node}", "+n{node}.d{time:%Y%m%d}")
Expand Down
16 changes: 8 additions & 8 deletions testing/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ def test_next_tag(tag, expected):

@pytest.mark.parametrize('version,scheme,expected', [
('exact', 'guess-next-dev node-and-date', '1.1'),
('zerodistance', 'guess-next-dev node-and-date', '1.2.dev0+nNone'),
('dirty', 'guess-next-dev node-and-date', '1.2.dev0+nNone.dtime'),
('distance', 'guess-next-dev node-and-date', '1.2.dev3+nNone'),
('distancedirty', 'guess-next-dev node-and-date', '1.2.dev3+nNone.dtime'),
('zerodistance', 'guess-next-dev node-and-date', '1.2.dev0'),
('dirty', 'guess-next-dev node-and-date', '1.2.dev0+dtime'),
('distance', 'guess-next-dev node-and-date', '1.2.dev3'),
('distancedirty', 'guess-next-dev node-and-date', '1.2.dev3+dtime'),
('exact', 'post-release node-and-date', '1.1'),
('zerodistance', 'post-release node-and-date', '1.1.post0+nNone'),
('dirty', 'post-release node-and-date', '1.1.post0+nNone.dtime'),
('distance', 'post-release node-and-date', '1.1.post3+nNone'),
('distancedirty', 'post-release node-and-date', '1.1.post3+nNone.dtime'),
('zerodistance', 'post-release node-and-date', '1.1.post0'),
('dirty', 'post-release node-and-date', '1.1.post0+dtime'),
('distance', 'post-release node-and-date', '1.1.post3'),
('distancedirty', 'post-release node-and-date', '1.1.post3+dtime'),
])
def test_format_version(version, monkeypatch, scheme, expected):
version = VERSIONS[version]
Expand Down
6 changes: 6 additions & 0 deletions testing/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def test_version_from_git(wd):
assert wd.version.startswith('0.2')


@pytest.mark.issue(108)
def test_git_worktree(wd):
wd.write('test.txt', 'test2')
assert wd.version.startswith('0.1.dev0+d')


@pytest.mark.issue(86)
def test_git_dirty_notag(wd):
wd.commit_testfile()
Expand Down

0 comments on commit 7961046

Please sign in to comment.