Show More
@@ -97,6 +97,8 b' try:' | |||||
97 | except ImportError: |
|
97 | except ImportError: | |
98 | pass |
|
98 | pass | |
99 |
|
99 | |||
|
100 | version = None | |||
|
101 | ||||
100 | if os.path.isdir('.hg'): |
|
102 | if os.path.isdir('.hg'): | |
101 | # execute hg out of this directory with a custom environment which |
|
103 | # execute hg out of this directory with a custom environment which | |
102 | # includes the pure Python modules in mercurial/pure |
|
104 | # includes the pure Python modules in mercurial/pure | |
@@ -105,7 +107,6 b" if os.path.isdir('.hg'):" | |||||
105 | os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath]) |
|
107 | os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath]) | |
106 | os.environ['HGRCPATH'] = '' # do not read any config file |
|
108 | os.environ['HGRCPATH'] = '' # do not read any config file | |
107 | cmd = [sys.executable, 'hg', 'id', '-i', '-t'] |
|
109 | cmd = [sys.executable, 'hg', 'id', '-i', '-t'] | |
108 | version = None |
|
|||
109 |
|
110 | |||
110 | l, e = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
|
111 | l, e = subprocess.Popen(cmd, stdout=subprocess.PIPE, | |
111 | stderr=subprocess.PIPE).communicate() |
|
112 | stderr=subprocess.PIPE).communicate() | |
@@ -122,6 +123,12 b" if os.path.isdir('.hg'):" | |||||
122 | version = l[-1] # latest tag or revision number |
|
123 | version = l[-1] # latest tag or revision number | |
123 | if version.endswith('+'): |
|
124 | if version.endswith('+'): | |
124 | version += time.strftime('%Y%m%d') |
|
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 | try: |
|
140 | try: | |
133 | from mercurial import __version__ |
|
141 | from mercurial import __version__ | |
134 | version = __version__.version |
|
142 | version = __version__.version |
General Comments 0
You need to be logged in to leave comments.
Login now