~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to patch.py

  • Committer: Aaron Bentley
  • Date: 2006-12-20 04:56:32 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20061220045632-lst8iyqzqqnfbyn8
Patch now handles sftp, code slightly simpler too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
import sys
18
18
from subprocess import Popen, PIPE
19
 
from urlparse import urlsplit, urlunsplit
20
19
 
21
20
from bzrlib import urlutils
22
21
from bzrlib.transport import get_transport
30
29
        my_file = sys.stdin
31
30
    else:
32
31
        location = urlutils.normalize_url(location)
33
 
        (scheme, loc, path, query, fragment) = urlsplit(location)
34
 
        loc_start = urlunsplit((scheme, loc, '/', '', ''))
35
 
        my_file = get_transport(loc_start).get(path[1:])
 
32
        dirname, basename = urlutils.split(location)
 
33
        my_file = get_transport(dirname).get(basename)
36
34
    cmd = ['patch', '--directory', tree.basedir, '--strip', str(strip)]
37
35
    r = 0
38
36
    child_proc = Popen(cmd, stdin=PIPE)