118
121
This reports on versioned and unknown files, reporting them
119
122
grouped by state. Possible states are:
122
125
Versioned in the working copy but not in the previous revision.
125
128
Versioned in the previous revision but removed or deleted
126
129
in the working copy.
129
132
Path of this file changed from the previous revision;
130
133
the text may also have changed. This includes files whose
131
134
parent directory was renamed.
134
137
Text has changed since the previous revision.
140
File kind has been changed (e.g. from file to directory).
137
143
Not versioned and not matching an ignore pattern.
139
145
To see ignored files use 'bzr ignored'. For details in the
140
146
changes to file texts, use 'bzr diff'.
142
--short gives a one character status flag for each item, similar
143
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
145
168
If no arguments are specified, the status of the entire working
146
169
directory is shown. Otherwise, only the status of the specified
604
632
takes_options = ['remember', 'overwrite', 'verbose',
605
Option('create-prefix',
633
Option('create-prefix',
606
634
help='Create the path leading up to the branch '
607
'if it does not already exist')]
635
'if it does not already exist'),
636
Option('use-existing-dir',
637
help='By default push will fail if the target'
638
' directory exists, but does not already'
639
' have a control directory. This flag will'
640
' allow push to proceed.'),
608
642
takes_args = ['location?']
609
643
encoding_type = 'replace'
611
645
def run(self, location=None, remember=False, overwrite=False,
612
create_prefix=False, verbose=False):
646
create_prefix=False, verbose=False, use_existing_dir=False):
613
647
# FIXME: Way too big! Put this into a function called from the
628
662
location_url = to_transport.base
667
br_to = repository_to = dir_to = None
632
dir_to = bzrdir.BzrDir.open(location_url)
633
br_to = dir_to.open_branch()
669
dir_to = bzrdir.BzrDir.open_from_transport(to_transport)
634
670
except errors.NotBranchError:
636
to_transport = to_transport.clone('..')
637
if not create_prefix:
671
pass # Didn't find anything
673
# If we can open a branch, use its direct repository, otherwise see
674
# if there is a repository without a branch.
676
br_to = dir_to.open_branch()
677
except errors.NotBranchError:
678
# Didn't find a branch, can we find a repository?
639
relurl = to_transport.relpath(location_url)
640
mutter('creating directory %s => %s', location_url, relurl)
641
to_transport.mkdir(relurl)
642
except errors.NoSuchFile:
643
raise errors.BzrCommandError("Parent directory of %s "
644
"does not exist." % location)
680
repository_to = dir_to.find_repository()
681
except errors.NoRepositoryPresent:
646
current = to_transport.base
647
needed = [(to_transport, to_transport.relpath(location_url))]
684
# Found a branch, so we must have found a repository
685
repository_to = br_to.repository
689
# XXX: Refactor the create_prefix/no_create_prefix code into a
690
# common helper function
692
to_transport.mkdir('.')
693
except errors.FileExists:
694
if not use_existing_dir:
695
raise errors.BzrCommandError("Target directory %s"
696
" already exists, but does not have a valid .bzr"
697
" directory. Supply --use-existing-dir to push"
698
" there anyway." % location)
699
except errors.NoSuchFile:
700
if not create_prefix:
701
raise errors.BzrCommandError("Parent directory of %s"
703
"\nYou may supply --create-prefix to create all"
704
" leading parent directories."
707
cur_transport = to_transport
708
needed = [cur_transport]
709
# Recurse upwards until we can create a directory successfully
711
new_transport = cur_transport.clone('..')
712
if new_transport.base == cur_transport.base:
713
raise errors.BzrCommandError("Failed to create path"
717
new_transport.mkdir('.')
718
except errors.NoSuchFile:
719
needed.append(new_transport)
720
cur_transport = new_transport
724
# Now we only need to create child directories
650
to_transport, relpath = needed[-1]
651
to_transport.mkdir(relpath)
653
except errors.NoSuchFile:
654
new_transport = to_transport.clone('..')
655
needed.append((new_transport,
656
new_transport.relpath(to_transport.base)))
657
if new_transport.base == to_transport.base:
658
raise errors.BzrCommandError("Could not create "
726
cur_transport = needed.pop()
727
cur_transport.mkdir('.')
729
# Now the target directory exists, but doesn't have a .bzr
730
# directory. So we need to create it, along with any work to create
731
# all of the dependent branches, etc.
660
732
dir_to = br_from.bzrdir.clone(location_url,
661
733
revision_id=br_from.last_revision())
662
734
br_to = dir_to.open_branch()
735
count = br_to.last_revision_info()[0]
736
# We successfully created the target, remember it
737
if br_from.get_push_location() is None or remember:
738
br_from.set_push_location(br_to.base)
739
elif repository_to is None:
740
# we have a bzrdir but no branch or repository
741
# XXX: Figure out what to do other than complain.
742
raise errors.BzrCommandError("At %s you have a valid .bzr control"
743
" directory, but not a branch or repository. This is an"
744
" unsupported configuration. Please move the target directory"
745
" out of the way and try again."
748
# We have a repository but no branch, copy the revisions, and then
750
last_revision_id = br_from.last_revision()
751
repository_to.fetch(br_from.repository,
752
revision_id=last_revision_id)
753
br_to = br_from.clone(dir_to, revision_id=last_revision_id)
663
754
count = len(br_to.revision_history())
664
# We successfully created the target, remember it
665
755
if br_from.get_push_location() is None or remember:
666
756
br_from.set_push_location(br_to.base)
757
else: # We have a valid to branch
668
758
# We were able to connect to the remote location, so remember it
669
759
# we don't need to successfully push because of possible divergence.
670
760
if br_from.get_push_location() is None or remember:
676
766
except errors.NotLocalUrl:
677
767
warning('This transport does not update the working '
678
768
'tree of: %s' % (br_to.base,))
679
count = br_to.pull(br_from, overwrite)
769
count = br_from.push(br_to, overwrite)
680
770
except errors.NoWorkingTree:
681
count = br_to.pull(br_from, overwrite)
771
count = br_from.push(br_to, overwrite)
683
count = tree_to.pull(br_from, overwrite)
775
count = br_from.push(tree_to.branch, overwrite)
684
779
except errors.DivergedBranches:
685
780
raise errors.BzrCommandError('These branches have diverged.'
686
781
' Try using "merge" and then "push".')
1090
1187
takes_args = ['location?']
1091
1188
takes_options = [
1092
RegistryOption('format',
1093
help='Specify a format for this branch. Current'
1094
' formats are: default, knit, metaweave and'
1095
' weave. Default is knit; metaweave and'
1096
' weave are deprecated',
1097
registry=bzrdir.format_registry,
1098
converter=get_format_type,
1099
value_switches=True),
1189
RegistryOption('format',
1190
help='Specify a format for this branch. '
1191
'See "help formats".',
1192
registry=bzrdir.format_registry,
1193
converter=bzrdir.format_registry.make_bzrdir,
1194
value_switches=True,
1195
title="Branch Format",
1101
1198
def run(self, location=None, format=None):
1102
1199
if format is None:
1103
format = get_format_type('default')
1200
format = bzrdir.format_registry.make_bzrdir('default')
1104
1201
if location is None:
1105
1202
location = u'.'
1148
1245
cd trunk-checkout
1149
1246
(add files here)
1151
takes_args = ["location"]
1248
takes_args = ["location"]
1152
1249
takes_options = [RegistryOption('format',
1153
help='Specify a format for this repository.'
1154
' Current formats are: default, knit,'
1155
' metaweave and weave. Default is knit;'
1156
' metaweave and weave are deprecated',
1250
help='Specify a format for this repository. See'
1251
' "bzr help formats" for details',
1157
1252
registry=bzrdir.format_registry,
1158
converter=get_format_type,
1159
value_switches=True),
1253
converter=bzrdir.format_registry.make_bzrdir,
1254
value_switches=True, title='Repository format'),
1160
1255
Option('trees',
1161
1256
help='Allows branches in repository to have'
1162
1257
' a working tree')]
1163
1258
aliases = ["init-repo"]
1164
1259
def run(self, location, format=None, trees=False):
1165
1260
if format is None:
1166
format = get_format_type('default')
1261
format = bzrdir.format_registry.make_bzrdir('default')
1168
1263
if location is None:
1982
2082
takes_args = ['url?']
1983
2083
takes_options = [
1984
2084
RegistryOption('format',
1985
help='Upgrade to a specific format. Current formats'
1986
' are: default, knit, metaweave and weave.'
1987
' Default is knit; metaweave and weave are'
2085
help='Upgrade to a specific format. See "bzr help'
2086
' formats" for details',
1989
2087
registry=bzrdir.format_registry,
1990
converter=get_format_type,
1991
value_switches=True),
2088
converter=bzrdir.format_registry.make_bzrdir,
2089
value_switches=True, title='Branch format'),
1995
2093
def run(self, url='.', format=None):
1996
2094
from bzrlib.upgrade import upgrade
1997
2095
if format is None:
1998
format = get_format_type('default')
2096
format = bzrdir.format_registry.make_bzrdir('default')
1999
2097
upgrade(url, format)