Skip to content

Commit 3649c15

Browse files
fix issue #72 - handle hg pre commit merge states
1 parent a035b38 commit 3649c15

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v1.10.1
2+
=======
3+
4+
* fix issue #73 - in hg pre commit merge, consider parent1 instead of failing
5+
16
v1.10.0
27
=======
38

setuptools_scm/hg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ def parse(root):
3131
trace('initial node', root)
3232
return meta('0.0', dirty=dirty)
3333

34-
cmd = 'hg parents --template "{latesttag} {latesttagdistance}"'
34+
# the newline is needed for merge stae, see issue 72
35+
cmd = 'hg parents --template "{latesttag} {latesttagdistance}\n"'
3536
out = do(cmd, root)
3637
try:
37-
tag, dist = out.split()
38+
# in merge state we assume parent 1 is fine
39+
tag, dist = out.splitlines()[0].split()
3840
if tag == 'null':
3941
tag = '0.0'
4042
dist = int(dist) + 1

testing/test_mercurial.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,13 @@ def test_version_from_archival(wd):
8585
)
8686

8787
assert wd.version == '0.2.dev3+n000000000000'
88+
89+
90+
@pytest.mark.issue('#72')
91+
def test_version_in_merge(wd):
92+
wd.commit_testfile()
93+
wd.commit_testfile()
94+
wd('hg up 0')
95+
wd.commit_testfile()
96+
wd('hg merge')
97+
assert wd.version is not None

0 commit comments

Comments
 (0)