author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Sat, 11 Jul 2009 23:29:31 +0200 | |
changeset 2599 | 22e1ec7bd02a |
parent 2311 | e8262ca32109 |
permissions | -rw-r--r-- |
2311
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
# Copyright (C) 2003-2007 John Goerzen |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
# <jgoerzen@complete.org> |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
# |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
# This program is free software; you can redistribute it and/or modify |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
# it under the terms of the GNU General Public License as published by |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
# the Free Software Foundation; either version 2 of the License, or |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
# (at your option) any later version. |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
# This program is distributed in the hope that it will be useful, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
# GNU General Public License for more details. |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
# |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
# You should have received a copy of the GNU General Public License |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
# along with this program; if not, write to the Free Software |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
from optparse import OptionParser |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
from vcs_support import util, commandver |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
import sys |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
def run(darcsdefault): |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
version = '1.1.4' |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
parser = OptionParser(usage="usage: %prog [options] vendor_source_dir", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
version=version) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
parser.add_option("-w", "--wc", dest="wc", default=".", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
help="Set working copy to WC (defaults to current directory)", metavar="WC") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
parser.add_option("-l", "--log", dest="changelog", metavar="FILE", default=None, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
help="Get changelog text from FILE") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
parser.add_option("-L", "--log-message", dest="logtext", metavar="TEXT", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
default='', help="Log with TEXT") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
34 |
parser.add_option("-s", "--summary", dest="summary", metavar="MSG", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
default=None, help="Set log summary message to MSG, overriding the default") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
36 |
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
37 |
default=False, help="Show more status information") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
38 |
parser.add_option("-f", "--fs-changes-only", action="store_true", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
39 |
dest="fsonly", default=False, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
40 |
help="Disable interactivity and issue no add/rm/mv commands to VCS, use with -n") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
41 |
parser.add_option("-n", "--no-commit", action="store_false", dest="docommit", |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
42 |
default=True, help="Do not commit the changes.") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
43 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
44 |
(options, args) = parser.parse_args() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
45 |
util.verbose = options.verbose |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
46 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
47 |
log = options.logtext + "\n" |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
48 |
if options.changelog: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
49 |
fd = open(options.changelog, "r") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
log += fd.read() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
fd.close() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
if len(args) != 1: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
54 |
parser.error("Failed to specify a path to import.") |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
55 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
56 |
commandver.setscm(darcsdefault) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
57 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
58 |
from vcs_support import vcs_wc, vcs_interact |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
59 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
60 |
wc = vcs_wc.wc(options.wc, verbose = options.verbose, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
61 |
fsonly = options.fsonly) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
62 |
if not wc.gettaggingmethod() in ['explicit', 'tagline']: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
63 |
print "Working directory uses unsupported tagging method %s" % \ |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
64 |
wc.gettaggingmethod() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
65 |
sys.exit(1) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
66 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
67 |
|
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
68 |
iobj = vcs_interact.interaction(wc, args[0], options.docommit, log = log, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
69 |
verbose = options.verbose, |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
70 |
summary = options.summary) |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
71 |
try: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
72 |
iobj.main() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
73 |
finally: |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
74 |
iobj.cleanup() |
e8262ca32109
Add vcs-load-dirs project to thirdparty directory.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
75 |