653
653
are added. This search proceeds recursively into versioned
654
654
directories. If no names are given '.' is assumed.
656
A warning will be printed when nested trees are encountered,
657
unless they are explicitly ignored.
659
656
Therefore simply saying 'bzr add' will version all files that
660
657
are currently unknown.
1344
1341
class cmd_branches(Command):
1345
1342
__doc__ = """List the branches available at the current location.
1347
This command will print the names of all the branches at the current
1344
This command will print the names of all the branches at the current location.
1351
1347
takes_args = ['location?']
1353
Option('recursive', short_name='R',
1354
help='Recursively scan for branches rather than '
1355
'just looking in the specified location.')]
1357
def run(self, location=".", recursive=False):
1359
t = transport.get_transport(location)
1360
if not t.listable():
1361
raise errors.BzrCommandError(
1362
"Can't scan this type of location.")
1363
for b in bzrdir.BzrDir.find_branches(t):
1364
self.outf.write("%s\n" % urlutils.unescape_for_display(
1365
urlutils.relative_url(t.base, b.base),
1366
self.outf.encoding).rstrip("/"))
1368
dir = bzrdir.BzrDir.open_containing(location)[0]
1369
for branch in dir.list_branches():
1370
if branch.name is None:
1371
self.outf.write(gettext(" (default)\n"))
1373
self.outf.write(" %s\n" % branch.name.encode(
1374
self.outf.encoding))
1349
def run(self, location="."):
1350
dir = bzrdir.BzrDir.open_containing(location)[0]
1351
for branch in dir.list_branches():
1352
if branch.name is None:
1353
self.outf.write(gettext(" (default)\n"))
1355
self.outf.write(" %s\n" % branch.name.encode(self.outf.encoding))
1377
1358
class cmd_checkout(Command):
5255
5236
'option leads to global uncontrolled write access to your '
5258
Option('client-timeout', type=float,
5259
help='Override the default idle client timeout (5min).'),
5262
5241
def get_host_and_port(self, port):
5279
5258
return host, port
5281
5260
def run(self, port=None, inet=False, directory=None, allow_writes=False,
5282
protocol=None, client_timeout=None):
5283
5262
from bzrlib import transport
5284
5263
if directory is None:
5285
5264
directory = os.getcwd()
5290
5269
if not allow_writes:
5291
5270
url = 'readonly+' + url
5292
5271
t = transport.get_transport(url)
5294
protocol(t, host, port, inet, client_timeout)
5295
except TypeError, e:
5296
# We use symbol_versioning.deprecated_in just so that people
5297
# grepping can find it here.
5298
# symbol_versioning.deprecated_in((2, 5, 0))
5299
symbol_versioning.warn(
5300
'Got TypeError(%s)\ntrying to call protocol: %s.%s\n'
5301
'Most likely it needs to be updated to support a'
5302
' "timeout" parameter (added in bzr 2.5.0)'
5303
% (e, protocol.__module__, protocol),
5305
protocol(t, host, port, inet)
5272
protocol(t, host, port, inet)
5308
5275
class cmd_join(Command):
5783
5750
self.add_cleanup(branch.lock_read().unlock)
5785
# Restrict to the specified range
5786
tags = self._tags_for_range(branch, revision)
5752
graph = branch.repository.get_graph()
5753
rev1, rev2 = _get_revision_range(revision, branch, self.name())
5754
revid1, revid2 = rev1.rev_id, rev2.rev_id
5755
# only show revisions between revid1 and revid2 (inclusive)
5756
tags = [(tag, revid) for tag, revid in tags if
5757
graph.is_between(revid, revid1, revid2)]
5787
5758
if sort is None:
5788
5759
sort = tag_sort_methods.get()
5789
5760
sort(branch, tags)
5794
5765
revno = branch.revision_id_to_dotted_revno(revid)
5795
5766
if isinstance(revno, tuple):
5796
5767
revno = '.'.join(map(str, revno))
5797
except (errors.NoSuchRevision,
5798
errors.GhostRevisionsHaveNoRevno):
5768
except (errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno):
5799
5769
# Bad tag data/merges can lead to tagged revisions
5800
5770
# which are not in this branch. Fail gracefully ...
5804
5774
for tag, revspec in tags:
5805
5775
self.outf.write('%-20s %s\n' % (tag, revspec))
5807
def _tags_for_range(self, branch, revision):
5809
rev1, rev2 = _get_revision_range(revision, branch, self.name())
5810
revid1, revid2 = rev1.rev_id, rev2.rev_id
5811
# _get_revision_range will always set revid2 if it's not specified.
5812
# If revid1 is None, it means we want to start from the branch
5813
# origin which is always a valid ancestor. If revid1 == revid2, the
5814
# ancestry check is useless.
5815
if revid1 and revid1 != revid2:
5816
# FIXME: We really want to use the same graph than
5817
# branch.iter_merge_sorted_revisions below, but this is not
5818
# easily available -- vila 2011-09-23
5819
if branch.repository.get_graph().is_ancestor(revid2, revid1):
5820
# We don't want to output anything in this case...
5822
# only show revisions between revid1 and revid2 (inclusive)
5823
tagged_revids = branch.tags.get_reverse_tag_dict()
5825
for r in branch.iter_merge_sorted_revisions(
5826
start_revision_id=revid2, stop_revision_id=revid1,
5827
stop_rule='include'):
5828
revid_tags = tagged_revids.get(r[0], None)
5830
found.extend([(tag, r[0]) for tag in revid_tags])
5834
5778
class cmd_reconfigure(Command):
5835
5779
__doc__ = """Reconfigure the type of a bzr directory.