Show More
@@ -15,6 +15,7 b' import re' | |||
|
15 | 15 | import time |
|
16 | 16 | |
|
17 | 17 | unknown_version = 'unknown' |
|
18 | remembered_version = False | |
|
18 | 19 | |
|
19 | 20 | def get_version(): |
|
20 | 21 | """Return version information if available.""" |
@@ -34,6 +35,8 b' def write_version(version):' | |||
|
34 | 35 | |
|
35 | 36 | def remember_version(): |
|
36 | 37 | """Store version information.""" |
|
38 | global remembered_version | |
|
39 | if os.access(".hg", os.F_OK): | |
|
37 | 40 | f = os.popen("hg identify 2>/dev/null") # use real hg installation |
|
38 | 41 | ident = f.read()[:-1] |
|
39 | 42 | if not f.close() and ident: |
@@ -52,11 +55,11 b' def remember_version():' | |||
|
52 | 55 | break |
|
53 | 56 | if modified: |
|
54 | 57 | version += time.strftime('+%Y%m%d') |
|
55 | else: | |
|
56 | version = unknown_version | |
|
58 | remembered_version = True | |
|
57 | 59 | write_version(version) |
|
58 | 60 | |
|
59 | 61 | def forget_version(): |
|
60 | 62 | """Remove version information.""" |
|
63 | if remembered_version: | |
|
61 | 64 | write_version(unknown_version) |
|
62 | 65 |
General Comments 0
You need to be logged in to leave comments.
Login now