Show More
@@ -11,7 +11,6 b' from i18n import _, gettext' | |||||
11 | import os, re, sys |
|
11 | import os, re, sys | |
12 | import hg, util, revlog, bundlerepo, extensions, copies, context |
|
12 | import hg, util, revlog, bundlerepo, extensions, copies, context | |
13 | import difflib, patch, time, help, mdiff, tempfile, url |
|
13 | import difflib, patch, time, help, mdiff, tempfile, url | |
14 | import version |
|
|||
15 | import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect |
|
14 | import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect | |
16 | import merge as merge_ |
|
15 | import merge as merge_ | |
17 |
|
16 | |||
@@ -2961,7 +2960,7 b' def verify(ui, repo):' | |||||
2961 | def version_(ui): |
|
2960 | def version_(ui): | |
2962 | """output version and copyright information""" |
|
2961 | """output version and copyright information""" | |
2963 | ui.write(_("Mercurial Distributed SCM (version %s)\n") |
|
2962 | ui.write(_("Mercurial Distributed SCM (version %s)\n") | |
2964 |
% version |
|
2963 | % util.version()) | |
2965 | ui.status(_( |
|
2964 | ui.status(_( | |
2966 | "\nCopyright (C) 2005-2008 Matt Mackall <mpm@selenic.com> and others\n" |
|
2965 | "\nCopyright (C) 2005-2008 Matt Mackall <mpm@selenic.com> and others\n" | |
2967 | "This is free software; see the source for copying conditions. " |
|
2966 | "This is free software; see the source for copying conditions. " |
@@ -8,7 +8,7 b'' | |||||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | from repo import RepoError |
|
9 | from repo import RepoError | |
10 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time |
|
10 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time | |
11 |
import util, commands, hg, lock, fancyopts, revlog, |
|
11 | import util, commands, hg, lock, fancyopts, revlog, extensions, hook | |
12 | import cmdutil |
|
12 | import cmdutil | |
13 | import ui as _ui |
|
13 | import ui as _ui | |
14 |
|
14 | |||
@@ -145,7 +145,7 b' def _runcatch(ui, args):' | |||||
145 | "http://www.selenic.com/mercurial/bts\n")) |
|
145 | "http://www.selenic.com/mercurial/bts\n")) | |
146 | ui.warn(_("** or mercurial@selenic.com\n")) |
|
146 | ui.warn(_("** or mercurial@selenic.com\n")) | |
147 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") |
|
147 | ui.warn(_("** Mercurial Distributed SCM (version %s)\n") | |
148 |
% version |
|
148 | % util.version()) | |
149 | ui.warn(_("** Extensions loaded: %s\n") |
|
149 | ui.warn(_("** Extensions loaded: %s\n") | |
150 | % ", ".join([x[0] for x in extensions.extensions()])) |
|
150 | % ", ".join([x[0] for x in extensions.extensions()])) | |
151 | raise |
|
151 | raise |
@@ -142,6 +142,14 b' def locallen(s):' | |||||
142 | """Find the length in characters of a local string""" |
|
142 | """Find the length in characters of a local string""" | |
143 | return len(s.decode(_encoding, "replace")) |
|
143 | return len(s.decode(_encoding, "replace")) | |
144 |
|
144 | |||
|
145 | def version(): | |||
|
146 | """Return version information if available.""" | |||
|
147 | try: | |||
|
148 | import __version__ | |||
|
149 | return __version__.version | |||
|
150 | except ImportError: | |||
|
151 | return 'unknown' | |||
|
152 | ||||
145 | # used by parsedate |
|
153 | # used by parsedate | |
146 | defaultdateformats = ( |
|
154 | defaultdateformats = ( | |
147 | '%Y-%m-%d %H:%M:%S', |
|
155 | '%Y-%m-%d %H:%M:%S', |
@@ -26,15 +26,13 b' except:' | |||||
26 | raise SystemExit( |
|
26 | raise SystemExit( | |
27 | "Couldn't import standard zlib (incomplete Python install).") |
|
27 | "Couldn't import standard zlib (incomplete Python install).") | |
28 |
|
28 | |||
29 | import os |
|
29 | import os, time | |
30 | import shutil |
|
30 | import shutil | |
31 | import tempfile |
|
31 | import tempfile | |
32 | from distutils.core import setup, Extension |
|
32 | from distutils.core import setup, Extension | |
33 | from distutils.command.install_data import install_data |
|
33 | from distutils.command.install_data import install_data | |
34 | from distutils.ccompiler import new_compiler |
|
34 | from distutils.ccompiler import new_compiler | |
35 |
|
35 | |||
36 | import mercurial.version |
|
|||
37 |
|
||||
38 | extra = {} |
|
36 | extra = {} | |
39 | scripts = ['hg'] |
|
37 | scripts = ['hg'] | |
40 | if os.name == 'nt': |
|
38 | if os.name == 'nt': | |
@@ -95,8 +93,21 b' try:' | |||||
95 | except ImportError: |
|
93 | except ImportError: | |
96 | pass |
|
94 | pass | |
97 |
|
95 | |||
98 | # specify version string, otherwise 'hg identify' will be used: |
|
96 | try: | |
99 | version = '' |
|
97 | l = os.popen('hg id -it').read().split() | |
|
98 | while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags | |||
|
99 | l.pop() | |||
|
100 | version = l[-1] or 'unknown' # latest tag or revision number | |||
|
101 | if version.endswith('+'): | |||
|
102 | version += time.strftime('%Y%m%d') | |||
|
103 | ||||
|
104 | except OSError: | |||
|
105 | version = "unknown" | |||
|
106 | ||||
|
107 | f = file("mercurial/__version__.py", "w") | |||
|
108 | f.write('# this file is autogenerated by setup.py\n') | |||
|
109 | f.write('version = "%s"\n' % version) | |||
|
110 | f.close() | |||
100 |
|
111 | |||
101 | class install_package_data(install_data): |
|
112 | class install_package_data(install_data): | |
102 | def finalize_options(self): |
|
113 | def finalize_options(self): | |
@@ -104,7 +115,6 b' class install_package_data(install_data)' | |||||
104 | ('install_lib', 'install_dir')) |
|
115 | ('install_lib', 'install_dir')) | |
105 | install_data.finalize_options(self) |
|
116 | install_data.finalize_options(self) | |
106 |
|
117 | |||
107 | mercurial.version.remember_version(version) |
|
|||
108 | cmdclass = {'install_data': install_package_data} |
|
118 | cmdclass = {'install_data': install_package_data} | |
109 |
|
119 | |||
110 | ext_modules=[ |
|
120 | ext_modules=[ | |
@@ -140,7 +150,7 b' except ImportError:' | |||||
140 | pass |
|
150 | pass | |
141 |
|
151 | |||
142 | setup(name='mercurial', |
|
152 | setup(name='mercurial', | |
143 |
version= |
|
153 | version=version, | |
144 | author='Matt Mackall', |
|
154 | author='Matt Mackall', | |
145 | author_email='mpm@selenic.com', |
|
155 | author_email='mpm@selenic.com', | |
146 | url='http://selenic.com/mercurial', |
|
156 | url='http://selenic.com/mercurial', |
@@ -18,13 +18,6 b' print "os =", f(os)' | |||||
18 | print "os.system =", f(os.system) |
|
18 | print "os.system =", f(os.system) | |
19 | print "os =", f(os) |
|
19 | print "os =", f(os) | |
20 |
|
20 | |||
21 | import mercurial.version |
|
|||
22 |
|
||||
23 | print "mercurial.version =", f(mercurial.version) |
|
|||
24 | print "mercurial.version.get_version =", f(mercurial.version.get_version) |
|
|||
25 | print "mercurial.version =", f(mercurial.version) |
|
|||
26 | print "mercurial =", f(mercurial) |
|
|||
27 |
|
||||
28 | from mercurial import util |
|
21 | from mercurial import util | |
29 |
|
22 | |||
30 | print "util =", f(util) |
|
23 | print "util =", f(util) |
@@ -1,10 +1,6 b'' | |||||
1 | os = <unloaded module 'os'> |
|
1 | os = <unloaded module 'os'> | |
2 | os.system = <built-in function system> |
|
2 | os.system = <built-in function system> | |
3 | os = <module 'os' from '?'> |
|
3 | os = <module 'os' from '?'> | |
4 | mercurial.version = <unloaded module 'version'> |
|
|||
5 | mercurial.version.get_version = <function get_version at 0x?> |
|
|||
6 | mercurial.version = <module 'mercurial.version' from '?'> |
|
|||
7 | mercurial = <module 'mercurial' from '?'> |
|
|||
8 | util = <unloaded module 'util'> |
|
4 | util = <unloaded module 'util'> | |
9 | util.system = <function system at 0x?> |
|
5 | util.system = <function system at 0x?> | |
10 | util = <module 'mercurial.util' from '?'> |
|
6 | util = <module 'mercurial.util' from '?'> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now