##// END OF EJS Templates
Pull from TAH...
mpm@selenic.com -
r429:688d03d6 merge default
parent child Browse files
Show More
@@ -0,0 +1,66 b''
1 # Copyright (C) 2005 by Intevation GmbH
2 # Author(s):
3 # Thomas Arendsen Hein <thomas@intevation.de>
4 #
5 # This program is free software under the GNU GPL (>=v2)
6 # Read the file COPYING coming with the software for details.
7
8 """
9 Mercurial version
10 """
11
12 import os
13 import os.path
14 import re
15 import time
16
17 unknown_version = 'unknown'
18 remembered_version = False
19
20 def get_version():
21 """Return version information if available."""
22 try:
23 from mercurial.__version__ import version
24 except ImportError:
25 version = unknown_version
26 return version
27
28 def write_version(version):
29 """Overwrite version file."""
30 filename = os.path.join(os.path.dirname(__file__), '__version__.py')
31 f = open(filename, 'w')
32 f.write("# This file is auto-generated.\n")
33 f.write("version = %r\n" % version)
34 f.close()
35
36 def remember_version(version=None):
37 """Store version information."""
38 global remembered_version
39 if not version and os.path.isdir(".hg"):
40 f = os.popen("hg identify 2>/dev/null") # use real hg installation
41 ident = f.read()[:-1]
42 if not f.close() and ident:
43 ids = ident.split(' ', 1)
44 version = ids.pop(0)
45 if version[-1] == '+':
46 version = version[:-1]
47 modified = True
48 else:
49 modified = False
50 if version.isalnum() and ids:
51 for tag in ids[0].split('/'):
52 # is a tag is suitable as a version number?
53 if re.match(r'^(\d+\.)+[\w.-]+$', tag):
54 version = tag
55 break
56 if modified:
57 version += time.strftime('+%Y%m%d')
58 if version:
59 remembered_version = True
60 write_version(version)
61
62 def forget_version():
63 """Remove version information."""
64 if remembered_version:
65 write_version(unknown_version)
66
@@ -7,4 +7,5 b' build/.*'
7 dist/
7 dist/
8 MANIFEST$
8 MANIFEST$
9 .pc/
9 .pc/
10 patches/ No newline at end of file
10 patches/
11 mercurial/__version__.py$
@@ -6,7 +6,7 b' General:'
6 - python 2.2 support
6 - python 2.2 support
7 - better import support
7 - better import support
8 - export to git
8 - export to git
9 - Add standard files: AUTHORS, CREDITS, COPYING. ChangeLog? What else?
9 - Add standard files: AUTHORS, CREDITS, ChangeLog? What else?
10 - Code cleanup: apply http://python.org/peps/pep-0008.html
10 - Code cleanup: apply http://python.org/peps/pep-0008.html
11
11
12 Core:
12 Core:
@@ -33,7 +33,6 b' Commands:'
33 - hg -v history doesn't show tkmerge as modified (removed).
33 - hg -v history doesn't show tkmerge as modified (removed).
34 - hg import vs. hg patch in help etc., import is a reserved python
34 - hg import vs. hg patch in help etc., import is a reserved python
35 word, PEP8 mentions trailing underscore as a convention for this.
35 word, PEP8 mentions trailing underscore as a convention for this.
36 - version reporting (hg --version / version.py / setup.py etc.)
37 - hg pull default in a subdir doesn't work, if it is a relative path
36 - hg pull default in a subdir doesn't work, if it is a relative path
38 - optionally only show merges (two parents or parent != changeset-1, etc.)
37 - optionally only show merges (two parents or parent != changeset-1, etc.)
39
38
@@ -8,7 +8,7 b''
8 import os, re, sys, signal
8 import os, re, sys, signal
9 import fancyopts, ui, hg, util
9 import fancyopts, ui, hg, util
10 from demandload import *
10 from demandload import *
11 demandload(globals(), "mdiff time hgweb traceback random signal errno")
11 demandload(globals(), "mdiff time hgweb traceback random signal errno version")
12
12
13 class UnknownCommand(Exception): pass
13 class UnknownCommand(Exception): pass
14
14
@@ -134,6 +134,16 b' def show_changeset(ui, repo, rev=0, chan'
134 ui.status("summary: %s\n" % description.splitlines()[0])
134 ui.status("summary: %s\n" % description.splitlines()[0])
135 ui.status("\n")
135 ui.status("\n")
136
136
137 def show_version(ui):
138 """output version and copyright information"""
139 ui.write("Mercurial version %s\n" % version.get_version())
140 ui.status(
141 "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n"
142 "This is free software; see the source for copying conditions. "
143 "There is NO\nwarranty; "
144 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
145 )
146
137 def help(ui, cmd=None):
147 def help(ui, cmd=None):
138 '''show help for a given command or all commands'''
148 '''show help for a given command or all commands'''
139 if cmd:
149 if cmd:
@@ -156,7 +166,10 b' def help(ui, cmd=None):'
156 ui.warn("hg: unknown command %s\n" % cmd)
166 ui.warn("hg: unknown command %s\n" % cmd)
157 sys.exit(0)
167 sys.exit(0)
158 else:
168 else:
159 ui.status('hg commands:\n\n')
169 if not ui.quiet:
170 show_version(ui)
171 ui.write('\n')
172 ui.write('hg commands:\n\n')
160
173
161 h = {}
174 h = {}
162 for e in table.values():
175 for e in table.values():
@@ -171,7 +184,7 b' def help(ui, cmd=None):'
171 fns.sort()
184 fns.sort()
172 m = max(map(len, fns))
185 m = max(map(len, fns))
173 for f in fns:
186 for f in fns:
174 ui.status(' %-*s %s\n' % (m, f, h[f]))
187 ui.write(' %-*s %s\n' % (m, f, h[f]))
175
188
176 # Commands start here, listed alphabetically
189 # Commands start here, listed alphabetically
177
190
@@ -724,7 +737,7 b' table = {'
724 "verify": (verify, [], 'hg verify'),
737 "verify": (verify, [], 'hg verify'),
725 }
738 }
726
739
727 norepo = "init branch help debugindex debugindexdot"
740 norepo = "init version help debugindex debugindexdot"
728
741
729 def find(cmd):
742 def find(cmd):
730 i = None
743 i = None
@@ -749,6 +762,7 b' def dispatch(args):'
749 ('q', 'quiet', None, 'quiet'),
762 ('q', 'quiet', None, 'quiet'),
750 ('p', 'profile', None, 'profile'),
763 ('p', 'profile', None, 'profile'),
751 ('y', 'noninteractive', None, 'run non-interactively'),
764 ('y', 'noninteractive', None, 'run non-interactively'),
765 ('', 'version', None, 'output version information and exit'),
752 ]
766 ]
753
767
754 args = fancyopts.fancyopts(args, opts, options,
768 args = fancyopts.fancyopts(args, opts, options,
@@ -762,6 +776,10 b' def dispatch(args):'
762 u = ui.ui(options["verbose"], options["debug"], options["quiet"],
776 u = ui.ui(options["verbose"], options["debug"], options["quiet"],
763 not options["noninteractive"])
777 not options["noninteractive"])
764
778
779 if options["version"]:
780 show_version(u)
781 sys.exit(0)
782
765 try:
783 try:
766 i = find(cmd)
784 i = find(cmd)
767 except UnknownCommand:
785 except UnknownCommand:
@@ -1365,9 +1365,15 b' class remoterepository:'
1365 self.ui = ui
1365 self.ui = ui
1366 no_list = [ "localhost", "127.0.0.1" ]
1366 no_list = [ "localhost", "127.0.0.1" ]
1367 host = ui.config("http_proxy", "host")
1367 host = ui.config("http_proxy", "host")
1368 if host is None:
1369 host = os.environ.get("http_proxy")
1370 if host and host.startswith('http://'):
1371 host = host[7:]
1368 user = ui.config("http_proxy", "user")
1372 user = ui.config("http_proxy", "user")
1369 passwd = ui.config("http_proxy", "passwd")
1373 passwd = ui.config("http_proxy", "passwd")
1370 no = ui.config("http_proxy", "no")
1374 no = ui.config("http_proxy", "no")
1375 if no is None:
1376 no = os.environ.get("no_proxy")
1371 if no:
1377 if no:
1372 no_list = no_list + no.split(",")
1378 no_list = no_list + no.split(",")
1373
1379
@@ -1380,6 +1386,9 b' class remoterepository:'
1380
1386
1381 # Note: urllib2 takes proxy values from the environment and those will
1387 # Note: urllib2 takes proxy values from the environment and those will
1382 # take precedence
1388 # take precedence
1389 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
1390 if os.environ.has_key(env):
1391 del os.environ[env]
1383
1392
1384 proxy_handler = urllib2.BaseHandler()
1393 proxy_handler = urllib2.BaseHandler()
1385 if host and not no_proxy:
1394 if host and not no_proxy:
@@ -9,25 +9,34 b' import glob'
9 from distutils.core import setup, Extension
9 from distutils.core import setup, Extension
10 from distutils.command.install_data import install_data
10 from distutils.command.install_data import install_data
11
11
12 import mercurial.version
13
14 # specify version string, otherwise 'hg identify' will be used:
15 version = ''
16
12 class install_package_data(install_data):
17 class install_package_data(install_data):
13 def finalize_options(self):
18 def finalize_options(self):
14 self.set_undefined_options('install',
19 self.set_undefined_options('install',
15 ('install_lib', 'install_dir'))
20 ('install_lib', 'install_dir'))
16 install_data.finalize_options(self)
21 install_data.finalize_options(self)
17
22
18 setup(name='mercurial',
23 try:
19 version='0.5b',
24 mercurial.version.remember_version(version)
20 author='Matt Mackall',
25 setup(name='mercurial',
21 author_email='mpm@selenic.com',
26 version=mercurial.version.get_version(),
22 url='http://selenic.com/mercurial',
27 author='Matt Mackall',
23 description='scalable distributed SCM',
28 author_email='mpm@selenic.com',
24 license='GNU GPL',
29 url='http://selenic.com/mercurial',
25 packages=['mercurial'],
30 description='scalable distributed SCM',
26 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
31 license='GNU GPL',
27 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
32 packages=['mercurial'],
28 data_files=[('mercurial/templates',
33 ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c']),
29 ['templates/map'] +
34 Extension('mercurial.bdiff', ['mercurial/bdiff.c'])],
30 glob.glob('templates/map-*') +
35 data_files=[('mercurial/templates',
31 glob.glob('templates/*.tmpl'))],
36 ['templates/map'] +
32 cmdclass = { 'install_data' : install_package_data },
37 glob.glob('templates/map-*') +
33 scripts=['hg', 'hgmerge'])
38 glob.glob('templates/*.tmpl'))],
39 cmdclass = { 'install_data' : install_package_data },
40 scripts=['hg', 'hgmerge'])
41 finally:
42 mercurial.version.forget_version()
@@ -2,10 +2,10 b''
2
2
3 set -x
3 set -x
4
4
5 hg help
5 hg -q help
6 hg add -h
6 hg add -h
7 hg help diff
7 hg help diff
8 hg help foo
8 hg help foo
9 hg commands
9 hg -q commands
10
10
11 exit 0 No newline at end of file
11 exit 0
@@ -1,4 +1,4 b''
1 + hg help
1 + hg -q help
2 hg commands:
2 hg commands:
3
3
4 add add the specified files on the next commit
4 add add the specified files on the next commit
@@ -46,7 +46,7 b' hg diff [-r A] [-r B] [files]'
46 diff working directory (or selected files)
46 diff working directory (or selected files)
47 + hg help foo
47 + hg help foo
48 hg: unknown command foo
48 hg: unknown command foo
49 + hg commands
49 + hg -q commands
50 hg: unknown command 'commands'
50 hg: unknown command 'commands'
51 hg commands:
51 hg commands:
52
52
General Comments 0
You need to be logged in to leave comments. Login now