~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2005-09-27 13:18:25 UTC
  • mfrom: (200.1.1)
  • Revision ID: abentley@panoramicfeedback.com-20050927131825-3e6ad0de1dfe04dc
Merged error handling for bad rsync locations. (Eirik Nygaard)

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
        proc.stdout.read()
174
174
        proc.stdout.close()
175
175
    proc.wait()
176
 
    if proc.returncode == 23:
 
176
    if proc.returncode == 12:
 
177
        raise RsyncStreamIO()
 
178
    elif proc.returncode == 23:
177
179
        raise RsyncNoFile(source)
178
180
    elif proc.returncode != 0:
179
181
        raise RsyncUnknownStatus(proc.returncode)
196
198
        proc.stderr.read()
197
199
        proc.stderr.close()
198
200
    proc.wait()
199
 
    if proc.returncode == 23:
 
201
    if proc.returncode == 12:
 
202
        raise RsyncStreamIO()
 
203
    elif proc.returncode == 23:
200
204
        raise RsyncNoFile(source)
201
205
    elif proc.returncode != 0:
202
206
        raise RsyncUnknownStatus(proc.returncode)
215
219
    def __init__(self, path):
216
220
        Exception.__init__(self, "No such file %s" % path)
217
221
 
 
222
class RsyncStreamIO(Exception):
 
223
    def __init__(self):
 
224
        Exception.__init__(self, "Error in rsync protocol data stream.")
 
225
 
218
226
def get_revision_history(location):
219
227
    tempdir = tempfile.mkdtemp('push')
220
228
    try:
271
279
                raise bzrlib.errors.BzrCommandError("Remote location is not a"
272
280
                                                    " bzr branch (or empty"
273
281
                                                    " directory)")
 
282
        except RsyncStreamIO:
 
283
            raise bzrlib.errors.BzrCommandError("Rsync could not use the"
 
284
                " specified location.  Please ensure that"
 
285
                ' "%s" is of the form "machine:/path".' % push_location)
274
286
    print "Pushing to %s" % push_location
275
287
    rsync(cur_branch.base+'/', push_location, ssh=True, excludes=non_source)
276
288