-
Notifications
You must be signed in to change notification settings - Fork 43
/
cvs2git
executable file
·72 lines (58 loc) · 2.18 KB
/
cvs2git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2000-2008 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision
# history and logs.
# ====================================================================
import sys
# Make sure that a supported version of Python is being used. Do this
# as early as possible, using only code compatible with Python 1.5.2
# and Python 3.x before the check. Remember:
#
# Python 1.5.2 doesn't have sys.version_info or ''.join().
# Python 3.0 doesn't have string.join().
# There are plans to start deprecating the string formatting '%'
# operator in Python 3.1 (but we use it here anyway).
version_error = """\
ERROR: cvs2git requires Python 2, version 2.4 or later; it does not
work with Python 3. You are currently using"""
version_advice = """\
Please restart cvs2git using a different version of the Python
interpreter. Visit http://www.python.org or consult your local system
administrator if you need help.
HINT: If you already have a usable Python version installed, it might
be possible to invoke cvs2git with the correct Python interpreter by
typing something like 'python2.5 """ + sys.argv[0] + """ [...]'.
"""
try:
version = sys.version_info
except AttributeError:
# This is probably a pre-2.0 version of Python.
sys.stderr.write(version_error + '\n')
sys.stderr.write('-'*70 + '\n')
sys.stderr.write(sys.version + '\n')
sys.stderr.write('-'*70 + '\n')
sys.stderr.write(version_advice)
sys.exit(1)
if not ((2,4) <= version < (3,0)):
sys.stderr.write(
version_error + ' version %d.%d.%d.\n'
% (version[0], version[1], version[2],)
)
sys.stderr.write(version_advice)
sys.exit(1)
import os
from cvs2svn_lib.common import FatalException
from cvs2svn_lib.main import git_main
try:
git_main(os.path.basename(sys.argv[0]), sys.argv[1:])
except FatalException, e:
sys.stderr.write(str(e) + '\n')
sys.exit(1)