1916
1916
Ignore class files in all directories::
1918
bzr ignore '*.class'
1920
Ignore .o files under the lib directory::
1922
bzr ignore 'lib/**/*.o'
1924
Ignore .o files under the lib directory::
1926
bzr ignore 'RE:lib/.*\.o'
1918
bzr ignore "*.class"
1920
Ignore .o files under the lib directory::
1922
bzr ignore "lib/**/*.o"
1924
Ignore .o files under the lib directory::
1926
bzr ignore "RE:lib/.*\.o"
1929
1929
_see_also = ['status', 'ignored']
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:
2438
2445
Set the current user::
2440
bzr whoami 'Frank Chu <fchu@example.com>'
2447
bzr whoami "Frank Chu <fchu@example.com>"
2442
2449
takes_options = [ Option('email',
2443
2450
help='Display email address only.'),
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):
2817
2831
merger = _mod_merge.Merger.from_uncommitted(tree, other_tree,
2819
2833
allow_pending = False
2834
if other_path != '':
2835
merger.interesting_files = [other_path]
2821
2837
if merger is None:
2822
2838
merger, allow_pending = self._get_merger_from_branch(tree,
3072
3088
last committed revision is used.
3074
3090
To remove only some changes, without reverting to a prior version, use
3075
merge instead. For example, "merge . --r-2..-3" will remove the changes
3076
introduced by -2, without affecting the changes introduced by -1. Or
3077
to remove certain changes on a hunk-by-hunk basis, see the Shelf plugin.
3091
merge instead. For example, "merge . --revision -2..-3" will remove the
3092
changes introduced by -2, without affecting the changes introduced by -1.
3093
Or to remove certain changes on a hunk-by-hunk basis, see the Shelf plugin.
3079
3095
By default, any files that have been manually changed will be backed up
3080
3096
first. (Files changed only by merge are not backed up.) Backup files have
3422
3438
takes_options = ['revision']
3424
3440
def run(self, revision_id_list=None, revision=None):
3425
import bzrlib.gpg as gpg
3426
3441
if revision_id_list is not None and revision is not None:
3427
3442
raise errors.BzrCommandError('You can only supply one of revision_id or --revision')
3428
3443
if revision_id_list is None and revision is None:
3429
3444
raise errors.BzrCommandError('You must supply either --revision or a revision_id')
3430
3445
b = WorkingTree.open_containing(u'.')[0].branch
3448
return self._run(b, revision_id_list, revision)
3452
def _run(self, b, revision_id_list, revision):
3453
import bzrlib.gpg as gpg
3431
3454
gpg_strategy = gpg.GPGStrategy(b.get_config())
3432
3455
if revision_id_list is not None:
3433
for revision_id in revision_id_list:
3434
b.repository.sign_revision(revision_id, gpg_strategy)
3456
b.repository.start_write_group()
3458
for revision_id in revision_id_list:
3459
b.repository.sign_revision(revision_id, gpg_strategy)
3461
b.repository.abort_write_group()
3464
b.repository.commit_write_group()
3435
3465
elif revision is not None:
3436
3466
if len(revision) == 1:
3437
3467
revno, rev_id = revision[0].in_history(b)
3438
b.repository.sign_revision(rev_id, gpg_strategy)
3468
b.repository.start_write_group()
3470
b.repository.sign_revision(rev_id, gpg_strategy)
3472
b.repository.abort_write_group()
3475
b.repository.commit_write_group()
3439
3476
elif len(revision) == 2:
3440
3477
# are they both on rh- if so we can walk between them
3441
3478
# might be nice to have a range helper for arbitrary
3446
3483
to_revno = b.revno()
3447
3484
if from_revno is None or to_revno is None:
3448
3485
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),
3486
b.repository.start_write_group()
3488
for revno in range(from_revno, to_revno + 1):
3489
b.repository.sign_revision(b.get_rev_id(revno),
3492
b.repository.abort_write_group()
3495
b.repository.commit_write_group()
3453
3497
raise errors.BzrCommandError('Please supply either one revision, or a range.')
3652
3696
from bzrlib.smart import medium, server
3653
3697
from bzrlib.transport import get_transport
3654
3698
from bzrlib.transport.chroot import ChrootServer
3655
from bzrlib.transport.remote import BZR_DEFAULT_PORT, BZR_DEFAULT_INTERFACE
3656
3699
if directory is None:
3657
3700
directory = os.getcwd()
3658
3701
url = urlutils.local_path_to_url(directory)
3665
3708
smart_server = medium.SmartServerPipeStreamMedium(
3666
3709
sys.stdin, sys.stdout, t)
3668
host = BZR_DEFAULT_INTERFACE
3711
host = medium.BZR_DEFAULT_INTERFACE
3669
3712
if port is None:
3670
port = BZR_DEFAULT_PORT
3713
port = medium.BZR_DEFAULT_PORT
3672
3715
if ':' in port:
3673
3716
host, port = port.split(':')
3965
4008
outfile = open(output, 'wb')
3967
4010
branch = Branch.open_containing(from_)[0]
4011
# we may need to write data into branch's repository to calculate
3968
4014
if output is None:
3969
4015
config = branch.get_config()
3970
4016
if mail_to is None:
4278
4325
reconfiguration.apply(force)
4328
class cmd_switch(Command):
4329
"""Set the branch of a lightweight checkout and update."""
4331
takes_args = ['to_location']
4333
def run(self, to_location):
4334
from bzrlib import switch
4335
to_branch = Branch.open(to_location)
4337
control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
4338
switch.switch(control_dir, to_branch)
4339
note('Switched to branch: %s',
4340
urlutils.unescape_for_display(to_branch.base, 'utf-8'))
4281
4343
def _create_prefix(cur_transport):
4282
4344
needed = [cur_transport]
4283
4345
# Recurse upwards until we can create a directory successfully