def new_commit(self, parent, tree, date, msg): """Create a commit object in the pack.""" userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) commit = self._new_commit(tree, parent, userline, date, userline, date, msg) return commit
def append_commit(name, hash, parent, cp, writer, opt): now = time.time() items = get_commit_items(hash, cp) tree = items.tree.decode('hex') author = '%s <%s>' % (items.author_name, items.author_mail) author_time = (items.author_sec, items.author_offset) committer = '%s <%s@%s>' % (userfullname(), username(), hostname()) get_random_item(name, hash, cp, writer, opt) c = writer.new_commit(tree, parent, author, items.author_sec, items.author_offset, committer, now, None, items.message) return (c, tree)
def append_commit(name, hash, parent, src_repo, writer, opt): now = time.time() items = parse_commit(get_cat_data(src_repo.cat(hash), 'commit')) tree = items.tree.decode('hex') author = '%s <%s>' % (items.author_name, items.author_mail) author_time = (items.author_sec, items.author_offset) committer = '%s <%s@%s>' % (userfullname(), username(), hostname()) get_random_item(name, tree.encode('hex'), src_repo, writer, opt) c = writer.new_commit(tree, parent, author, items.author_sec, items.author_offset, committer, now, None, items.message) return c, tree
def handle_append(item, repo, cp, writer, opt, fatal): assert(item.spec.method == 'append') assert(item.src.type in ('branch', 'save', 'commit', 'tree')) assert(item.dest.type == 'branch' or not item.dest.type) hex_src = item.src.hash.encode('hex') if item.src.type == 'tree': get_random_item(item.spec.src, hex_src, cp, writer, opt) parent = item.dest.hash msg = 'bup save\n\nGenerated by command:\n%r\n' % sys.argv userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) now = time.time() commit = writer.new_commit(item.src.hash, parent, userline, now, None, userline, now, None, msg) return commit, item.src.hash commits = [c for d, c in git.rev_list(hex_src, repo_dir=repo)] commits.reverse() return append_commits(commits, item.spec.src, item.dest.hash, cp, writer, opt)
def handle_append(item, src_repo, writer, opt): assert item.spec.method == 'append' assert item.src.type in ('branch', 'save', 'commit', 'tree') assert item.dest.type == 'branch' or not item.dest.type src_oidx = item.src.hash.encode('hex') if item.src.type == 'tree': get_random_item(item.spec.src, src_oidx, src_repo, writer, opt) parent = item.dest.hash msg = 'bup save\n\nGenerated by command:\n%r\n' % sys.argv userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) now = time.time() commit = writer.new_commit(item.src.hash, parent, userline, now, None, userline, now, None, msg) return commit, item.src.hash commits = list(src_repo.rev_list(src_oidx)) commits.reverse() return append_commits(commits, item.spec.src, item.dest.hash, src_repo, writer, opt)
for (blob, level) in it: hashsplit.total_split += len(blob) if opt.copy: sys.stdout.write(str(blob)) megs = hashsplit.total_split / 1024 / 1024 if not opt.quiet and last != megs: last = megs if opt.verbose: log('\n') if opt.tree: print tree.encode('hex') if opt.commit or opt.name: msg = 'bup split\n\nGenerated by command:\n%r\n' % sys.argv ref = opt.name and ('refs/heads/%s' % opt.name) or None userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) commit = pack_writer.new_commit(tree, oldref, userline, date, None, userline, date, None, msg) if opt.commit: print commit.encode('hex') if pack_writer: pack_writer.close() # must close before we can update the ref if opt.name: if cli: cli.update_ref(refname, commit, oldref) else: git.update_ref(refname, commit, oldref) if cli:
for (blob, level) in it: hashsplit.total_split += len(blob) if opt.copy: sys.stdout.write(str(blob)) megs = hashsplit.total_split // 1024 // 1024 if not opt.quiet and last != megs: last = megs if opt.verbose: log('\n') if opt.tree: print(tree.encode('hex')) if opt.commit or opt.name: msg = 'bup split\n\nGenerated by command:\n%r\n' % sys.argv ref = opt.name and ('refs/heads/%s' % opt.name) or None userline = '%s <%s@%s>' % (userfullname(), username(), hostname()) commit = pack_writer.new_commit(tree, oldref, userline, date, None, userline, date, None, msg) if opt.commit: print(commit.encode('hex')) if pack_writer: pack_writer.close() # must close before we can update the ref if opt.name: if cli: cli.update_ref(refname, commit, oldref) else: git.update_ref(refname, commit, oldref) if cli:
for (blob, level) in it: hashsplit.total_split += len(blob) if opt.copy: sys.stdout.write(str(blob)) megs = hashsplit.total_split / 1024 / 1024 if not opt.quiet and last != megs: last = megs if opt.verbose: log("\n") if opt.tree: print tree.encode("hex") if opt.commit or opt.name: msg = "bup split\n\nGenerated by command:\n%r\n" % sys.argv ref = opt.name and ("refs/heads/%s" % opt.name) or None userline = "%s <%s@%s>" % (userfullname(), username(), hostname()) commit = pack_writer.new_commit(tree, oldref, userline, date, None, userline, date, None, msg) if opt.commit: print commit.encode("hex") if pack_writer: pack_writer.close() # must close before we can update the ref if opt.name: if cli: cli.update_ref(refname, commit, oldref) else: git.update_ref(refname, commit, oldref) if cli: cli.close()