421
421
If the message is not supplied, the message from revision_id will be
422
422
used for the commit.
424
t_revision_id = revision_id
425
if revision_id == 'null:':
427
t = testament.StrictTestament3.from_revision(repository, t_revision_id)
428
submit_branch = _mod_branch.Branch.open(target_branch)
429
if submit_branch.get_public_branch() is not None:
430
target_branch = submit_branch.get_public_branch()
431
if patch_type is None:
435
submit_revision_id = submit_branch.last_revision()
436
submit_revision_id = _mod_revision.ensure_null(submit_revision_id)
437
repository.fetch(submit_branch.repository, submit_revision_id)
438
graph = repository.get_graph()
439
ancestor_id = graph.find_unique_lca(revision_id,
441
if patch_type in ('bundle', 'diff'):
442
patch = klass._generate_diff(repository, revision_id,
444
if patch_type == 'bundle':
445
bundle = klass._generate_bundle(repository, revision_id,
446
ancestor_id).encode('base-64')
426
repository.lock_write()
427
locked.append(repository)
428
t_revision_id = revision_id
429
if revision_id == 'null:':
431
t = testament.StrictTestament3.from_revision(repository,
433
submit_branch = _mod_branch.Branch.open(target_branch)
434
submit_branch.lock_read()
435
locked.append(submit_branch)
436
if submit_branch.get_public_branch() is not None:
437
target_branch = submit_branch.get_public_branch()
438
if patch_type is None:
450
if public_branch is not None and patch_type != 'bundle':
451
public_branch_obj = _mod_branch.Branch.open(public_branch)
452
if not public_branch_obj.repository.has_revision(revision_id):
453
raise errors.PublicBranchOutOfDate(public_branch,
442
submit_revision_id = submit_branch.last_revision()
443
submit_revision_id = _mod_revision.ensure_null(
445
repository.fetch(submit_branch.repository, submit_revision_id)
446
graph = repository.get_graph()
447
ancestor_id = graph.find_unique_lca(revision_id,
449
if patch_type in ('bundle', 'diff'):
450
patch = klass._generate_diff(repository, revision_id,
452
if patch_type == 'bundle':
453
bundle = klass._generate_bundle(repository, revision_id,
454
ancestor_id).encode('base-64')
458
if public_branch is not None and patch_type != 'bundle':
459
public_branch_obj = _mod_branch.Branch.open(public_branch)
460
public_branch_obj.lock_read
461
locked.append(public_branch_obj)
462
if not public_branch_obj.repository.has_revision(
464
raise errors.PublicBranchOutOfDate(public_branch,
467
for entry in reversed(locked):
456
469
return klass(revision_id, t.as_sha1(), time, timezone, target_branch,
457
470
patch, public_branch, message, bundle)