1236
1236
elif prefix == '1':
1237
1237
old_label = 'old/'
1238
1238
new_label = 'new/'
1240
if not ':' in prefix:
1241
raise BzrCommandError(
1242
"--prefix expects two values separated by a colon")
1243
1240
old_label, new_label = prefix.split(":")
1242
raise BzrCommandError(
1243
"--prefix expects two values separated by a colon")
1245
if revision and len(revision) > 2:
1246
raise errors.BzrCommandError('bzr diff --revision takes exactly'
1247
' one or two revision specifiers')
1246
1250
tree1, file_list = internal_tree_files(file_list)
1266
1270
tree1, tree2 = None, None
1269
if revision is not None:
1270
if tree2 is not None:
1271
raise errors.BzrCommandError("Can't specify -r with two branches")
1272
if (len(revision) == 1) or (revision[1].spec is None):
1273
return diff_cmd_helper(tree1, file_list, diff_options,
1275
old_label=old_label, new_label=new_label)
1276
elif len(revision) == 2:
1277
return diff_cmd_helper(tree1, file_list, diff_options,
1278
revision[0], revision[1],
1279
old_label=old_label, new_label=new_label)
1281
raise errors.BzrCommandError('bzr diff --revision takes exactly'
1282
' one or two revision identifiers')
1284
if tree2 is not None:
1285
return show_diff_trees(tree1, tree2, sys.stdout,
1286
specific_files=file_list,
1287
external_diff_options=diff_options,
1288
old_label=old_label, new_label=new_label)
1290
return diff_cmd_helper(tree1, file_list, diff_options,
1291
old_label=old_label, new_label=new_label)
1274
if tree2 is not None:
1275
if revision is not None:
1276
# FIXME: but there should be a clean way to diff between
1277
# non-default versions of two trees, it's not hard to do
1279
raise errors.BzrCommandError(
1280
"Sorry, diffing arbitrary revisions across branches "
1281
"is not implemented yet")
1282
return show_diff_trees(tree1, tree2, sys.stdout,
1283
specific_files=file_list,
1284
external_diff_options=diff_options,
1285
old_label=old_label, new_label=new_label)
1287
return diff_cmd_helper(tree1, file_list, diff_options,
1288
revision_specs=revision,
1289
old_label=old_label, new_label=new_label)
1294
1292
class cmd_deleted(Command):