Permalink
Browse files

Merge pull request #7 from matwey/master

Fix dashes in version for mercurial.
  • Loading branch information...
aspiers committed Jan 19, 2013
2 parents ed121ad + 91f20c1 commit daf1e1456e7d6269c3d45c3aea3ccc200f79686f
Showing with 13 additions and 1 deletion.
  1. +1 −1 tar_scm
  2. +4 −0 tests/githgtests.py
  3. +1 −0 tests/gittests.py
  4. +1 −0 tests/hgtests.py
  5. +6 −0 tests/testenv.py
View
@@ -423,7 +423,7 @@ get_version () {
;;
hg)
rev=`safe_run hg id -n`
version=`safe_run hg log -l1 -r$rev --template "$MYFORMAT"`
version=`safe_run hg log -l1 -r$rev --template "$MYFORMAT"|sed 's@-@@g'`
;;
bzr)
#safe_run bzr log -l1 ...
View
@@ -16,6 +16,10 @@ def test_versionformat_timestamp(self):
self.tar_scm_std('--versionformat', self.timestamp_format)
self.assertTarOnly(self.basename(version = self.timestamps(self.rev(2))))
def test_versionformat_dateYYYYMMDD(self):
self.tar_scm_std('--versionformat', self.yyyymmdd_format)
self.assertTarOnly(self.basename(version = self.dateYYYYMMDD(self.rev(2))))
def _mixed_version_format(self):
return self.mixed_version_template % (self.timestamp_format, self.abbrev_hash_format)
View
@@ -12,6 +12,7 @@ class GitTests(GitHgTests):
abbrev_hash_format = '%h'
timestamp_format = '%ct'
yyyymmdd_format = '%cd'
def default_version(self):
return self.timestamps(self.rev(2))
View
@@ -12,6 +12,7 @@ class HgTests(GitHgTests):
abbrev_hash_format = '{node|short}'
timestamp_format = '{date}'
yyyymmdd_format = '{date|shortdate}'
def default_version(self):
return self.rev(2)
View
@@ -1,5 +1,6 @@
#!/usr/bin/python
import datetime
import os
import shutil
from utils import mkfreshdir, run_cmd
@@ -139,6 +140,11 @@ def rev(self, rev):
def timestamps(self, rev):
return self.fixtures.timestamps[rev]
def dateYYYYMMDD(self, rev):
timestamp = self.timestamps(rev)
dateobj = datetime.date.fromtimestamp(float(timestamp))
return dateobj.strftime("%4Y%02m%02d")
def sha1s(self, rev):
return self.fixtures.sha1s[rev]

0 comments on commit daf1e14

Please sign in to comment.