##// END OF EJS Templates
setup: read .hg_archival.txt for version info (issue1670)...
Jeremy Whitlock -
r8548:3ccbe42f default
parent child Browse files
Show More
@@ -97,6 +97,8 b' try:'
97 97 except ImportError:
98 98 pass
99 99
100 version = None
101
100 102 if os.path.isdir('.hg'):
101 103 # execute hg out of this directory with a custom environment which
102 104 # includes the pure Python modules in mercurial/pure
@@ -105,7 +107,6 b" if os.path.isdir('.hg'):"
105 107 os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
106 108 os.environ['HGRCPATH'] = '' # do not read any config file
107 109 cmd = [sys.executable, 'hg', 'id', '-i', '-t']
108 version = None
109 110
110 111 l, e = subprocess.Popen(cmd, stdout=subprocess.PIPE,
111 112 stderr=subprocess.PIPE).communicate()
@@ -122,6 +123,12 b" if os.path.isdir('.hg'):"
122 123 version = l[-1] # latest tag or revision number
123 124 if version.endswith('+'):
124 125 version += time.strftime('%Y%m%d')
126 elif os.path.exists('.hg_archival.txt'):
127 hgarchival = open('.hg_archival.txt')
128 for line in hgarchival:
129 if line.startswith('node:'):
130 version = line.split(':')[1].strip()[:12]
131 break
125 132
126 133 if version:
127 134 f = file("mercurial/__version__.py", "w")
@@ -129,6 +136,7 b" if os.path.isdir('.hg'):"
129 136 f.write('version = "%s"\n' % version)
130 137 f.close()
131 138
139
132 140 try:
133 141 from mercurial import __version__
134 142 version = __version__.version
General Comments 0
You need to be logged in to leave comments. Login now