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
627
takes_options = ['remember', 'overwrite', 'verbose',
605
Option('create-prefix',
628
Option('create-prefix',
606
629
help='Create the path leading up to the branch '
607
'if it does not already exist')]
630
'if it does not already exist'),
631
Option('use-existing-dir',
632
help='By default push will fail if the target'
633
' directory exists, but does not already'
634
' have a control directory. This flag will'
635
' allow push to proceed.'),
608
637
takes_args = ['location?']
609
638
encoding_type = 'replace'
611
640
def run(self, location=None, remember=False, overwrite=False,
612
create_prefix=False, verbose=False):
641
create_prefix=False, verbose=False, use_existing_dir=False):
613
642
# FIXME: Way too big! Put this into a function called from the
628
657
location_url = to_transport.base
662
br_to = repository_to = dir_to = None
632
dir_to = bzrdir.BzrDir.open(location_url)
633
br_to = dir_to.open_branch()
664
dir_to = bzrdir.BzrDir.open_from_transport(to_transport)
634
665
except errors.NotBranchError:
636
to_transport = to_transport.clone('..')
637
if not create_prefix:
666
pass # Didn't find anything
668
# If we can open a branch, use its direct repository, otherwise see
669
# if there is a repository without a branch.
671
br_to = dir_to.open_branch()
672
except errors.NotBranchError:
673
# 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)
675
repository_to = dir_to.find_repository()
676
except errors.NoRepositoryPresent:
646
current = to_transport.base
647
needed = [(to_transport, to_transport.relpath(location_url))]
679
# Found a branch, so we must have found a repository
680
repository_to = br_to.repository
684
# XXX: Refactor the create_prefix/no_create_prefix code into a
685
# common helper function
687
to_transport.mkdir('.')
688
except errors.FileExists:
689
if not use_existing_dir:
690
raise errors.BzrCommandError("Target directory %s"
691
" already exists, but does not have a valid .bzr"
692
" directory. Supply --use-existing-dir to push"
693
" there anyway." % location)
694
except errors.NoSuchFile:
695
if not create_prefix:
696
raise errors.BzrCommandError("Parent directory of %s"
698
"\nYou may supply --create-prefix to create all"
699
" leading parent directories."
702
cur_transport = to_transport
703
needed = [cur_transport]
704
# Recurse upwards until we can create a directory successfully
706
new_transport = cur_transport.clone('..')
707
if new_transport.base == cur_transport.base:
708
raise errors.BzrCommandError("Failed to create path"
712
new_transport.mkdir('.')
713
except errors.NoSuchFile:
714
needed.append(new_transport)
715
cur_transport = new_transport
719
# 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 "
721
cur_transport = needed.pop()
722
cur_transport.mkdir('.')
724
# Now the target directory exists, but doesn't have a .bzr
725
# directory. So we need to create it, along with any work to create
726
# all of the dependent branches, etc.
660
727
dir_to = br_from.bzrdir.clone(location_url,
661
728
revision_id=br_from.last_revision())
662
729
br_to = dir_to.open_branch()
730
count = br_to.last_revision_info()[0]
731
# We successfully created the target, remember it
732
if br_from.get_push_location() is None or remember:
733
br_from.set_push_location(br_to.base)
734
elif repository_to is None:
735
# we have a bzrdir but no branch or repository
736
# XXX: Figure out what to do other than complain.
737
raise errors.BzrCommandError("At %s you have a valid .bzr control"
738
" directory, but not a branch or repository. This is an"
739
" unsupported configuration. Please move the target directory"
740
" out of the way and try again."
743
# We have a repository but no branch, copy the revisions, and then
745
last_revision_id = br_from.last_revision()
746
repository_to.fetch(br_from.repository,
747
revision_id=last_revision_id)
748
br_to = br_from.clone(dir_to, revision_id=last_revision_id)
663
749
count = len(br_to.revision_history())
664
# We successfully created the target, remember it
665
750
if br_from.get_push_location() is None or remember:
666
751
br_from.set_push_location(br_to.base)
752
else: # We have a valid to branch
668
753
# We were able to connect to the remote location, so remember it
669
754
# we don't need to successfully push because of possible divergence.
670
755
if br_from.get_push_location() is None or remember:
676
761
except errors.NotLocalUrl:
677
762
warning('This transport does not update the working '
678
763
'tree of: %s' % (br_to.base,))
679
count = br_to.pull(br_from, overwrite)
764
count = br_from.push(br_to, overwrite)
680
765
except errors.NoWorkingTree:
681
count = br_to.pull(br_from, overwrite)
766
count = br_from.push(br_to, overwrite)
683
count = tree_to.pull(br_from, overwrite)
770
count = br_from.push(tree_to.branch, overwrite)
684
774
except errors.DivergedBranches:
685
775
raise errors.BzrCommandError('These branches have diverged.'
686
776
' Try using "merge" and then "push".')
1090
1180
takes_args = ['location?']
1091
1181
takes_options = [
1092
1182
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',
1183
help='Specify a format for this branch. See "bzr '
1184
'help formats" for details',
1185
converter=bzrdir.format_registry.make_bzrdir,
1097
1186
registry=bzrdir.format_registry,
1098
converter=get_format_type,
1099
value_switches=True),
1187
value_switches=True, title="Branch Format"),
1101
1189
def run(self, location=None, format=None):
1102
1190
if format is None:
1103
format = get_format_type('default')
1191
format = bzrdir.format_registry.make_bzrdir('default')
1104
1192
if location is None:
1105
1193
location = u'.'
1151
1239
takes_args = ["location"]
1152
1240
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',
1241
help='Specify a format for this repository. See'
1242
' "bzr help formats" for details',
1157
1243
registry=bzrdir.format_registry,
1158
converter=get_format_type,
1159
value_switches=True),
1244
converter=bzrdir.format_registry.make_bzrdir,
1245
value_switches=True, title='Repository format'),
1160
1246
Option('trees',
1161
1247
help='Allows branches in repository to have'
1162
1248
' a working tree')]
1163
1249
aliases = ["init-repo"]
1164
1250
def run(self, location, format=None, trees=False):
1165
1251
if format is None:
1166
format = get_format_type('default')
1252
format = bzrdir.format_registry.make_bzrdir('default')
1168
1254
if location is None:
1982
2060
takes_args = ['url?']
1983
2061
takes_options = [
1984
2062
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'
2063
help='Upgrade to a specific format. See "bzr help'
2064
' formats" for details',
1989
2065
registry=bzrdir.format_registry,
1990
converter=get_format_type,
1991
value_switches=True),
2066
converter=bzrdir.format_registry.make_bzrdir,
2067
value_switches=True, title='Branch format'),
1995
2071
def run(self, url='.', format=None):
1996
2072
from bzrlib.upgrade import upgrade
1997
2073
if format is None:
1998
format = get_format_type('default')
2074
format = bzrdir.format_registry.make_bzrdir('default')
1999
2075
upgrade(url, format)