def svndump_transform_revprop_cmdline(appname, args): """ Parses the commandline and executes the transformation. Usage: >>> svndump_transform_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s propname regex replace source destination" % appname parser = OptionParser(usage=usage, version="%prog " + __version) (options, args) = parser.parse_args(args) if len(args) != 5: print "specify exactly one propname to transform, one regex to match the value against,\none replacement string, one source dump file and one destination dump file." return 1 copy_dump_file(args[3], args[4], RevisionPropertyTransformer(args[0], args[1], args[2])) return 0
def svndump_copy_cmdline(appname, args): """ Parses the commandline and executes the copy. Usage: >>> svndump_copy_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s [options] source destination" % appname parser = OptionParser(usage=usage, version="%prog " + __version) (options, args) = parser.parse_args(args) if len(args) != 2: print "specify exactly one source and one destination dump file." return 1 copy_dump_file(args[0], args[1]) return 0
def svndump_copy_cmdline( appname, args ): """ Parses the commandline and executes the copy. Usage: >>> svndump_copy_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s [options] source destination" % appname parser = OptionParser( usage=usage, version="%prog "+__version ) (options, args) = parser.parse_args( args ) if len( args ) != 2: print "specify exactly one source and one destination dump file." return 1 copy_dump_file( args[0], args[1] ) return 0
def svndump_transform_revprop_cmdline( appname, args ): """ Parses the commandline and executes the transformation. Usage: >>> svndump_transform_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s propname regex replace source destination" % appname parser = OptionParser( usage=usage, version="%prog "+__version ) (options, args) = parser.parse_args( args ) if len( args ) != 5: print "specify exactly one propname to transform, one regex to match the value against,\none replacement string, one source dump file and one destination dump file." return 1 copy_dump_file( args[3], args[4], RevisionPropertyTransformer( args[0], args[1], args[2] ) ) return 0
def svndump_eolfix_prop_cmdline(appname, args): """ Parses the commandline and executes the transformation. Usage: >>> svndump_eolfix_prop_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s propname source destination" % appname parser = OptionParser(usage=usage, version="%prog " + __version) (options, args) = parser.parse_args(args) if len(args) != 3: print("specify exactly one propname to fix EOL, one source dump file and one destination dump file.") return 1 copy_dump_file(args[1], args[2], EolPropertyTransformer(args[0])) return 0
def svndump_eolfix_prop_cmdline(appname, args): """ Parses the commandline and executes the transformation. Usage: >>> svndump_eolfix_prop_cmdline( sys.argv[0], sys.argv[1:] ) @type appname: string @param appname: Name of the application (used in help text). @type args: list( string ) @param args: Commandline arguments. @rtype: integer @return: Return code (0 = OK). """ usage = "usage: %s propname source destination" % appname parser = OptionParser(usage=usage, version="%prog " + __version) (options, args) = parser.parse_args(args) if len(args) != 3: print( "specify exactly one propname to fix EOL, one source dump file and one destination dump file." ) return 1 copy_dump_file(args[1], args[2], EolPropertyTransformer(args[0])) return 0
def test_dumps(params): """Test 1: Test creating dumps.""" # get params tempdir = params["tempdir"] tempfiles = params["tempfiles"] temprepos = params["temprepos"] tempwc = params["tempwc"] # test1: create a dump with commandline and python classes then compare svndmp = tempdir + "/test_dumps_svn" pydmp = tempdir + "/test_dumps_py1" pydmp2 = tempdir + "/test_dumps_py2" # create with cmdline svn_create_dump_file(svndmp, "test1", data_test1, temprepos, tempwc) # create with python py_create_dump_file(pydmp, "test1", data_test1, tempfiles) # copy the one created with cmdline svndump.copy_dump_file(svndmp, pydmp2) # compare svndmp and pydmp2 rc = run("diff -u '%s' '%s'" % (svndmp, pydmp2)) add_test_result(params, "test_dumps", "gnu diff svndmp pydmp2", rc) if rc != 0: print("diffs found :(") return 1 rc = svndump_diff_cmdline("svndumptest.py", [svndmp, pydmp2]) add_test_result(params, "test_dumps", "diff svndmp pydmp2", rc) if rc != 0: print("diffs found :(") return 1 # compare svndmp and pydmp rc = svndump_diff_cmdline("svndumptest.py", ["-IUUID", "-IRevDate", "-IRevDateStr", "--ignore-revprop=svn:date", svndmp, pydmp]) add_test_result(params, "test_dumps", "diff svndmp pydmp", rc) if rc != 0: print("diffs found :(") return 1 # done. return 0