2126
2125
if revision is not None and revision[0].get_branch() is not None:
2127
2126
b = Branch.open(revision[0].get_branch())
2129
return self._run(tree, b, relpath, filename, revision,
2134
def _run(self, tree, b, relpath, filename, revision, name_from_revision):
2128
2135
if tree is None:
2129
2136
tree = b.basis_tree()
2130
2137
if revision is None:
2687
2694
branch1 = Branch.open_containing(branch)[0]
2688
2695
branch2 = Branch.open_containing(other)[0]
2690
last1 = ensure_null(branch1.last_revision())
2691
last2 = ensure_null(branch2.last_revision())
2693
graph = branch1.repository.get_graph(branch2.repository)
2694
base_rev_id = graph.find_unique_lca(last1, last2)
2696
print 'merge base is revision %s' % base_rev_id
2700
last1 = ensure_null(branch1.last_revision())
2701
last2 = ensure_null(branch2.last_revision())
2703
graph = branch1.repository.get_graph(branch2.repository)
2704
base_rev_id = graph.find_unique_lca(last1, last2)
2706
print 'merge base is revision %s' % base_rev_id
2699
2713
class cmd_merge(Command):
3092
3106
The working tree contains a list of pending merged revisions, which will
3093
3107
be included as parents in the next commit. Normally, revert clears that
3094
list as well as reverting the files. If any files, are specified, revert
3095
leaves the pending merge list alnone and reverts only the files. Use "bzr
3108
list as well as reverting the files. If any files are specified, revert
3109
leaves the pending merge list alone and reverts only the files. Use "bzr
3096
3110
revert ." in the tree root to revert all files but keep the merge record,
3097
3111
and "bzr revert --forget-merges" to clear the pending merge list without
3098
3112
reverting any files.
3422
3436
takes_options = ['revision']
3424
3438
def run(self, revision_id_list=None, revision=None):
3425
import bzrlib.gpg as gpg
3426
3439
if revision_id_list is not None and revision is not None:
3427
3440
raise errors.BzrCommandError('You can only supply one of revision_id or --revision')
3428
3441
if revision_id_list is None and revision is None:
3429
3442
raise errors.BzrCommandError('You must supply either --revision or a revision_id')
3430
3443
b = WorkingTree.open_containing(u'.')[0].branch
3446
return self._run(b, revision_id_list, revision)
3450
def _run(self, b, revision_id_list, revision):
3451
import bzrlib.gpg as gpg
3431
3452
gpg_strategy = gpg.GPGStrategy(b.get_config())
3432
3453
if revision_id_list is not None:
3433
for revision_id in revision_id_list:
3434
b.repository.sign_revision(revision_id, gpg_strategy)
3454
b.repository.start_write_group()
3456
for revision_id in revision_id_list:
3457
b.repository.sign_revision(revision_id, gpg_strategy)
3459
b.repository.abort_write_group()
3462
b.repository.commit_write_group()
3435
3463
elif revision is not None:
3436
3464
if len(revision) == 1:
3437
3465
revno, rev_id = revision[0].in_history(b)
3438
b.repository.sign_revision(rev_id, gpg_strategy)
3466
b.repository.start_write_group()
3468
b.repository.sign_revision(rev_id, gpg_strategy)
3470
b.repository.abort_write_group()
3473
b.repository.commit_write_group()
3439
3474
elif len(revision) == 2:
3440
3475
# are they both on rh- if so we can walk between them
3441
3476
# might be nice to have a range helper for arbitrary
3446
3481
to_revno = b.revno()
3447
3482
if from_revno is None or to_revno is None:
3448
3483
raise errors.BzrCommandError('Cannot sign a range of non-revision-history revisions')
3449
for revno in range(from_revno, to_revno + 1):
3450
b.repository.sign_revision(b.get_rev_id(revno),
3484
b.repository.start_write_group()
3486
for revno in range(from_revno, to_revno + 1):
3487
b.repository.sign_revision(b.get_rev_id(revno),
3490
b.repository.abort_write_group()
3493
b.repository.commit_write_group()
3453
3495
raise errors.BzrCommandError('Please supply either one revision, or a range.')
3965
4007
outfile = open(output, 'wb')
3967
4009
branch = Branch.open_containing(from_)[0]
4010
# we may need to write data into branch's repository to calculate
3968
4013
if output is None:
3969
4014
config = branch.get_config()
3970
4015
if mail_to is None: