예제 #1
0
    def setUp(self):
        dumpfile = open(
            os.path.join(os.path.split(__file__)[0], 'test.dumpfile'))

        # Just in case a preivous test instance was not properly cleaned up
        self.tearDown()
        self.repos = LocalRepository(repos_location, create=True)
        self.repos.load(dumpfile)

        self.repos = RemoteRepository(repos_url)
예제 #2
0
def main():
    """
    Script execution starts here.
    """

    parser = OptionParser(usage=USAGE)
    parser.add_option("-u",
                      "",
                      dest="username",
                      help="commit the changes as USERNAME")
    parser.add_option("-p",
                      "",
                      dest="password",
                      help="commit the changes with PASSWORD")
    parser.add_option("-r", "", dest="rev", help="revision range")

    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.print_help()
        sys.exit(1)

    csvn.core.svn_cmdline_init("", csvn.core.stderr)
    repos_url = args[0]
    revs = options.rev
    if revs and ":" in revs:
        [start_rev, end_rev] = revs.split(":")
    elif revs:
        start_rev = revs
        end_rev = revs
    else:
        start_rev = 1
        end_rev = "HEAD"

    session = RemoteRepository(repos_url,
                               user=User(options.username, options.password))

    if end_rev == "HEAD":
        end_rev = session.latest_revnum()
    if start_rev == "HEAD":
        start_rev = session.latest_revnum()
    start_rev = int(start_rev)
    end_rev = int(end_rev)

    for entry in session.log(start_rev, end_rev):
        new_log = re.sub(r'(r\d+)', repl_newrev, entry.message)
        session.revprop_set(propname='svn:log',
                            propval=new_log,
                            revnum=entry.revision,
                            force=True)
예제 #3
0
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)
예제 #4
0
            # It's legal to make a copy of the repository root,
            # 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])