if len(args) != 1: parser.print_help() sys.exit(1) repos_url = args[0] # Initialize variables new_dir_name = "trunk" if options.directory: new_dir_name = options.directory if options.message: commit_message = options.message elif options.file: commit_message = open(options.file).read() else: commit_message = "Move project into new directory '%s'." % new_dir_name svn_cmdline_init("", stderr) s = RemoteRepository(repos_url, user=User(username=options.username)) txn = s.txn() for name in s.list("").keys(): txn.delete(name) txn.copy(src_path="", dest_path=new_dir_name) txn.commit(commit_message)
# so, we should treat copyfrom paths as possible # repository roots may_be_root = (len(action) == 2 and action[0] == "cp") if not may_be_root: arg = arg.dirname() if ancestor: ancestor = ancestor.longest_ancestor(arg) else: ancestor = arg else: action.append(arg) session = RemoteRepository(ancestor, user=User(username=options.username)) txn = session.txn() # Carry out the transaction for action, args in actions: if action == "cp": txn.copy(src_rev=args[1], src_path=args[2], dest_path=args[3]) elif action == "mv": txn.delete(str(args[1])) txn.copy(src_path=args[1], dest_path=args[2]) elif action == "rm": txn.delete(args[1]) elif action == "mkdir": txn.mkdir(args[1]) elif action == "put": txn.upload(local_path=args[1], remote_path=args[2]) elif action == "propset":
if len(args) != 1: parser.print_help() sys.exit(1) repos_url = args[0] # Initialize variables new_dir_name = "trunk" if options.directory: new_dir_name = options.directory if options.message: commit_message = options.message elif options.file: commit_message = file(options.file).read() else: commit_message = "Move project into new directory '%s'." % new_dir_name svn_cmdline_init("", stderr) s = RemoteRepository(repos_url, user=User(username=options.username)) txn = s.txn() for name in s.list("").keys(): txn.delete(name) txn.copy(src_path="", dest_path=new_dir_name) txn.commit(commit_message)