254
254
def rspush(tree, location=None, overwrite=False, working_tree=True,
259
if (tree.bzrdir.root_transport.base !=
260
tree.branch.bzrdir.root_transport.base):
261
raise NotStandalone(tree.bzrdir.root_transport.base)
262
if (tree.branch.get_bound_location() is not None):
263
raise NotStandalone(tree.bzrdir.root_transport.base)
264
if (tree.branch.repository.is_shared()):
265
raise NotStandalone(tree.bzrdir.root_transport.base)
266
push_location = get_push_data(tree)
267
if location is not None:
268
if not location.endswith('/'):
270
push_location = location
272
if push_location is None:
273
raise BzrCommandError("No rspush location known or specified.")
275
if (push_location.find('::') != -1):
280
if (push_location.find('://') != -1 or
281
push_location.find(':') == -1):
282
raise BzrCommandError("Invalid rsync path %r." % push_location)
285
clean, non_source = is_clean(tree)
287
print """Error: This tree has uncommitted changes or unknown (?) files.
288
Use "bzr status" to list them."""
290
final_exclusions = non_source[:]
293
final_exclusions = []
294
for path, status, kind, file_id, entry in wt.list_files():
295
final_exclusions.append(path)
297
final_exclusions.extend(exclusions)
300
if not history_subset(push_location, tree.branch, _rsync=my_rsync):
301
raise bzrlib.errors.BzrCommandError("Local branch is not a"
302
" newer version of remote"
305
if not empty_or_absent(push_location):
306
raise bzrlib.errors.BzrCommandError("Remote location is not a"
307
" bzr branch (or empty"
309
except RsyncStreamIO:
310
raise bzrlib.errors.BzrCommandError("Rsync could not use the"
311
" specified location. Please ensure that"
312
' "%s" is of the form "machine:/path".' % push_location)
313
print "Pushing to %s" % push_location
314
my_rsync(tree.basedir+'/', push_location, ssh=usessh,
315
excludes=final_exclusions)
317
set_push_data(tree, push_location)
261
if (tree.bzrdir.root_transport.base !=
262
tree.branch.bzrdir.root_transport.base):
263
raise NotStandalone(tree.bzrdir.root_transport.base)
264
if (tree.branch.get_bound_location() is not None):
265
raise NotStandalone(tree.bzrdir.root_transport.base)
266
if (tree.branch.repository.is_shared()):
267
raise NotStandalone(tree.bzrdir.root_transport.base)
268
push_location = get_push_data(tree)
269
if location is not None:
270
if not location.endswith('/'):
272
push_location = location
274
if push_location is None:
275
raise BzrCommandError("No rspush location known or specified.")
277
if (push_location.find('::') != -1):
282
if (push_location.find('://') != -1 or
283
push_location.find(':') == -1):
284
raise BzrCommandError("Invalid rsync path %r." % push_location)
287
clean, non_source = is_clean(tree)
289
print ('Error: This tree has uncommitted changes or unknown'
290
' (?) files. Use "bzr status" to list them.')
292
final_exclusions = non_source[:]
295
final_exclusions = []
296
for path, status, kind, file_id, entry in wt.list_files():
297
final_exclusions.append(path)
299
final_exclusions.extend(exclusions)
302
if not history_subset(push_location, tree.branch,
304
raise bzrlib.errors.BzrCommandError(
305
"Local branch is not a newer version of remote"
308
if not empty_or_absent(push_location):
309
raise bzrlib.errors.BzrCommandError(
310
"Remote location is not a bzr branch (or empty"
312
except RsyncStreamIO:
313
raise bzrlib.errors.BzrCommandError("Rsync could not use the"
314
" specified location. Please ensure that"
315
' "%s" is of the form "machine:/path".' % push_location)
316
print "Pushing to %s" % push_location
317
my_rsync(tree.basedir+'/', push_location, ssh=usessh,
318
excludes=final_exclusions)
320
set_push_data(tree, push_location)
320
325
def short_committer(committer):