70
70
return tree, new_list
73
def get_format_type(typestring):
74
"""Parse and return a format specifier."""
75
if typestring == "metadir":
76
return bzrdir.BzrDirMetaFormat1()
77
if typestring == "knit":
78
format = bzrdir.BzrDirMetaFormat1()
79
format.repository_format = bzrlib.repository.RepositoryFormatKnit1()
81
msg = "No known bzr-dir format %s. Supported types are: metadir\n" %\
83
raise BzrCommandError(msg)
73
86
# TODO: Make sure no commands unconditionally use the working directory as a
74
87
# branch. If a filename argument is used, the first of them should be used to
75
88
# specify the branch. (Perhaps this can be factored out into some kind of
866
879
bzr commit -m 'imported project'
868
881
takes_args = ['location?']
869
def run(self, location=None):
884
help='Create a specific format rather than the'
885
' current default format. Currently this '
886
' option only accepts =metadir',
887
type=get_format_type),
889
def run(self, location=None, format=None):
870
890
from bzrlib.branch import Branch
871
891
if location is None:
878
898
# locations if the user supplies an extended path
879
899
if not os.path.exists(location):
880
900
os.mkdir(location)
881
bzrdir.BzrDir.create_standalone_workingtree(location)
903
bzrdir.BzrDir.create_standalone_workingtree(location)
905
new_dir = format.initialize(location)
906
new_dir.create_repository()
907
new_dir.create_branch()
908
# TODO: ask the bzrdir format for the right classs
909
import bzrlib.workingtree
910
bzrlib.workingtree.WorkingTreeFormat3().initialize(new_dir)
884
913
class cmd_diff(Command):
1527
def get_format_type(typestring):
1528
"""Parse and return a format specifier."""
1529
if typestring == "metadir":
1530
return bzrdir.BzrDirMetaFormat1()
1531
if typestring == "knit":
1532
format = bzrdir.BzrDirMetaFormat1()
1533
format.repository_format = bzrlib.repository.RepositoryFormatKnit1()
1535
msg = "No known bzr-dir format %s. Supported types are: metadir\n" %\
1537
raise BzrCommandError(msg)
1540
1556
class cmd_upgrade(Command):
1541
1557
"""Upgrade branch storage to current format.
1901
1917
restore(tree.abspath(filename))
1902
1918
except NotConflicted:
1904
conflicts = merge_inner(tree.branch, other_tree, base_tree,
1920
conflicts = merge_inner(tree.branch, other_tree, base_tree,
1905
1922
interesting_ids = interesting_ids,
1906
1923
other_rev_id=pending_merges[0],
1907
1924
merge_type=merge_type,
2032
2049
raise BzrCommandError("No missing location known or specified.")
2033
2050
print "Using last location: " + local_branch.get_parent()
2034
2051
remote_branch = bzrlib.branch.Branch.open(other_branch)
2035
local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
2036
if (log_format == None):
2037
default = bzrlib.config.BranchConfig(local_branch).log_format()
2038
log_format = get_log_format(long=long, short=short, line=line, default=default)
2039
lf = log_formatter(log_format, sys.stdout,
2041
show_timezone='original')
2042
if reverse is False:
2043
local_extra.reverse()
2044
remote_extra.reverse()
2045
if local_extra and not theirs_only:
2046
print "You have %d extra revision(s):" % len(local_extra)
2047
for data in iter_log_data(local_extra, local_branch.repository,
2050
printed_local = True
2052
printed_local = False
2053
if remote_extra and not mine_only:
2054
if printed_local is True:
2056
print "You are missing %d revision(s):" % len(remote_extra)
2057
for data in iter_log_data(remote_extra, remote_branch.repository,
2060
if not remote_extra and not local_extra:
2062
print "Branches are up to date."
2065
if parent is None and other_branch is not None:
2066
local_branch.set_parent(other_branch)
2052
remote_branch.lock_read()
2054
local_branch.lock_write()
2056
local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
2057
if (log_format == None):
2058
default = bzrlib.config.BranchConfig(local_branch).log_format()
2059
log_format = get_log_format(long=long, short=short, line=line, default=default)
2060
lf = log_formatter(log_format, sys.stdout,
2062
show_timezone='original')
2063
if reverse is False:
2064
local_extra.reverse()
2065
remote_extra.reverse()
2066
if local_extra and not theirs_only:
2067
print "You have %d extra revision(s):" % len(local_extra)
2068
for data in iter_log_data(local_extra, local_branch.repository,
2071
printed_local = True
2073
printed_local = False
2074
if remote_extra and not mine_only:
2075
if printed_local is True:
2077
print "You are missing %d revision(s):" % len(remote_extra)
2078
for data in iter_log_data(remote_extra, remote_branch.repository,
2081
if not remote_extra and not local_extra:
2083
print "Branches are up to date."
2086
if parent is None and other_branch is not None:
2087
local_branch.set_parent(other_branch)
2090
local_branch.unlock()
2092
remote_branch.unlock()
2070
2095
class cmd_plugins(Command):