Esempio n. 1
0
if opt.blobs:
    hashsplit.fanout = 0

start_time = time.time()

refname = opt.name and "refs/heads/%s" % opt.name or None
if opt.remote:
    cli = client.Client(opt.remote)
    oldref = refname and cli.read_ref(refname) or None
    w = cli.new_packwriter()
else:
    cli = None
    oldref = refname and git.read_ref(refname) or None
    w = git.PackWriter()

shalist = hashsplit.split_to_shalist(w, hashsplit.autofiles(extra))
tree = w.new_tree(shalist)

if opt.verbose:
    log("\n")
if opt.blobs:
    for (mode, name, bin) in shalist:
        print bin.encode("hex")
if opt.tree:
    print tree.encode("hex")
if opt.commit or opt.name:
    msg = "bup split\n\nGenerated by command:\n%r" % sys.argv
    ref = opt.name and ("refs/heads/%s" % opt.name) or None
    commit = w.new_commit(oldref, tree, msg)
    if opt.commit:
        print commit.encode("hex")
Esempio n. 2
0
    opt.bench = 1

start_time = time.time()

refname = opt.name and "refs/heads/%s" % opt.name or None
if opt.remote:
    cli = client.Client(opt.remote)
    oldref = refname and cli.read_ref(refname) or None
    cli.sync_indexes()
    w = cli.new_packwriter()
else:
    cli = None
    oldref = refname and git.read_ref(refname) or None
    w = git.PackWriter()

(shalist, tree) = hashsplit.split_to_tree(w, hashsplit.autofiles(extra))

if opt.verbose:
    log("\n")
if opt.blobs:
    for (mode, name, bin) in shalist:
        print bin.encode("hex")
if opt.tree:
    print tree.encode("hex")
if opt.commit or opt.name:
    msg = "bup split\n\nGenerated by command:\n%r" % sys.argv
    ref = opt.name and ("refs/heads/%s" % opt.name) or None
    commit = w.new_commit(oldref, tree, msg)
    if opt.commit:
        print commit.encode("hex")