~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2005-12-30 17:58:46 UTC
  • Revision ID: abentley@panoramicfeedback.com-20051230175846-fc0ef16a74331408
Added support for pushing with no working tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
    except RsyncNoFile:
249
249
        return True
250
250
 
251
 
def push(cur_branch, location=None, overwrite=False):
 
251
def push(cur_branch, location=None, overwrite=False, working_tree=True):
252
252
    push_location = get_push_data(cur_branch)
253
253
    if location is not None:
254
254
        if not location.endswith('/'):
269
269
        print """Error: This tree has uncommitted changes or unknown (?) files.
270
270
Use "bzr status" to list them."""
271
271
        sys.exit(1)
272
 
    non_source.extend(exclusions)
 
272
    if working_tree:
 
273
        final_exclusions = non_source[:]
 
274
    else:
 
275
        wt = cur_branch.working_tree()
 
276
        final_exclusions = []
 
277
        for path, status, kind, file_id, entry in wt.list_files():
 
278
            final_exclusions.append(path)
 
279
 
 
280
    final_exclusions.extend(exclusions)
273
281
    if not overwrite:
274
282
        try:
275
283
            if not history_subset(push_location, cur_branch):
286
294
                " specified location.  Please ensure that"
287
295
                ' "%s" is of the form "machine:/path".' % push_location)
288
296
    print "Pushing to %s" % push_location
289
 
    rsync(cur_branch.base+'/', push_location, ssh=True, excludes=non_source)
 
297
    rsync(cur_branch.base+'/', push_location, ssh=True, 
 
298
          excludes=final_exclusions)
290
299
 
291
300
    set_push_data(cur_branch, push_location)
292
301