-
Notifications
You must be signed in to change notification settings - Fork 1
/
svndumptool.py
executable file
·120 lines (113 loc) · 4.87 KB
/
svndumptool.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env python
#===============================================================================
#
# Copyright (C) 2003 Martin Furter <[email protected]>
#
# This file is part of SvnDumpTool
#
# SvnDumpTool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# SvnDumpTool is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SvnDumpTool; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
#===============================================================================
import sys
from svndump import __version
from svndump.cvs2svnfix import svndump_cvs2svnfix_cmdline
from svndump.diff import svndump_diff_cmdline
from svndump.edit import svndump_edit_cmdline
from svndump.eolfix import svndump_eol_fix_cmdline
from svndump.merge import svndump_merge_cmdline
from svndump.props import svndump_transform_revprop_cmdline, \
svndump_transform_prop_cmdline, \
svndump_apply_autoprops_cmdline
from svndump.sanitize import svndump_sanitize_cmdline
from svndump.tools import svndump_copy_cmdline, svndump_export_cmdline, \
svndump_check_cmdline, svndump_log_cmdline, \
svndump_ls_cmdline, \
svndump_join_cmdline, svndump_split_cmdline
__commands = {
"apply-autoprops": svndump_apply_autoprops_cmdline,
"check": svndump_check_cmdline,
"copy": svndump_copy_cmdline,
"cvs2svnfix": svndump_cvs2svnfix_cmdline,
"diff": svndump_diff_cmdline,
"edit": svndump_edit_cmdline,
"eolfix": svndump_eol_fix_cmdline,
"export": svndump_export_cmdline,
"join": svndump_join_cmdline,
"log": svndump_log_cmdline,
"ls": svndump_ls_cmdline,
"merge": svndump_merge_cmdline,
"sanitize": svndump_sanitize_cmdline,
"split": svndump_split_cmdline,
"transform-prop": svndump_transform_prop_cmdline,
"transform-revprop": svndump_transform_revprop_cmdline,
}
def __help( appname, args ):
rc = 0
if len(args) == 1 and __commands.has_key( args[0] ):
__commands[args[0]]( appname + " " + args[0], [ "-h" ] )
else:
print ""
print "svndumptool.py command [options]"
print ""
print " commands:"
print " apply-autoprops apply auto-props to added files"
print " check check a dump file"
print " copy copy a dump file"
print " cvs2svnfix fix a cvs2svn created dump file"
print " diff show differences between two dump files"
print " edit edit files in a dump file"
print " eolfix fix EOL of text files in a dump"
print " export export files from a dump file"
print " join join dump files"
print " log show the log of a dump file"
print " ls list files of a given revision"
print " merge merge dump files"
print " sanitize sanitize dump files"
print " split split dump files"
print " transform-revprop transform a revision property"
print " transform-prop transform a node property"
print " --version print the version"
print ""
print " use 'svndumptool.py command -h' for help about the commands."
print ""
return rc
def __print_version( appname, args ):
print appname + " " + __version
return 0
if __name__ == '__main__':
appname = sys.argv[0].replace( "\\", "/" )
n = appname.rfind( "/" )
if n >= 0:
appname = appname[n+1:]
pfx = appname[0:7]
cmd = appname[7:-3]
sfx = appname[-3:]
func = __help;
args = []
argidx = 0
if pfx == "svndump" and sfx == ".py" and __commands.has_key( cmd ):
func = __commands[cmd]
argidx = 1
elif len( sys.argv ) > 1:
cmd = sys.argv[1]
if __commands.has_key( cmd ):
func = __commands[cmd]
appname += " " + cmd
elif cmd == "--version":
func = __print_version
argidx = 2
if argidx < len( sys.argv ):
args = sys.argv[argidx:]
sys.exit( func( appname, args ) )