119
121
This reports on versioned and unknown files, reporting them
120
122
grouped by state. Possible states are:
123
125
Versioned in the working copy but not in the previous revision.
126
128
Versioned in the previous revision but removed or deleted
127
129
in the working copy.
130
132
Path of this file changed from the previous revision;
131
133
the text may also have changed. This includes files whose
132
134
parent directory was renamed.
135
137
Text has changed since the previous revision.
140
File kind has been changed (e.g. from file to directory).
138
143
Not versioned and not matching an ignore pattern.
140
145
To see ignored files use 'bzr ignored'. For details in the
141
146
changes to file texts, use 'bzr diff'.
143
--short gives a one character status flag for each item, similar
144
to the SVN's status command.
148
--short gives a status flags for each item, similar to the SVN's status
151
Column 1: versioning / renames
157
P Entry for a pending merge (not a file)
166
* The execute bit was changed
146
168
If no arguments are specified, the status of the entire working
147
169
directory is shown. Otherwise, only the status of the specified
510
535
location can be accessed.
513
takes_options = ['remember', 'overwrite', 'revision', 'verbose']
538
takes_options = ['remember', 'overwrite', 'revision', 'verbose',
540
help='branch to pull into, '
541
'rather than the one containing the working directory',
514
546
takes_args = ['location?']
515
547
encoding_type = 'replace'
517
def run(self, location=None, remember=False, overwrite=False, revision=None, verbose=False):
549
def run(self, location=None, remember=False, overwrite=False,
550
revision=None, verbose=False,
518
552
# FIXME: too much stuff is in the command class
553
if directory is None:
520
tree_to = WorkingTree.open_containing(u'.')[0]
556
tree_to = WorkingTree.open_containing(directory)[0]
521
557
branch_to = tree_to.branch
522
558
except errors.NoWorkingTree:
524
branch_to = Branch.open_containing(u'.')[0]
560
branch_to = Branch.open_containing(directory)[0]
527
563
if location is not None:
605
641
takes_options = ['remember', 'overwrite', 'verbose',
606
Option('create-prefix',
607
help='Create the path leading up to the branch '
608
'if it does not already exist')]
642
Option('create-prefix',
643
help='Create the path leading up to the branch '
644
'if it does not already exist'),
646
help='branch to push from, '
647
'rather than the one containing the working directory',
651
Option('use-existing-dir',
652
help='By default push will fail if the target'
653
' directory exists, but does not already'
654
' have a control directory. This flag will'
655
' allow push to proceed.'),
609
657
takes_args = ['location?']
610
658
encoding_type = 'replace'
612
660
def run(self, location=None, remember=False, overwrite=False,
613
create_prefix=False, verbose=False):
661
create_prefix=False, verbose=False,
662
use_existing_dir=False,
614
664
# FIXME: Way too big! Put this into a function called from the
617
br_from = Branch.open_containing('.')[0]
666
if directory is None:
668
br_from = Branch.open_containing(directory)[0]
618
669
stored_loc = br_from.get_push_location()
619
670
if location is None:
620
671
if stored_loc is None:
629
680
location_url = to_transport.base
685
br_to = repository_to = dir_to = None
633
dir_to = bzrdir.BzrDir.open(location_url)
634
br_to = dir_to.open_branch()
687
dir_to = bzrdir.BzrDir.open_from_transport(to_transport)
635
688
except errors.NotBranchError:
637
to_transport = to_transport.clone('..')
638
if not create_prefix:
689
pass # Didn't find anything
691
# If we can open a branch, use its direct repository, otherwise see
692
# if there is a repository without a branch.
694
br_to = dir_to.open_branch()
695
except errors.NotBranchError:
696
# Didn't find a branch, can we find a repository?
640
relurl = to_transport.relpath(location_url)
641
mutter('creating directory %s => %s', location_url, relurl)
642
to_transport.mkdir(relurl)
643
except errors.NoSuchFile:
644
raise errors.BzrCommandError("Parent directory of %s "
645
"does not exist." % location)
698
repository_to = dir_to.find_repository()
699
except errors.NoRepositoryPresent:
647
current = to_transport.base
648
needed = [(to_transport, to_transport.relpath(location_url))]
702
# Found a branch, so we must have found a repository
703
repository_to = br_to.repository
707
# XXX: Refactor the create_prefix/no_create_prefix code into a
708
# common helper function
710
to_transport.mkdir('.')
711
except errors.FileExists:
712
if not use_existing_dir:
713
raise errors.BzrCommandError("Target directory %s"
714
" already exists, but does not have a valid .bzr"
715
" directory. Supply --use-existing-dir to push"
716
" there anyway." % location)
717
except errors.NoSuchFile:
718
if not create_prefix:
719
raise errors.BzrCommandError("Parent directory of %s"
721
"\nYou may supply --create-prefix to create all"
722
" leading parent directories."
725
cur_transport = to_transport
726
needed = [cur_transport]
727
# Recurse upwards until we can create a directory successfully
729
new_transport = cur_transport.clone('..')
730
if new_transport.base == cur_transport.base:
731
raise errors.BzrCommandError("Failed to create path"
735
new_transport.mkdir('.')
736
except errors.NoSuchFile:
737
needed.append(new_transport)
738
cur_transport = new_transport
742
# Now we only need to create child directories
651
to_transport, relpath = needed[-1]
652
to_transport.mkdir(relpath)
654
except errors.NoSuchFile:
655
new_transport = to_transport.clone('..')
656
needed.append((new_transport,
657
new_transport.relpath(to_transport.base)))
658
if new_transport.base == to_transport.base:
659
raise errors.BzrCommandError("Could not create "
744
cur_transport = needed.pop()
745
cur_transport.mkdir('.')
747
# Now the target directory exists, but doesn't have a .bzr
748
# directory. So we need to create it, along with any work to create
749
# all of the dependent branches, etc.
661
750
dir_to = br_from.bzrdir.clone(location_url,
662
751
revision_id=br_from.last_revision())
663
752
br_to = dir_to.open_branch()
753
count = br_to.last_revision_info()[0]
754
# We successfully created the target, remember it
755
if br_from.get_push_location() is None or remember:
756
br_from.set_push_location(br_to.base)
757
elif repository_to is None:
758
# we have a bzrdir but no branch or repository
759
# XXX: Figure out what to do other than complain.
760
raise errors.BzrCommandError("At %s you have a valid .bzr control"
761
" directory, but not a branch or repository. This is an"
762
" unsupported configuration. Please move the target directory"
763
" out of the way and try again."
766
# We have a repository but no branch, copy the revisions, and then
768
last_revision_id = br_from.last_revision()
769
repository_to.fetch(br_from.repository,
770
revision_id=last_revision_id)
771
br_to = br_from.clone(dir_to, revision_id=last_revision_id)
664
772
count = len(br_to.revision_history())
665
# We successfully created the target, remember it
666
773
if br_from.get_push_location() is None or remember:
667
774
br_from.set_push_location(br_to.base)
775
else: # We have a valid to branch
669
776
# We were able to connect to the remote location, so remember it
670
777
# we don't need to successfully push because of possible divergence.
671
778
if br_from.get_push_location() is None or remember:
1096
1199
takes_args = ['location?']
1097
1200
takes_options = [
1098
RegistryOption('format',
1099
help='Specify a format for this branch. Current'
1100
' formats are: default, knit, metaweave and'
1101
' weave. Default is knit; metaweave and'
1102
' weave are deprecated',
1103
registry=bzrdir.format_registry,
1104
converter=get_format_type,
1105
value_switches=True),
1107
def run(self, location=None, format=None):
1201
RegistryOption('format',
1202
help='Specify a format for this branch. '
1203
'See "help formats".',
1204
registry=bzrdir.format_registry,
1205
converter=bzrdir.format_registry.make_bzrdir,
1206
value_switches=True,
1207
title="Branch Format",
1209
Option('append-revisions-only',
1210
help='Never change revnos or the existing log.'
1211
' Append revisions to it only.')
1213
def run(self, location=None, format=None, append_revisions_only=False):
1108
1214
if format is None:
1109
format = get_format_type('default')
1215
format = bzrdir.format_registry.make_bzrdir('default')
1110
1216
if location is None:
1111
1217
location = u'.'
1154
1267
cd trunk-checkout
1155
1268
(add files here)
1157
takes_args = ["location"]
1270
takes_args = ["location"]
1158
1271
takes_options = [RegistryOption('format',
1159
help='Specify a format for this repository.'
1160
' Current formats are: default, knit,'
1161
' metaweave and weave. Default is knit;'
1162
' metaweave and weave are deprecated',
1272
help='Specify a format for this repository. See'
1273
' "bzr help formats" for details',
1163
1274
registry=bzrdir.format_registry,
1164
converter=get_format_type,
1165
value_switches=True),
1275
converter=bzrdir.format_registry.make_bzrdir,
1276
value_switches=True, title='Repository format'),
1166
1277
Option('trees',
1167
1278
help='Allows branches in repository to have'
1168
1279
' a working tree')]
1169
1280
aliases = ["init-repo"]
1170
1281
def run(self, location, format=None, trees=False):
1171
1282
if format is None:
1172
format = get_format_type('default')
1283
format = bzrdir.format_registry.make_bzrdir('default')
1174
1285
if location is None:
1442
1555
dir, relpath = bzrdir.BzrDir.open_containing(location)
1443
1556
b = dir.open_branch()
1445
if revision is None:
1448
elif len(revision) == 1:
1449
rev1 = rev2 = revision[0].in_history(b).revno
1450
elif len(revision) == 2:
1451
if revision[1].get_branch() != revision[0].get_branch():
1452
# b is taken from revision[0].get_branch(), and
1453
# show_log will use its revision_history. Having
1454
# different branches will lead to weird behaviors.
1560
if revision is None:
1563
elif len(revision) == 1:
1564
rev1 = rev2 = revision[0].in_history(b).revno
1565
elif len(revision) == 2:
1566
if revision[1].get_branch() != revision[0].get_branch():
1567
# b is taken from revision[0].get_branch(), and
1568
# show_log will use its revision_history. Having
1569
# different branches will lead to weird behaviors.
1570
raise errors.BzrCommandError(
1571
"Log doesn't accept two revisions in different"
1573
if revision[0].spec is None:
1574
# missing begin-range means first revision
1577
rev1 = revision[0].in_history(b).revno
1579
if revision[1].spec is None:
1580
# missing end-range means last known revision
1583
rev2 = revision[1].in_history(b).revno
1455
1585
raise errors.BzrCommandError(
1456
"Log doesn't accept two revisions in different branches.")
1457
if revision[0].spec is None:
1458
# missing begin-range means first revision
1461
rev1 = revision[0].in_history(b).revno
1463
if revision[1].spec is None:
1464
# missing end-range means last known revision
1467
rev2 = revision[1].in_history(b).revno
1469
raise errors.BzrCommandError('bzr log --revision takes one or two values.')
1471
# By this point, the revision numbers are converted to the +ve
1472
# form if they were supplied in the -ve form, so we can do
1473
# this comparison in relative safety
1475
(rev2, rev1) = (rev1, rev2)
1477
if (log_format is None):
1478
default = b.get_config().log_format()
1479
log_format = get_log_format(long=long, short=short, line=line,
1481
lf = log_formatter(log_format,
1484
show_timezone=timezone)
1490
direction=direction,
1491
start_revision=rev1,
1586
'bzr log --revision takes one or two values.')
1588
# By this point, the revision numbers are converted to the +ve
1589
# form if they were supplied in the -ve form, so we can do
1590
# this comparison in relative safety
1592
(rev2, rev1) = (rev1, rev2)
1594
if log_format is None:
1595
log_format = log.log_formatter_registry.get_default(b)
1597
lf = log_format(show_ids=show_ids, to_file=self.outf,
1598
show_timezone=timezone)
1604
direction=direction,
1605
start_revision=rev1,
1496
1612
def get_log_format(long=False, short=False, line=False, default='long'):
1996
2118
takes_args = ['url?']
1997
2119
takes_options = [
1998
2120
RegistryOption('format',
1999
help='Upgrade to a specific format. Current formats'
2000
' are: default, knit, metaweave and weave.'
2001
' Default is knit; metaweave and weave are'
2121
help='Upgrade to a specific format. See "bzr help'
2122
' formats" for details',
2003
2123
registry=bzrdir.format_registry,
2004
converter=get_format_type,
2005
value_switches=True),
2124
converter=bzrdir.format_registry.make_bzrdir,
2125
value_switches=True, title='Branch format'),
2009
2129
def run(self, url='.', format=None):
2010
2130
from bzrlib.upgrade import upgrade
2011
2131
if format is None:
2012
format = get_format_type('default')
2132
format = bzrdir.format_registry.make_bzrdir('default')
2013
2133
upgrade(url, format)
2295
2416
takes_args = ['branch?']
2296
2417
takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2297
Option('show-base', help="Show base revision text in "
2299
Option('uncommitted', help='Apply uncommitted changes'
2300
' from a working copy, instead of branch changes'),
2301
Option('pull', help='If the destination is already'
2302
' completely merged into the source, pull from the'
2303
' source rather than merging. When this happens,'
2304
' you do not need to commit the result.'),
2308
from inspect import getdoc
2309
return getdoc(self) + '\n' + _mod_merge.merge_type_help()
2418
Option('show-base', help="Show base revision text in "
2420
Option('uncommitted', help='Apply uncommitted changes'
2421
' from a working copy, instead of branch changes'),
2422
Option('pull', help='If the destination is already'
2423
' completely merged into the source, pull from the'
2424
' source rather than merging. When this happens,'
2425
' you do not need to commit the result.'),
2427
help='branch to merge into, '
2428
'rather than the one containing the working directory',
2311
2434
def run(self, branch=None, revision=None, force=False, merge_type=None,
2312
show_base=False, reprocess=False, remember=False,
2313
uncommitted=False, pull=False):
2435
show_base=False, reprocess=False, remember=False,
2436
uncommitted=False, pull=False,
2314
2439
if merge_type is None:
2315
2440
merge_type = _mod_merge.Merge3Merger
2317
tree = WorkingTree.open_containing(u'.')[0]
2442
if directory is None: directory = u'.'
2443
tree = WorkingTree.open_containing(directory)[0]
2444
change_reporter = delta.ChangeReporter(tree.inventory)
2319
2446
if branch is not None:
2839
2959
class cmd_bind(Command):
2840
"""Bind the current branch to a master branch.
2842
After binding, commits must succeed on the master branch
2843
before they are executed on the local one.
2960
"""Convert the current branch into a checkout of the supplied branch.
2962
Once converted into a checkout, commits must succeed on the master branch
2963
before they will be applied to the local branch.
2965
See "help checkouts" for more information on checkouts.
2846
takes_args = ['location']
2968
takes_args = ['location?']
2847
2969
takes_options = []
2849
2971
def run(self, location=None):
2850
2972
b, relpath = Branch.open_containing(u'.')
2973
if location is None:
2975
location = b.get_old_bound_location()
2976
except errors.UpgradeRequired:
2977
raise errors.BzrCommandError('No location supplied. '
2978
'This format does not remember old locations.')
2980
if location is None:
2981
raise errors.BzrCommandError('No location supplied and no '
2982
'previous location known')
2851
2983
b_other = Branch.open(location)
2853
2985
b.bind(b_other)